/*
 * Modern design system for the Productivity App.
 *
 * A shadcn/ui-inspired token layer sitting on top of Bootstrap 5.3. shadcn is
 * React-only, so instead of the library we adopt its design language: a neutral
 * zinc palette, an indigo accent, soft borders, a consistent radius scale and a
 * first-class dark mode. Everything is driven by CSS variables so both themes
 * share one set of component rules. Dark mode piggybacks on Bootstrap's native
 * [data-bs-theme="dark"] switch (set on <html>), which also flips Bootstrap's
 * own components for free.
 */

/* ------------------------------------------------------------------ *
 * Design tokens
 * ------------------------------------------------------------------ */
:root,
[data-bs-theme="light"] {
    --background: #f5f5f7;
    --surface: #ffffff;
    --surface-2: #fafafa;
    --surface-hover: #f4f4f5;
    --foreground: #18181b;
    --muted: #f4f4f5;
    --muted-foreground: #6b7280;
    --border: #e6e6ea;
    --border-strong: #d4d4d8;
    --input: #e4e4e7;
    --ring: rgba(99, 102, 241, 0.45);

    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-foreground: #ffffff;
    --primary-soft: rgba(79, 70, 229, 0.1);

    /* Tags are their own voice, a shade violet of the indigo accent, so a #tag
       reads as a tag and not as a link. */
    --tag-color: #7c3aed;
    --tag-soft: rgba(124, 58, 237, 0.12);

    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    /* Accents on a booked day slot: amber for A and B, grey for the optional C. */
    --slot-accent: #d97706;
    --slot-optional-accent: #9ca3af;

    --radius: 0.7rem;
    --radius-sm: 0.5rem;
    --radius-lg: 1rem;
    --radius-pill: 999px;

    --shadow-xs: 0 1px 2px rgba(24, 24, 27, 0.05);
    --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.06), 0 1px 3px rgba(24, 24, 27, 0.04);
    --shadow-md: 0 4px 12px rgba(24, 24, 27, 0.08), 0 2px 4px rgba(24, 24, 27, 0.04);
    --shadow-lg: 0 12px 32px rgba(24, 24, 27, 0.14);

    --nav-bg: rgba(255, 255, 255, 0.82);
    --nav-border: rgba(20, 20, 25, 0.08);
}

[data-bs-theme="dark"] {
    --background: #09090b;
    --surface: #17171a;
    --surface-2: #1c1c20;
    --surface-hover: #26262b;
    --foreground: #f4f4f5;
    --muted: #26262b;
    --muted-foreground: #a1a1aa;
    --border: #2a2a30;
    --border-strong: #3a3a42;
    --input: #2a2a30;
    --ring: rgba(129, 140, 248, 0.5);

    --primary: #6366f1;
    --primary-hover: #818cf8;
    --primary-foreground: #ffffff;
    --primary-soft: rgba(99, 102, 241, 0.18);

    --tag-color: #c4b5fd;
    --tag-soft: rgba(167, 139, 250, 0.2);

    --success: #22c55e;
    --danger: #f87171;
    --warning: #fbbf24;
    --slot-accent: #fbbf24;
    --slot-optional-accent: #71717a;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);

    --nav-bg: rgba(15, 15, 18, 0.8);
    --nav-border: rgba(255, 255, 255, 0.08);
}

/* ------------------------------------------------------------------ *
 * Bootstrap variable mapping — makes stock components adopt the tokens
 * ------------------------------------------------------------------ */
:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
    --bs-body-bg: var(--background);
    --bs-body-color: var(--foreground);
    --bs-border-color: var(--border);
    --bs-border-color-translucent: var(--border);
    --bs-secondary-color: var(--muted-foreground);
    --bs-secondary-bg: var(--muted);
    --bs-tertiary-bg: var(--surface-2);
    --bs-emphasis-color: var(--foreground);
    --bs-heading-color: var(--foreground);
    --bs-link-color: var(--primary);
    --bs-link-hover-color: var(--primary-hover);
    --bs-border-radius: var(--radius);
    --bs-border-radius-sm: var(--radius-sm);
    --bs-border-radius-lg: var(--radius-lg);
    --bs-primary: var(--primary);
    --bs-primary-rgb: 79, 70, 229;
    --bs-focus-ring-color: var(--ring);
}

[data-bs-theme="dark"] {
    --bs-primary-rgb: 99, 102, 241;
}

/* How far down the screen the sticky navbar reaches, for anything that sticks
   to the top underneath it. base.html measures the bar and overwrites this with
   the real number; the value here is what the first paint uses. */
:root {
    --app-navbar-height: 3.35rem;
}

/* ------------------------------------------------------------------ *
 * Base
 * ------------------------------------------------------------------ */
body {
    background-color: var(--background);
    color: var(--foreground);
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.app-main {
    padding-top: 1.25rem;
}

h1, h2, h3, h4, h5, h6 {
    letter-spacing: -0.011em;
}

.text-muted {
    color: var(--muted-foreground) !important;
}

::selection {
    background: var(--primary-soft);
}

a {
    text-decoration: none;
}

*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ------------------------------------------------------------------ *
 * Inline icons
 * ------------------------------------------------------------------ */
.app-icon {
    flex: 0 0 auto;
    vertical-align: -0.15em;
}

.btn .app-icon { margin-right: 0.4rem; }
.btn.btn-sm .app-icon { margin-right: 0.3rem; }

.dropdown-item { display: flex; align-items: center; }
.dropdown-item .app-icon,
.dropdown-item i.fa-solid,
.dropdown-item i.fa-regular {
    width: 1rem;
    margin-right: 0.6rem;
    color: var(--muted-foreground);
    text-align: center;
}
.dropdown-item.text-danger .app-icon,
.dropdown-item.text-danger i { color: inherit; }

.settings-label { display: flex; align-items: center; gap: 0.5rem; }
.settings-label .app-icon { color: var(--muted-foreground); }

.empty-state .app-icon {
    color: var(--muted-foreground);
    opacity: 0.8;
    margin-bottom: 0.85rem;
}

/* ------------------------------------------------------------------ *
 * Navbar
 * ------------------------------------------------------------------ */
.app-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    padding: 0.55rem 0;
    background: var(--nav-bg);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--nav-border);
}

.app-logo {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
}

.app-brand-mark {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.6rem;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #fff;
    font-size: 1rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease;
}

.app-logo:hover .app-brand-mark { transform: scale(1.05); }

.app-navbar .navbar-nav {
    gap: 0.35rem;
}

.app-navbar .nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.7rem;
    color: var(--muted-foreground);
    font-size: 0.92rem;
    font-weight: 500;
    transition: color 0.15s ease, background 0.15s ease;
}

.app-navbar .nav-link .app-icon { color: inherit; opacity: 0.85; }

.app-navbar .nav-link:hover {
    color: var(--foreground);
    background: var(--surface-hover);
}

.app-navbar .nav-link.active {
    color: var(--foreground);
    background: var(--surface-hover);
}

.app-nav-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 2.15rem;
    height: 2.15rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--muted-foreground);
    font-size: 1rem;
    line-height: 1;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.icon-button:hover,
.icon-button:focus-visible {
    color: var(--foreground);
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

.theme-toggle .theme-toggle-sun { display: none; }
.theme-toggle .theme-toggle-moon { display: inline; }
[data-bs-theme="dark"] .theme-toggle .theme-toggle-sun { display: inline; }
[data-bs-theme="dark"] .theme-toggle .theme-toggle-moon { display: none; }

/* Safe mode reads like the theme switch beside it: one icon for each state,
   and the shield fills in with the accent colour while it is on, so "is it on"
   is answerable from across the room. */
.safe-mode-toggle .safe-mode-on { display: none; }
.safe-mode-toggle .safe-mode-off { display: inline; }
[data-safe-mode="on"] .safe-mode-toggle .safe-mode-on { display: inline; }
[data-safe-mode="on"] .safe-mode-toggle .safe-mode-off { display: none; }

[data-safe-mode="on"] .safe-mode-toggle {
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    background: var(--primary-soft);
}

.user-menu-button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 2.15rem;
    padding: 0 0.55rem 0 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--foreground);
    font-size: 0.88rem;
    font-weight: 500;
}

.user-menu-button:hover {
    background: var(--surface-hover);
}

.user-avatar {
    display: inline-grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: var(--radius-pill);
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* Active-timer pill (kept, retuned to tokens) */
.active-timer-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    height: 2.15rem;
    padding: 0 0.75rem;
    border: 1px solid color-mix(in srgb, var(--success) 45%, transparent);
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--success) 12%, var(--surface));
    color: var(--foreground);
    text-decoration: none;
    font-weight: 600;
}

.active-timer-link:hover,
.active-timer-link:focus {
    color: var(--foreground);
    background: color-mix(in srgb, var(--success) 20%, var(--surface));
}

.active-timer-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: var(--radius-pill);
    background: var(--success);
    box-shadow: 0 0 0 0.18rem color-mix(in srgb, var(--success) 25%, transparent);
    animation: timerPulse 2s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

.active-timer-icon { font-size: 0.95rem; line-height: 1; }
.active-timer-label {
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
}

.offline-indicator {
    display: none;
    align-items: center;
    gap: 0.4rem;
    height: 2.15rem;
    padding: 0 0.7rem;
    border: 1px solid color-mix(in srgb, var(--danger) 55%, transparent);
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--danger) 14%, var(--surface));
    color: var(--danger);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.offline-indicator.is-visible { display: inline-flex; }

/* ------------------------------------------------------------------ *
 * Project switcher (command palette)
 * ------------------------------------------------------------------ */
.project-switcher-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 18rem;
    height: 2.15rem;
    padding: 0 0.55rem 0 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--foreground);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.project-switcher-button:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

.project-switcher-button .switcher-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.project-switcher-button .switcher-chevron { flex: 0 0 auto; color: var(--muted-foreground); }
.project-switcher-button .switcher-kbd {
    display: inline-flex;
    align-items: center;
    margin-left: 0.1rem;
    padding: 0.05rem 0.35rem;
    border: 1px solid var(--border);
    border-radius: 0.35rem;
    background: var(--muted);
    color: var(--muted-foreground);
    font-size: 0.68rem;
    font-weight: 600;
}

.switcher-overlay {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 12vh 1rem 1rem;
    background: rgba(9, 9, 11, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.switcher-overlay.is-open { display: flex; }

.switcher-panel {
    width: min(40rem, 100%);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    animation: switcherIn 0.14s ease-out;
}

@keyframes switcherIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.switcher-search {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}

.switcher-search i { color: var(--muted-foreground); }

.switcher-search input {
    flex: 1;
    border: 0;
    background: transparent;
    color: var(--foreground);
    font-size: 1rem;
    outline: none;
}

.switcher-search input::placeholder { color: var(--muted-foreground); }

.switcher-results {
    overflow-y: auto;
    padding: 0.4rem;
}

/* Separate consecutive sections so untitled ones don't blend together. */
.switcher-group:not(.d-none) ~ .switcher-group:not(.d-none) {
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--border);
}

.switcher-group-label {
    padding: 0.6rem 0.75rem 0.3rem;
    color: var(--muted-foreground);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.switcher-group-backlog .switcher-group-label { color: var(--muted-foreground); opacity: 0.85; }
.switcher-group-backlog .switcher-item .switcher-dot { background: var(--border); }

.switcher-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--foreground);
    font-size: 0.92rem;
    text-align: left;
    text-decoration: none;
}

.switcher-item:hover,
.switcher-item.is-active {
    background: var(--surface-hover);
    color: var(--foreground);
}

.switcher-item .switcher-dot {
    flex: 0 0 auto;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: var(--radius-pill);
    background: var(--border-strong);
}

.switcher-item.is-current .switcher-dot { background: var(--primary); box-shadow: 0 0 0 0.16rem var(--primary-soft); }
.switcher-item .switcher-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-item .switcher-badge { color: var(--muted-foreground); font-size: 0.85rem; }
.switcher-item .switcher-current-tag {
    padding: 0.05rem 0.4rem;
    border-radius: var(--radius-pill);
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.68rem;
    font-weight: 700;
}

.switcher-empty { padding: 1.5rem; text-align: center; color: var(--muted-foreground); }

.switcher-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--border);
    color: var(--muted-foreground);
    font-size: 0.75rem;
}

.switcher-footer kbd {
    padding: 0.05rem 0.3rem;
    border: 1px solid var(--border);
    border-radius: 0.3rem;
    background: var(--muted);
    color: var(--muted-foreground);
    font-size: 0.7rem;
}

/* ------------------------------------------------------------------ *
 * Cards, surfaces, generic containers
 * ------------------------------------------------------------------ */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--foreground);
    box-shadow: var(--shadow-sm);
}

.card.shadow-sm { box-shadow: var(--shadow-sm) !important; }

.list-group-item {
    background: var(--surface);
    border-color: var(--border);
    color: var(--foreground);
}

.bg-light { background-color: var(--surface-2) !important; color: var(--foreground); }

.empty-state {
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--surface-2);
}

hr, .dropdown-divider { border-color: var(--border); }

/* Page-heading helper for a consistent header rhythm */
.page-heading h1 { font-weight: 700; letter-spacing: -0.02em; }

/* ------------------------------------------------------------------ *
 * Project detail — header + main/sidebar layout
 * ------------------------------------------------------------------ */
.project-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.project-detail-title {
    font-size: clamp(1.55rem, 3vw, 2.1rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.project-detail-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.project-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    color: var(--muted-foreground);
    font-size: 0.74rem;
    font-weight: 600;
    white-space: nowrap;
}

.project-badge-star {
    border-color: color-mix(in srgb, #f59e0b 45%, var(--border));
    background: color-mix(in srgb, #f59e0b 14%, var(--surface));
    color: #b45309;
}
[data-bs-theme="dark"] .project-badge-star { color: #fbbf24; }

.project-badge-archived {
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    background: var(--primary-soft);
    color: var(--primary);
}

.project-detail-body {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
}

.project-plan-col { min-width: 0; }

.project-meta-col {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

/* Sidebar layout (default): the plan is wide on the left, Thoughts & Frequency
 * sit in a sticky column beside it. */
@media (min-width: 992px) {
    [data-project-layout="sidebar"] .project-detail-body {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    }
    [data-project-layout="sidebar"] .project-meta-col {
        position: sticky;
        top: 4.75rem;
    }
}

/* Stacked layout (the earlier look): Thoughts & Frequency sit above the plan,
 * side by side on wider screens. */
[data-project-layout="stacked"] .project-meta-col { order: -1; }

@media (min-width: 768px) {
    [data-project-layout="stacked"] .project-meta-col {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

.dropdown-menu form { margin: 0; }
.dropdown-item.text-danger:hover { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); }

/* ------------------------------------------------------------------ *
 * App settings — segmented controls
 * ------------------------------------------------------------------ */
.settings-group + .settings-group { margin-top: 1.35rem; }

.settings-label { font-weight: 600; font-size: 0.95rem; }

.settings-hint {
    margin: 0.15rem 0 0.65rem;
    color: var(--muted-foreground);
    font-size: 0.83rem;
}

.settings-segments {
    display: flex;
    width: 100%;
    gap: 0.25rem;
    padding: 0.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
}

.settings-segment {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.45rem 0.6rem;
    border: 0;
    border-radius: calc(var(--radius) - 0.28rem);
    background: transparent;
    color: var(--muted-foreground);
    font-size: 0.88rem;
    font-weight: 600;
    transition: color 0.15s ease, background 0.15s ease;
}

.settings-segment:hover { color: var(--foreground); }

.settings-segment.is-active {
    background: var(--surface);
    color: var(--foreground);
    box-shadow: var(--shadow-xs);
}

[data-bs-theme="dark"] .settings-segment.is-active { background: var(--surface-hover); }

.settings-segments.is-locked {
    opacity: 0.5;
    pointer-events: none;
}

/* ================================================================== *
 * Classic skin — restores the original Bootstrap-flavoured look by
 * re-pointing the design tokens to the app's original palette. Because
 * every component reads from tokens, this reskins the whole app without
 * touching markup. Light-only, like the original UI.
 * ================================================================== */
:root[data-ui="classic"] {
    --background: #f8f9fa;
    --surface: #ffffff;
    --surface-2: #fbfcfd;
    --surface-hover: #f1f3f5;
    --foreground: #1f2937;
    --muted: #f1f3f5;
    --muted-foreground: #6c757d;
    --border: #dee2e6;
    --border-strong: #ced4da;
    --input: #ced4da;
    --ring: rgba(13, 110, 253, 0.25);

    --primary: #0d6efd;
    --primary-hover: #0b5ed7;
    --primary-foreground: #ffffff;
    --primary-soft: #eef5ff;

    --tag-color: #6f42c1;
    --tag-soft: rgba(111, 66, 193, 0.12);

    --success: #198754;
    --danger: #dc3545;
    --warning: #ffc107;

    --radius: 0.375rem;
    --radius-sm: 0.375rem;
    --radius-lg: 0.75rem;

    --shadow-xs: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.06);
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);

    --bs-primary-rgb: 13, 110, 253;
}

/* Original dark navbar bar (was .navbar-dark.bg-dark), no glass/sticky */
:root[data-ui="classic"] .app-navbar {
    position: static;
    background: #212529;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 0;
}

:root[data-ui="classic"] .app-navbar .nav-link { color: rgba(255, 255, 255, 0.75); }
:root[data-ui="classic"] .app-navbar .nav-link:hover,
:root[data-ui="classic"] .app-navbar .nav-link.active {
    color: #fff;
    background: transparent;
}

:root[data-ui="classic"] .app-brand-mark {
    background: transparent;
    box-shadow: none;
    font-size: 1.2rem;
}

/* Make the new controls legible on the dark bar */
:root[data-ui="classic"] .app-navbar .project-switcher-button,
:root[data-ui="classic"] .app-navbar .user-menu-button {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}
:root[data-ui="classic"] .app-navbar .project-switcher-button:hover,
:root[data-ui="classic"] .app-navbar .user-menu-button:hover {
    background: rgba(255, 255, 255, 0.12);
}
:root[data-ui="classic"] .app-navbar .project-switcher-button .switcher-chevron { color: rgba(255, 255, 255, 0.7); }
:root[data-ui="classic"] .app-navbar .switcher-kbd {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}
:root[data-ui="classic"] .app-navbar .user-avatar {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}
:root[data-ui="classic"] .theme-toggle { display: none; }

/* Light hamburger icon for the dark bar */
:root[data-ui="classic"] .app-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

@media (max-width: 991.98px) {
    :root[data-ui="classic"] .app-navbar .navbar-collapse {
        background: #2b3035;
        border-color: rgba(255, 255, 255, 0.15);
    }
    :root[data-ui="classic"] .app-navbar .navbar-collapse .user-menu-button { color: #fff; }
}

/* ------------------------------------------------------------------ *
 * Buttons
 * ------------------------------------------------------------------ */
.btn {
    --bs-btn-border-radius: var(--radius-sm);
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

.btn:active { transform: translateY(0.5px); }

.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-hover);
    --bs-btn-hover-border-color: var(--primary-hover);
    --bs-btn-active-bg: var(--primary-hover);
    --bs-btn-active-border-color: var(--primary-hover);
    --bs-btn-disabled-bg: var(--primary);
    --bs-btn-disabled-border-color: var(--primary);
    --bs-btn-color: var(--primary-foreground);
    --bs-btn-hover-color: var(--primary-foreground);
    --bs-btn-active-color: var(--primary-foreground);
    box-shadow: var(--shadow-xs);
}

.btn-outline-primary {
    --bs-btn-color: var(--primary);
    --bs-btn-border-color: color-mix(in srgb, var(--primary) 50%, var(--border));
    --bs-btn-hover-bg: var(--primary);
    --bs-btn-hover-border-color: var(--primary);
    --bs-btn-hover-color: var(--primary-foreground);
    --bs-btn-active-bg: var(--primary-hover);
    --bs-btn-active-border-color: var(--primary-hover);
}

.btn-outline-secondary {
    --bs-btn-color: var(--foreground);
    --bs-btn-border-color: var(--border);
    --bs-btn-hover-bg: var(--surface-hover);
    --bs-btn-hover-border-color: var(--border-strong);
    --bs-btn-hover-color: var(--foreground);
    --bs-btn-active-bg: var(--surface-hover);
    --bs-btn-active-color: var(--foreground);
    --bs-btn-active-border-color: var(--border-strong);
    background: var(--surface);
}

.btn-secondary {
    --bs-btn-bg: var(--muted);
    --bs-btn-border-color: var(--border);
    --bs-btn-color: var(--foreground);
    --bs-btn-hover-bg: var(--surface-hover);
    --bs-btn-hover-border-color: var(--border-strong);
    --bs-btn-hover-color: var(--foreground);
}

.btn-success {
    --bs-btn-bg: var(--success);
    --bs-btn-border-color: var(--success);
    --bs-btn-hover-bg: color-mix(in srgb, var(--success) 85%, #000);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--success) 85%, #000);
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
}

.btn-outline-danger {
    --bs-btn-color: var(--danger);
    --bs-btn-border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
    --bs-btn-hover-bg: var(--danger);
    --bs-btn-hover-border-color: var(--danger);
    --bs-btn-hover-color: #fff;
}

/* ------------------------------------------------------------------ *
 * Forms
 * ------------------------------------------------------------------ */
.form-control,
.form-select {
    border-radius: var(--radius-sm);
    border-color: var(--input);
    background-color: var(--surface);
    color: var(--foreground);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--ring);
    background-color: var(--surface);
    color: var(--foreground);
}

.form-control::placeholder { color: var(--muted-foreground); opacity: 0.8; }

.form-check-input {
    border-color: var(--border-strong);
    background-color: var(--surface);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--ring);
}

.form-label { font-weight: 500; color: var(--foreground); }
.form-text { color: var(--muted-foreground); }

/* ------------------------------------------------------------------ *
 * Modals, dropdowns, tables, badges, alerts
 * ------------------------------------------------------------------ */
.modal-content {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--foreground);
    box-shadow: var(--shadow-lg);
}

.modal-header, .modal-footer { border-color: var(--border); }
.modal-backdrop.show { opacity: 0.5; }

.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    padding: 0.35rem;
    --bs-dropdown-link-hover-bg: var(--surface-hover);
    --bs-dropdown-link-active-bg: var(--surface-hover);
    --bs-dropdown-link-active-color: var(--foreground);
    --bs-dropdown-link-color: var(--foreground);
}

.dropdown-item { border-radius: var(--radius-sm); }

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--foreground);
    --bs-table-border-color: var(--border);
    color: var(--foreground);
}

.table > thead th {
    border-bottom-color: var(--border);
    color: var(--muted-foreground);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge.text-bg-primary { background: var(--primary) !important; color: var(--primary-foreground) !important; }
.badge.text-bg-success { background: var(--success) !important; color: #fff !important; }
.badge.text-bg-dark,
.badge.text-bg-secondary {
    background: var(--foreground) !important;
    color: var(--background) !important;
}

.alert {
    border-radius: var(--radius);
    border-color: var(--border);
}

.alert-success {
    background: color-mix(in srgb, var(--success) 12%, var(--surface));
    color: var(--foreground);
    border-color: color-mix(in srgb, var(--success) 40%, var(--border));
}
.alert-danger {
    background: color-mix(in srgb, var(--danger) 12%, var(--surface));
    color: var(--foreground);
    border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
}
.alert-warning {
    background: color-mix(in srgb, var(--warning) 14%, var(--surface));
    color: var(--foreground);
    border-color: color-mix(in srgb, var(--warning) 40%, var(--border));
}
.alert-secondary, .alert-info {
    background: var(--surface-2);
    color: var(--foreground);
    border-color: var(--border);
}

/* ------------------------------------------------------------------ *
 * Responsive niceties
 * ------------------------------------------------------------------ */
@media (max-width: 991.98px) {
    .app-navbar .navbar-collapse {
        margin-top: 0.6rem;
        padding: 0.6rem;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: var(--surface);
        box-shadow: var(--shadow-md);
    }

    .app-nav-actions {
        flex-wrap: wrap;
        margin-top: 0.5rem;
    }
}

@media (max-width: 767.98px) {
    .project-switcher-button .switcher-kbd { display: none; }
    .project-switcher-button { max-width: 42vw; }
}

@media (max-width: 575.98px) {
    .switcher-overlay { padding: 6vh 0.6rem 0.6rem; }
    .switcher-panel { max-height: 82vh; }
    [data-navbar-brand-group] { min-width: 0; }
}
