/* =====================================================
   Avi HRP — Global Theme System (Phase 4)
   Semantic tokens: Light default + Dark override
   ===================================================== */

:root,
[data-theme="light"] {
    /* App shell */
    --app-bg: #f4f6fa;
    --surface-bg: #ffffff;
    --surface-bg-soft: #f8fafc;
    --text-primary: #172033;
    --text-muted: #667085;
    --border-color: #d9e1ee;
    --navbar-bg: rgba(255, 255, 255, 0.95);
    --navbar-border: rgba(193, 213, 211, 0.3);
    --navbar-text: #172033;

    /* Sidebar — light */
    --sidebar-bg: linear-gradient(180deg, #f8fafc 0%, #e9eef5 100%);
    --sidebar-accent: #194799;
    --sidebar-accent-soft: rgba(25, 71, 153, 0.12);
    --sidebar-text: #1e293b;
    --sidebar-text-muted: #64748b;
    --sidebar-border: rgba(15, 23, 42, 0.08);
    --sidebar-active-bg: linear-gradient(90deg, rgba(25, 71, 153, 0.1), rgba(59, 130, 246, 0.06));
    --sidebar-hover-bg: rgba(30, 58, 138, 0.06);
    --sidebar-section-bg: rgba(15, 23, 42, 0.03);
    --sidebar-section-header-bg: rgba(15, 23, 42, 0.04);
    --sidebar-shadow: 4px 0 24px rgba(15, 23, 42, 0.08);

    /* Layout dimensions (shared) */
    --sidebar-width-expanded: 240px;
    --sidebar-width-collapsed: 72px;
    --sidebar-current-width: var(--sidebar-width-expanded);
    --sidebar-transition: 0.28s cubic-bezier(0.4, 0, 0.2, 1);

    color-scheme: light;
}

[data-theme="dark"] {
    --app-bg: #0a0e27;
    --surface-bg: #121a35;
    --surface-bg-soft: #0f1629;
    --text-primary: rgba(255, 255, 255, 0.92);
    --text-muted: rgba(255, 255, 255, 0.58);
    --border-color: rgba(255, 255, 255, 0.1);
    --navbar-bg: rgba(10, 14, 39, 0.95);
    --navbar-border: rgba(255, 255, 255, 0.08);
    --navbar-text: rgba(255, 255, 255, 0.92);

    --sidebar-bg: linear-gradient(180deg, #0a0e27 0%, #0d1b3e 55%, #1a1040 100%);
    --sidebar-accent: #22d3ee;
    --sidebar-accent-soft: rgba(34, 211, 238, 0.18);
    --sidebar-text: rgba(255, 255, 255, 0.88);
    --sidebar-text-muted: rgba(255, 255, 255, 0.58);
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-active-bg: linear-gradient(90deg, rgba(34, 211, 238, 0.18), rgba(37, 99, 235, 0.12));
    --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
    --sidebar-section-bg: rgba(255, 255, 255, 0.04);
    --sidebar-section-header-bg: rgba(255, 255, 255, 0.05);
    --sidebar-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);

    color-scheme: dark;
}

/* --- Shell surfaces --- */
.atc-body {
    background-color: var(--app-bg);
    color: var(--text-primary);
}

.atc-navbar {
    background: var(--navbar-bg) !important;
    border-bottom-color: var(--navbar-border) !important;
    color: var(--navbar-text);
}

.atc-main-content {
    background: var(--app-bg);
    color: var(--text-primary);
}

.atc-navbar-grid__end > span,
.atc-navbar-grid__end .d-flex.flex-column > span {
    color: var(--navbar-text);
}

/* --- Theme toggle button --- */
.atc-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--surface-bg-soft);
    color: var(--text-primary);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.atc-theme-toggle:hover {
    background: var(--surface-bg);
    border-color: var(--sidebar-accent);
    color: var(--sidebar-accent);
    transform: scale(1.05);
}

.atc-theme-toggle:focus-visible {
    outline: 2px solid var(--sidebar-accent);
    outline-offset: 2px;
}

[data-theme="dark"] .atc-theme-toggle {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: #fcd34d;
}

[data-theme="dark"] .atc-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fde68a;
}

/* --- Sidebar modern: section surfaces from tokens --- */
.sidebar-modern .sidebar-section {
    background: var(--sidebar-section-bg);
    border-color: var(--sidebar-border);
}

.sidebar-modern .sidebar-section-header {
    background: var(--sidebar-section-header-bg);
    color: var(--sidebar-text);
}

[data-theme="light"] .sidebar-modern .nav-link {
    color: var(--sidebar-text);
}

[data-theme="light"] .sidebar-modern .sidebar-section-content .nav-link {
    color: var(--sidebar-text-muted);
}

[data-theme="light"] .aviation-logo-main,
[data-theme="dark"] .aviation-logo-main {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .aviation-logo-main {
    text-shadow: none !important;
}
