/* ============================================================
   NOVA AI Creative Studio — Light Theme (White + Light Blue)
   ============================================================ */

:root {
    /* Color Palette - Enterprise Light */
    --bg-primary: rgba(240, 246, 255, 0.4);
    --bg-secondary: rgba(255, 255, 255, 0.4);
    --bg-tertiary: rgba(255, 255, 255, 0.3);
    --bg-surface: rgba(255, 255, 255, 0.5);
    --bg-surface-hover: rgba(255, 255, 255, 0.7);
    --bg-glass: rgba(255, 255, 255, 0.4);
    --bg-glass-hover: rgba(255, 255, 255, 0.6);

    /* Accent Colors */
    --accent-blue: #2563eb;
    --accent-blue-light: #60a5fa;
    --accent-blue-dark: #1d4ed8;
    --accent-indigo: #4f46e5;
    --accent-blue-soft: rgba(37, 99, 235, 0.1);
    --accent-blue-muted: rgba(37, 99, 235, 0.2);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #2563eb, #4f46e5);
    --gradient-secondary: linear-gradient(135deg, #60a5fa, #4f46e5);
    --gradient-generate: linear-gradient(135deg, #2563eb, #1d4ed8);

    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-tertiary: #64748b;
    --text-muted: #94a3b8;

    /* Border */
    --border-color: rgba(200, 215, 235, 0.5);
    --border-color-hover: rgba(160, 190, 225, 0.7);
    --border-glass: rgba(255, 255, 255, 0.5);
    --border-accent: rgba(74, 144, 226, 0.3);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 12px 36px rgba(0, 0, 0, 0.1);
    --shadow-glow-blue: 0 4px 16px rgba(74, 144, 226, 0.2);

    /* Layout */
    --sidebar-width: 240px;
    --sidebar-collapsed: 68px;
    --header-height: 60px;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;
    --border-radius-full: 9999px;

    /* Typography */
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading: 'Outfit', 'Inter', sans-serif;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, #ffffff 0%, #eef4fc 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    touch-action: manipulation;
    overscroll-behavior-y: contain;
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
}

input, textarea, [contenteditable="true"] {
    user-select: text !important;
    -webkit-user-select: text !important;
}

img {
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
}

#bgParticles, .ai-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    opacity: 1;
    contain: strict;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

#aiBrainCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: block;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
}

a { text-decoration: none; color: inherit; touch-action: manipulation; }

button {
    border: none; background: none; cursor: pointer;
    font-family: var(--font-body); color: var(--text-primary); outline: none;
    touch-action: manipulation;
}

input, textarea, select {
    font-family: var(--font-body); outline: none; border: none; background: none;
    touch-action: manipulation;
}

img { max-width: 100%; display: block; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* ============================================================
   Hide background effects (simplified)
   ============================================================ */
.bg-particles, .bg-orbs { display: none; }

/* ============================================================
   App Layout
   ============================================================ */
.app {
    display: flex;
    width: 100%;
    height: 100vh;
    position: relative;
    z-index: 1; /* Above the canvas */
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-base);
    min-width: 0;
    background: transparent;
}

.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* ============================================================
   Header
   ============================================================ */
.main-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 28px;
    height: var(--header-height);
    background: var(--bg-secondary);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.mobile-menu-btn {
    display: none;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: var(--border-radius-sm);
}

.mobile-menu-btn:hover { color: var(--text-primary); background: var(--bg-surface); }

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-full);
    padding: 8px 16px;
    flex: 1;
    max-width: 420px;
    transition: all var(--transition-base);
}

.search-bar:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(74,144,226,0.1);
}

.search-bar svg { color: var(--text-tertiary); flex-shrink: 0; }

.search-bar input {
    flex: 1; color: var(--text-primary); font-size: 0.85rem; background: transparent;
}

.search-bar input::placeholder { color: var(--text-tertiary); }

.header-actions {
    display: flex; align-items: center; gap: 10px; margin-left: auto;
}

.header-btn {
    position: relative; padding: 8px; border-radius: var(--border-radius-sm);
    color: var(--text-secondary); transition: all var(--transition-fast);
}

.header-btn:hover { color: var(--text-primary); background: var(--bg-surface); }

.notification-badge {
    position: absolute; top: 4px; right: 4px; width: 16px; height: 16px;
    background: #e74c5e; border-radius: 50%; font-size: 0.6rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center; color: white;
}

.user-avatar {
    position: relative; width: 34px; height: 34px; border-radius: 50%;
    overflow: hidden; border: 2px solid var(--accent-blue-muted); cursor: pointer;
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.avatar-status {
    position: absolute; bottom: 0; right: 0; width: 10px; height: 10px;
    background: #34c77b; border-radius: 50%; border: 2px solid white;
}

.user-name { font-weight: 500; font-size: 0.85rem; color: var(--text-primary); }

/* ============================================================
   Page Container
   ============================================================ */
.page-container { flex: 1; overflow-y: auto; overflow-x: hidden; }

.page { display: none; min-height: 100%; }
.page.active { display: block; animation: fadeSlideUp 0.3s ease-out; }

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Breadcrumb
   ============================================================ */
.page-breadcrumb {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.85rem; color: var(--text-secondary);
}

.page-breadcrumb span:last-child { color: var(--text-primary); font-weight: 500; }

.close-page-btn {
    padding: 8px; border-radius: var(--border-radius-sm);
    color: var(--text-secondary); transition: all var(--transition-fast);
}

.close-page-btn:hover { color: var(--text-primary); background: var(--bg-surface); }

/* ============================================================
   Mobile Nav
   ============================================================ */
.mobile-nav {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: rgba(255,255,255,0.95); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-color); padding: 4px 0;
    justify-content: space-around;
}

.mobile-nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 10px; border-radius: var(--border-radius-sm);
    color: var(--text-tertiary); font-size: 0.6rem; font-weight: 500;
    transition: color var(--transition-fast);
}

.mobile-nav-item.active { color: var(--accent-blue); }

/* ============================================================
   Utility
   ============================================================ */
.hidden { display: none !important; }
.full-width { width: 100%; }
.optional-tag { font-size: 0.72rem; color: var(--text-tertiary); font-weight: 400; }
.section-label {
    font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--text-tertiary); font-weight: 600; margin-bottom: 8px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
    .main-content { margin-left: 0; }
    .mobile-menu-btn { display: flex; }
    .mobile-nav { display: flex; }
    .main-header { padding: 10px 16px; }
    .user-name { display: none; }
}

@media (max-width: 768px) {
    /* Prevent iOS & Android zoom-on-focus */
    input, textarea, select {
        font-size: 16px !important;
    }
    
    .page-container {
        padding-bottom: calc(75px + env(safe-area-inset-bottom, 0px));
        -webkit-overflow-scrolling: touch;
    }

    /* Chat page handles its own height to fit perfectly above mobile nav */
    #page-chat {
        height: calc(100vh - var(--header-height) - 60px);
        height: calc(100dvh - var(--header-height) - 60px);
        min-height: 0;
        overflow: hidden;
    }
}

@media (max-width: 640px) {
    .search-bar { display: none; }
}
