/**
 * admin/css/themes.css
 *
 * Three premium admin theme presets, switched via [data-theme] on <html>.
 *
 *   data-theme="premium"  - Modern off-white + cool neutrals + emerald accents.
 *                           Brighter than the legacy beige palette, clean
 *                           SaaS look. Default.
 *   data-theme="warm"     - Classic warm/cream tones (the legacy palette,
 *                           preserved for users who prefer it).
 *   data-theme="midnight" - Polished dark mode with soft contrast, jewel
 *                           accent tones, premium feel for night work.
 *
 * The earliest possible script in admin/includes/layout.php reads the saved
 * preference from cookie / localStorage and applies it BEFORE first paint to
 * prevent a flash of the wrong palette.
 *
 * Every theme overrides the same CSS custom properties already defined in
 * base.css, so existing components do not need rewrites — they just pick
 * up the new tokens.
 */

/* ==========================================================================
   1. Premium (default) - modern off-white + cool neutrals + emerald primary.
   ==========================================================================
   Pain point being solved: the legacy warm palette ships warm-tinted beige
   (#F5F0EB / #FAFAF7) for page + secondary surfaces, which reads as muddy
   on most monitors and washes out warm body text. Premium switches to a
   neutral slate scale so the surfaces stay quiet and the content pops. */
[data-theme="premium"] {
    /* Primary - sage stays, but slightly more saturated for hover energy */
    --color-primary:           #5A7A5A;
    --color-primary-hover:     #4A6A4A;
    --color-primary-active:    #3A5A3A;
    --color-primary-light:     #E6EDE3;
    --color-primary-shadow:    rgba(90, 122, 90, 0.30);
    --color-primary-shadow-hover: rgba(74, 106, 74, 0.40);
    --color-primary-glow:      rgba(90, 122, 90, 0.12);

    /* Neutral scale - cool slate instead of warm tan */
    --color-dark:              #0F172A;
    --color-gray-900:          #0F172A;
    --color-gray-800:          #1E293B;
    --color-gray-700:          #334155;
    --color-gray-600:          #475569;
    --color-gray-500:          #64748B;
    --color-gray-400:          #94A3B8;
    --color-gray-300:          #CBD5E1;
    --color-gray-200:          #E2E8F0;
    --color-gray-100:          #F1F5F9;
    --color-gray-50:           #F8FAFC;
    --color-white:             #ffffff;

    /* Surfaces - bright, layered */
    --surface-primary:         #ffffff;
    --surface-secondary:       #F8FAFC;       /* page bg, was #FAFAF7 */
    --surface-tertiary:        #F1F5F9;       /* card bg, was #F5F0EB */
    --surface-elevated:        rgba(255, 255, 255, 0.95);
    --surface-glass:           rgba(255, 255, 255, 0.72);
    --surface-overlay:         rgba(15, 23, 42, 0.55);

    /* Borders - crisp */
    --border-color:            #E2E8F0;
    --border-color-light:      #F1F5F9;
    --border-color-btn:        #CBD5E1;
    --border-color-subtle:     rgba(148, 163, 184, 0.18);

    /* Shadows - premium layered. Adds the subtle elevation that makes
       cards feel lifted instead of pasted on. */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px rgba(15, 23, 42, 0.05), 0 10px 15px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 15px rgba(15, 23, 42, 0.06), 0 20px 25px rgba(15, 23, 42, 0.10), 0 8px 10px rgba(15, 23, 42, 0.04);
    --shadow-xl: 0 20px 25px rgba(15, 23, 42, 0.08), 0 25px 50px rgba(15, 23, 42, 0.15);
}

/* ==========================================================================
   2. Warm - the legacy palette, kept so users who liked it can opt back.
   ========================================================================== */
[data-theme="warm"] {
    /* All defaults from base.css already match the warm palette;
       this block exists so [data-theme="warm"] is a valid attribute the
       switcher can persist, and so the body bg/text override below works.
       No token changes — explicit reset to the same warm tans defined in
       :root so this block can be matched against by JS / serialized for
       the picker UI. */
    --color-primary:           #5E7259;
    --color-primary-hover:     #556855;
    --color-primary-active:    #445344;

    --color-gray-50:           #FAFAF7;
    --color-gray-100:          #F5F0EB;
    --color-gray-200:          #EDE5DB;

    --surface-primary:         #ffffff;
    --surface-secondary:       #FAFAF7;
    --surface-tertiary:        #F5F0EB;

    --border-color:            #EDE5DB;
    --border-color-light:      #F5F0EB;
}

/* ==========================================================================
   3. Midnight - polished dark mode. Higher contrast + jewel accents.
   ========================================================================== */
[data-theme="midnight"] {
    --color-primary:           #34D399;       /* emerald 400 */
    --color-primary-hover:     #10B981;       /* emerald 500 */
    --color-primary-active:    #059669;       /* emerald 600 */
    --color-primary-light:     rgba(52, 211, 153, 0.12);
    --color-primary-shadow:    rgba(52, 211, 153, 0.35);
    --color-primary-shadow-hover: rgba(16, 185, 129, 0.45);
    --color-primary-glow:      rgba(52, 211, 153, 0.18);

    --color-dark:              #F1F5F9;
    --color-gray-900:          #F8FAFC;
    --color-gray-800:          #E2E8F0;
    --color-gray-700:          #CBD5E1;
    --color-gray-600:          #94A3B8;
    --color-gray-500:          #64748B;
    --color-gray-400:          #475569;
    --color-gray-300:          #334155;
    --color-gray-200:          #1E293B;
    --color-gray-100:          #0F172A;
    --color-gray-50:           #020617;
    --color-white:             #0F172A;

    --surface-primary:         #1E293B;
    --surface-secondary:       #0F172A;
    --surface-tertiary:        #1E293B;
    --surface-elevated:        rgba(30, 41, 59, 0.92);
    --surface-glass:           rgba(30, 41, 59, 0.70);
    --surface-overlay:         rgba(0, 0, 0, 0.75);

    --border-color:            #334155;
    --border-color-light:      #1E293B;
    --border-color-btn:        #475569;
    --border-color-subtle:     rgba(148, 163, 184, 0.20);

    --color-success-bg:        rgba(16, 185, 129, 0.15);
    --color-success-text:      #6EE7B7;
    --color-success-border:    rgba(16, 185, 129, 0.30);

    --color-warning-bg:        rgba(245, 158, 11, 0.15);
    --color-warning-text:      #FCD34D;
    --color-warning-border:    rgba(245, 158, 11, 0.30);

    --color-danger-bg:         rgba(220, 38, 38, 0.15);
    --color-danger-text:       #FCA5A5;
    --color-danger-border:     rgba(220, 38, 38, 0.30);

    --color-info-bg:           rgba(59, 130, 246, 0.15);
    --color-info-text:         #93C5FD;
    --color-info-border:       rgba(59, 130, 246, 0.30);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.40);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.30);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.40), 0 10px 15px rgba(0, 0, 0, 0.50);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.50), 0 20px 25px rgba(0, 0, 0, 0.55);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.55), 0 25px 50px rgba(0, 0, 0, 0.65);
}

/* ==========================================================================
   4. Body + text contrast normalization (all themes).
   ==========================================================================
   The legacy bodyClass on admin pages defaults to `bg-slate-100 min-h-screen`
   which competes with the theme tokens above. Force the body to follow the
   theme's surface-secondary so the switcher always wins. Also bump base
   body text to gray-900 for legibility - the original used unstyled
   inherited browser color which renders mid-gray on most macOS profiles. */
body {
    background-color: var(--surface-secondary) !important;
    color: var(--color-gray-900);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Premium polish: subtle gradient accent for primary buttons + cards
   so admin chrome reads as elevated without leaning into noise. */
[data-theme="premium"] .btn-primary,
[data-theme="premium"] button[type="submit"]:not(.no-theme):not(.wc-btn) {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    /* This rule repainted the button green but left the label at the theme's
       near-black default (#0F172A), so every primary action in the admin -
       "Create New Booking", "Add New Staff", "Generate Report" - sat at 3.32:1.
       White on this gradient is 4.8:1 at the light end and 6.1:1 at the dark. */
    color: #FFFFFF;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 4px 12px var(--color-primary-shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
[data-theme="premium"] .btn-primary:hover,
[data-theme="premium"] button[type="submit"]:not(.no-theme):not(.wc-btn):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(15, 23, 42, 0.10), 0 8px 24px var(--color-primary-shadow-hover);
}

[data-theme="premium"] .card,
[data-theme="premium"] .panel,
[data-theme="premium"] .stat-card,
[data-theme="premium"] .dashboard-card {
    background: var(--surface-primary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
[data-theme="premium"] .card:hover,
[data-theme="premium"] .panel:hover,
[data-theme="premium"] .stat-card:hover,
[data-theme="premium"] .dashboard-card:hover {
    box-shadow: var(--shadow-md);
}

/* Sidebar/topbar glass effect to give the admin chrome a premium-modern look
   without changing any structural CSS. */
[data-theme="premium"] .admin-sidebar,
[data-theme="premium"] .admin-topbar,
[data-theme="premium"] aside[role="navigation"] {
    background: linear-gradient(180deg, var(--surface-primary) 0%, var(--surface-secondary) 100%);
    border-right: 1px solid var(--border-color);
    backdrop-filter: saturate(180%) blur(8px);
    -webkit-backdrop-filter: saturate(180%) blur(8px);
}

[data-theme="midnight"] .admin-sidebar,
[data-theme="midnight"] .admin-topbar,
[data-theme="midnight"] aside[role="navigation"] {
    background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
    border-right: 1px solid var(--border-color);
}

/* Force any leftover hard-coded Tailwind `bg-slate-100` body class to
   yield to the theme. Same for legacy bg-gray-50. Without this the
   premium theme leaves a slate strip behind the body container. */
body.bg-slate-100,
body.bg-gray-50,
body.bg-warm-50 {
    background-color: var(--surface-secondary) !important;
}

/* ==========================================================================
   6. Tailwind utility-class overrides for the premium + midnight themes.
   ==========================================================================
   413 admin templates hard-code Tailwind warm-* utility classes (bg-warm-50,
   bg-warm-100, text-warm-700, border-warm-200, etc) directly in markup.
   Without overrides those still render the legacy beige colors regardless
   of the chosen theme. Scope these rules to the non-warm themes so the
   warm preset stays untouched and the operator can opt back to the legacy
   look with one click. */

/* --- Premium: cool slate replaces warm tan throughout ------------------ */
[data-theme="premium"] .bg-warm-50    { background-color: var(--surface-secondary) !important; }  /* #F8FAFC */
[data-theme="premium"] .bg-warm-100   { background-color: var(--surface-tertiary)  !important; }  /* #F1F5F9 */
[data-theme="premium"] .bg-warm-200   { background-color: var(--color-gray-200)    !important; }  /* #E2E8F0 */
[data-theme="premium"] .bg-warm-900   { background-color: var(--color-gray-900)    !important; }  /* #0F172A - dark footer */
[data-theme="premium"] .bg-slate-100,
[data-theme="premium"] .bg-gray-100   { background-color: var(--surface-tertiary)  !important; }
[data-theme="premium"] .bg-slate-50,
[data-theme="premium"] .bg-gray-50    { background-color: var(--surface-secondary) !important; }

/* warm text tokens that were 3.31:1 contrast on white become 7-9:1 here.
   These are the "fonts not dark enough" pain points. */
[data-theme="premium"] .text-warm-400,
[data-theme="premium"] .text-warm-500,
[data-theme="premium"] .text-warm-600 { color: var(--color-gray-700) !important; }  /* #334155 ~ 11:1 */
[data-theme="premium"] .text-warm-700,
[data-theme="premium"] .text-warm-800,
[data-theme="premium"] .text-warm-900 { color: var(--color-gray-900) !important; }
[data-theme="premium"] .text-warm-100,
[data-theme="premium"] .text-warm-200,
[data-theme="premium"] .text-warm-300 { color: var(--color-gray-600) !important; }

[data-theme="premium"] .border-warm-100,
[data-theme="premium"] .border-warm-200 { border-color: var(--border-color) !important; }
[data-theme="premium"] .border-warm-300 { border-color: var(--border-color-btn) !important; }

/* --- Midnight: invert backgrounds, lighten text -------------------------- */
[data-theme="midnight"] .bg-warm-50    { background-color: var(--surface-secondary) !important; }
[data-theme="midnight"] .bg-warm-100   { background-color: var(--surface-tertiary)  !important; }
[data-theme="midnight"] .bg-warm-200   { background-color: var(--surface-primary)   !important; }
[data-theme="midnight"] .bg-warm-900   { background-color: #020617 !important; }
[data-theme="midnight"] .bg-white      { background-color: var(--surface-primary)   !important; }
[data-theme="midnight"] .bg-slate-100,
[data-theme="midnight"] .bg-gray-100,
[data-theme="midnight"] .bg-slate-50,
[data-theme="midnight"] .bg-gray-50    { background-color: var(--surface-secondary) !important; }

[data-theme="midnight"] .text-warm-300,
[data-theme="midnight"] .text-warm-400,
[data-theme="midnight"] .text-warm-500,
[data-theme="midnight"] .text-warm-600 { color: var(--color-gray-600) !important; }
[data-theme="midnight"] .text-warm-700,
[data-theme="midnight"] .text-warm-800,
[data-theme="midnight"] .text-warm-900,
[data-theme="midnight"] .text-gray-900,
[data-theme="midnight"] .text-slate-900 { color: var(--color-gray-900) !important; }
[data-theme="midnight"] .text-gray-700,
[data-theme="midnight"] .text-slate-700 { color: var(--color-gray-700) !important; }
[data-theme="midnight"] .text-gray-500,
[data-theme="midnight"] .text-gray-400,
[data-theme="midnight"] .text-slate-500 { color: var(--color-gray-500) !important; }

[data-theme="midnight"] .border-warm-100,
[data-theme="midnight"] .border-warm-200,
[data-theme="midnight"] .border-gray-200,
[data-theme="midnight"] .border-slate-200 { border-color: var(--border-color) !important; }

/* Status pills (success/warning/danger/info) on midnight need the lighter
   text token already defined in the theme block above, plus an explicit
   override on the pale Tailwind bg classes that the admin reuses. */
[data-theme="midnight"] .bg-green-50,
[data-theme="midnight"] .bg-emerald-50  { background-color: var(--color-success-bg) !important; }
[data-theme="midnight"] .text-green-700,
[data-theme="midnight"] .text-green-800,
[data-theme="midnight"] .text-emerald-700,
[data-theme="midnight"] .text-emerald-800 { color: var(--color-success-text) !important; }

[data-theme="midnight"] .bg-yellow-50,
[data-theme="midnight"] .bg-amber-50    { background-color: var(--color-warning-bg) !important; }
[data-theme="midnight"] .text-yellow-700,
[data-theme="midnight"] .text-yellow-800,
[data-theme="midnight"] .text-amber-700,
[data-theme="midnight"] .text-amber-800 { color: var(--color-warning-text) !important; }

[data-theme="midnight"] .bg-red-50      { background-color: var(--color-danger-bg) !important; }
[data-theme="midnight"] .text-red-700,
[data-theme="midnight"] .text-red-800   { color: var(--color-danger-text) !important; }

[data-theme="midnight"] .bg-blue-50     { background-color: var(--color-info-bg) !important; }
[data-theme="midnight"] .text-blue-700,
[data-theme="midnight"] .text-blue-800  { color: var(--color-info-text) !important; }

/* Inputs + selects need explicit theme treatment so form fields don't
   render with the default white-on-white on midnight or stay too washed
   out on premium. */
[data-theme="midnight"] input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
[data-theme="midnight"] select,
[data-theme="midnight"] textarea {
    background-color: var(--surface-primary);
    color: var(--color-gray-900);
    border-color: var(--border-color);
}
[data-theme="midnight"] input::placeholder,
[data-theme="midnight"] textarea::placeholder { color: var(--color-gray-500); }

[data-theme="premium"] input:focus,
[data-theme="premium"] select:focus,
[data-theme="premium"] textarea:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px var(--color-primary-glow) !important;
    outline: none;
}

/* ==========================================================================
   5. Theme switcher widget styles (rendered by admin-theme-switcher.php).
   ========================================================================== */
.theme-switcher {
    position: relative;
    display: inline-block;
}
.theme-switcher__button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-gray-700);
    background: var(--surface-primary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.theme-switcher__button:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: var(--shadow-xs);
}
.theme-switcher__menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 220px;
    padding: 0.4rem;
    background: var(--surface-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
}
.theme-switcher[data-open="true"] .theme-switcher__menu {
    display: block;
}
.theme-switcher__option {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.55rem 0.65rem;
    font-size: 0.85rem;
    color: var(--color-gray-800);
    background: transparent;
    border: 0;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease;
}
.theme-switcher__option:hover {
    background: var(--surface-tertiary);
}
.theme-switcher__option[aria-checked="true"] {
    background: var(--color-primary-light);
    color: var(--color-primary-active);
}
.theme-switcher__swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}
.theme-switcher__swatch--premium { background: linear-gradient(135deg, #ffffff 0%, #F1F5F9 50%, #5A7A5A 100%); }
.theme-switcher__swatch--warm    { background: linear-gradient(135deg, #FAFAF7 0%, #F5F0EB 50%, #5E7259 100%); }
.theme-switcher__swatch--midnight { background: linear-gradient(135deg, #1E293B 0%, #0F172A 50%, #34D399 100%); }
.theme-switcher__label-row {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}
.theme-switcher__label {
    font-weight: 600;
}
.theme-switcher__hint {
    font-size: 0.72rem;
    color: var(--color-gray-500);
}

/* ==========================================================================
   7. Wave-4 polish - search input, tile rhythm, button cohesion.
   ==========================================================================
   User audit feedback after PRs #102/#103/#105 landed:

   - Topbar search box still rendered cream-on-cream (`global-search-input`
     was styled for the legacy dark topbar with white text + white border).
     Premium has a light topbar, so the input was effectively invisible.
   - Today's Schedule + Revenue dashboard tiles had legacy `bg-warm-50` /
     `text-warm-500` interior rows that the wave-1 overrides matched, but
     the contrast between the white tile + warm-50 inner row was too flat.
   - Stat-trend pills (up/down delta indicators) and the small badge chips
     on bookings needed a premium-specific lift.
   - Buttons + icon buttons across the chrome lacked a unified hover state.
   ========================================================================== */

/* --- Global search input ------------------------------------------------- */
[data-theme="premium"] .global-search-input,
[data-theme="warm"]    .global-search-input {
    background-color: var(--surface-primary);
    border: 1px solid var(--border-color);
    color: var(--color-gray-900);
    box-shadow: var(--shadow-xs);
}
[data-theme="premium"] .global-search-input::placeholder,
[data-theme="warm"]    .global-search-input::placeholder {
    color: var(--color-gray-500);
}
[data-theme="premium"] .global-search-input:focus,
[data-theme="warm"]    .global-search-input:focus {
    background-color: var(--surface-primary);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}
[data-theme="premium"] .global-search-icon,
[data-theme="warm"]    .global-search-icon { color: var(--color-gray-500); }

[data-theme="premium"] .search-shortcut-hint,
[data-theme="warm"]    .search-shortcut-hint {
    background: var(--surface-tertiary);
    color: var(--color-gray-700);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

[data-theme="midnight"] .global-search-input {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: #f1f5f9;
}
[data-theme="midnight"] .global-search-input::placeholder { color: rgba(255, 255, 255, 0.55); }
[data-theme="midnight"] .global-search-input:focus {
    background-color: rgba(255, 255, 255, 0.10);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

/* --- Dashboard tile inner rows (bg-warm-50 booking rows etc) ------------ */
/* Wave-1 mapped bg-warm-50 -> surface-secondary (#F8FAFC) which on a white
   tile reads almost-the-same. Bump inside-of-card warm-50 to a slightly
   darker slate-tint so the inner item row visually separates from the
   white tile background. */
[data-theme="premium"] .bg-white .bg-warm-50,
[data-theme="premium"] [class*="bg-white"] .bg-warm-50 {
    background-color: #EEF2F7 !important;  /* slate-100/200 tint */
}
[data-theme="premium"] .bg-white .bg-warm-50:hover,
[data-theme="premium"] [class*="bg-white"] .bg-warm-50:hover {
    background-color: var(--color-primary-light) !important;
}

/* --- Stat trend pills (up/down delta indicators) ------------------------ */
[data-theme="premium"] .stat-trend,
[data-theme="premium"] .stat-trend-up,
[data-theme="premium"] .stat-trend-down,
[data-theme="premium"] .stat-trend-flat {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
[data-theme="premium"] .stat-trend-up   { background: #ECFDF5; color: #065F46; }
[data-theme="premium"] .stat-trend-down { background: #FEF2F2; color: #991B1B; }
[data-theme="premium"] .stat-trend-flat { background: var(--surface-tertiary); color: var(--color-gray-700); }

/* --- Unified icon button + nav link hover --------------------------------- */
[data-theme="premium"] button:not(.no-theme):not(.btn-primary):not(.theme-switcher__option),
[data-theme="premium"] .icon-btn,
[data-theme="premium"] a.action-link {
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
[data-theme="premium"] .navv2__nav-link:hover,
[data-theme="premium"] .navv2__sublink:hover {
    background-color: var(--color-primary-light) !important;
    color: var(--color-primary-active) !important;
}
[data-theme="premium"] .navv2__nav-link.active,
[data-theme="premium"] .navv2__sublink.active,
[data-theme="premium"] .navv2__nav-link[aria-current="page"] {
    background-color: var(--color-primary-light);
    color: var(--color-primary-active) !important;
    box-shadow: inset 3px 0 0 var(--color-primary);
}

/* --- Premium table styling (used on bookings, customers, staff, etc) ---- */
[data-theme="premium"] table th {
    background: var(--surface-tertiary);
    color: var(--color-gray-700);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}
[data-theme="premium"] table tbody tr {
    border-bottom: 1px solid var(--border-color-light);
    transition: background-color 0.12s ease;
}
[data-theme="premium"] table tbody tr:hover {
    background-color: var(--color-primary-glow);
}

/* --- Tile heading rhythm: better vertical alignment ---------------------- */
[data-theme="premium"] h1, [data-theme="premium"] h2, [data-theme="premium"] h3 {
    color: var(--color-gray-900);
    letter-spacing: -0.01em;
}
[data-theme="premium"] .rounded-2xl,
[data-theme="premium"] .rounded-xl {
    border-radius: 14px;
}

/* --- Status badge cohesion (used across booking rows) -------------------- */
[data-theme="premium"] .bg-sage-100 { background-color: #DCFCE7 !important; }
[data-theme="premium"] .text-sage-700 { color: #166534 !important; }
[data-theme="premium"] .bg-amber-100 { background-color: #FEF3C7 !important; }
[data-theme="premium"] .text-amber-700 { color: #92400E !important; }
[data-theme="premium"] .bg-rose-100, [data-theme="premium"] .bg-red-100 { background-color: #FEE2E2 !important; }
[data-theme="premium"] .text-rose-700, [data-theme="premium"] .text-red-700 { color: #991B1B !important; }
[data-theme="premium"] .bg-blue-100 { background-color: #DBEAFE !important; }
[data-theme="premium"] .text-blue-700 { color: #1E40AF !important; }

/* --- Premium glass topbar -------------------------------------------------- */
[data-theme="premium"] .admin-topbar,
[data-theme="premium"] header[role="banner"] {
    background: var(--surface-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
}

/* --- Focus visible across all interactive elements ----------------------- */
[data-theme="premium"] :focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ==========================================================================
   8. Wave-5 polish - inbox premium + theme-aware override of inline hex.
   ==========================================================================
   Inbox page hardcodes warm-tan hex values inline (#F5F0EB hover, #e8ebe3
   active row, etc) so the wave-1 token overrides don't reach them. These
   selectors win against page-level inline <style> because they include
   [data-theme] which is more specific. Operator pain point: 'inbox still
   beige even though everything else upgraded'.
   ========================================================================== */
[data-theme="premium"] .thread-row:hover {
    background: var(--color-primary-glow) !important;
}
[data-theme="premium"] .thread-row.active {
    background: var(--color-primary-light) !important;
    box-shadow: inset 3px 0 0 var(--color-primary);
}
[data-theme="premium"] .thread-row {
    border-bottom: 1px solid var(--border-color-light);
    transition: background-color 0.12s ease;
}
[data-theme="premium"] .filter-chip {
    background: var(--surface-tertiary);
    color: var(--color-gray-700);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.12s ease;
}
[data-theme="premium"] .filter-chip:hover:not(.active) {
    background: var(--color-primary-glow) !important;
    color: var(--color-primary-active);
    border-color: var(--color-primary);
}
[data-theme="premium"] .filter-chip.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
[data-theme="premium"] .inbox-left {
    background: var(--surface-primary);
    border-right: 1px solid var(--border-color);
}
[data-theme="premium"] .inbox-left__search {
    background: var(--surface-tertiary);
    border: 1px solid var(--border-color);
    color: var(--color-gray-900);
}
[data-theme="premium"] .inbox-left__search:focus {
    background: var(--surface-primary);
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}
[data-theme="premium"] .inbox-right {
    background: var(--surface-secondary);
}
[data-theme="premium"] .inbox-right__header {
    background: var(--surface-primary);
    border-bottom: 1px solid var(--border-color);
}
[data-theme="premium"] .thread-preview,
[data-theme="premium"] .thread-time { color: var(--color-gray-500); }
[data-theme="premium"] .thread-name { color: var(--color-gray-900); font-weight: 600; }
[data-theme="premium"] .unread-badge {
    background: var(--color-primary);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 1px 3px var(--color-primary-shadow);
}
[data-theme="premium"] .message-bubble,
[data-theme="premium"] .msg-bubble {
    border-radius: 14px;
    box-shadow: var(--shadow-xs);
}
[data-theme="premium"] .message-bubble.incoming,
[data-theme="premium"] .msg-bubble.incoming { background: var(--surface-primary); border: 1px solid var(--border-color); }
[data-theme="premium"] .message-bubble.outgoing,
[data-theme="premium"] .msg-bubble.outgoing {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    color: #fff;
}
[data-theme="premium"] .reply-box {
    background: var(--surface-primary);
    border-top: 1px solid var(--border-color);
}
[data-theme="premium"] .reply-box textarea {
    background: var(--surface-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--color-gray-900);
}
[data-theme="premium"] .reply-box textarea:focus {
    background: var(--surface-primary);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

/* Channel-source pill (SMS / Email / Phone) used in the new multi-channel
   inbox header. */
[data-theme="premium"] .channel-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
[data-theme="premium"] .channel-pill--sms   { background: #DBEAFE; color: #1E40AF; }
[data-theme="premium"] .channel-pill--email { background: #FCE7F3; color: #9D174D; }
[data-theme="premium"] .channel-pill--phone { background: #DCFCE7; color: #166534; }


/* ==========================================================================
   9. Tailwind arbitrary-value bg classes used as body backgrounds.
   ==========================================================================
   Most admin pages set their body class to one of:
       class="bg-[#FAFAF7] min-h-screen"
       class="bg-[#F5F0EB] min-h-screen"
   These are Tailwind v3 arbitrary-value classes that compile to a literal
   background-color: #FAFAF7 declaration. The .bg-warm-50 overrides from
   wave-1 don't catch them because the class name itself contains the
   escaped hex (.bg-\[#FAFAF7\]). Add explicit overrides so the premium
   theme's surface tokens win.
   ========================================================================== */
[data-theme="premium"] .bg-\[\#FAFAF7\],
[data-theme="premium"] .bg-\[\#FAFAFA\],
[data-theme="premium"] .bg-\[\#FBFBFB\] {
    background-color: var(--surface-secondary) !important;
}
[data-theme="premium"] .bg-\[\#F5F0EB\],
[data-theme="premium"] .bg-\[\#F5F5F5\] {
    background-color: var(--surface-tertiary) !important;
}
[data-theme="premium"] .bg-\[\#EDE5DB\],
[data-theme="premium"] .bg-\[\#E5E7EB\] {
    background-color: var(--color-gray-200) !important;
}
[data-theme="premium"] .bg-\[\#FFFFFF\],
[data-theme="premium"] .bg-\[\#ffffff\] {
    background-color: var(--surface-primary) !important;
}

[data-theme="midnight"] .bg-\[\#FAFAF7\],
[data-theme="midnight"] .bg-\[\#FAFAFA\],
[data-theme="midnight"] .bg-\[\#F5F0EB\] {
    background-color: var(--surface-secondary) !important;
}
[data-theme="midnight"] .bg-\[\#FFFFFF\],
[data-theme="midnight"] .bg-\[\#ffffff\] {
    background-color: var(--surface-primary) !important;
}


/* ==========================================================================
   10. Sidebar v2 (.navv2__*) - reskin per theme.
   ==========================================================================
   admin-sidebar-v2.php has 50+ hardcoded hex values in its inline <style>
   block (#FAFAF7 brand badge, #FCFBF7 column gradient, #F5F1E9 search-key
   bg, etc) so the rail visually drifts back to cream regardless of the
   selected theme. Adding high-specificity overrides for the navv2__ class
   tree so each theme owns the chrome look.
   ========================================================================== */

/* --- Premium ------------------------------------------------------------- */
[data-theme="premium"] .navv2__brand {
    background: var(--surface-primary) !important;
    box-shadow: 0 4px 12px -4px rgba(15,23,42,0.20), inset 0 1px 0 rgba(255,255,255,0.8);
}
[data-theme="premium"] .navv2__column,
[data-theme="premium"] .navv2__column-body,
[data-theme="premium"] .navv2__column-foot {
    background: linear-gradient(180deg, var(--surface-primary) 0%, var(--surface-secondary) 100%) !important;
    border-right: 1px solid var(--border-color);
}
[data-theme="premium"] .navv2__agenda-body,
[data-theme="premium"] .navv2__agenda-next,
[data-theme="premium"] .navv2__crew-card,
[data-theme="premium"] .navv2__chord-card {
    background: var(--surface-primary) !important;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
}
[data-theme="premium"] .navv2__agenda-stat,
[data-theme="premium"] .navv2__crew-status {
    background: var(--surface-tertiary) !important;
    color: var(--color-gray-700);
}
[data-theme="premium"] .navv2__crew-name,
[data-theme="premium"] .navv2__agenda-stat-num,
[data-theme="premium"] .navv2__agenda-date {
    color: var(--color-gray-900) !important;
}
[data-theme="premium"] .navv2__crew-meta,
[data-theme="premium"] .navv2__agenda-stat-label,
[data-theme="premium"] .navv2__agenda-next-meta,
[data-theme="premium"] .navv2__agenda-next-time {
    color: var(--color-gray-500) !important;
}

/* --- Midnight ------------------------------------------------------------ */
[data-theme="midnight"] .navv2__brand {
    background: var(--surface-tertiary) !important;
    box-shadow: 0 4px 12px -4px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.06);
}
[data-theme="midnight"] .navv2__column,
[data-theme="midnight"] .navv2__column-body,
[data-theme="midnight"] .navv2__column-foot {
    background: linear-gradient(180deg, var(--surface-tertiary) 0%, #0F172A 100%) !important;
    border-right: 1px solid var(--border-color);
}
[data-theme="midnight"] .navv2__agenda-body,
[data-theme="midnight"] .navv2__agenda-next,
[data-theme="midnight"] .navv2__crew-card,
[data-theme="midnight"] .navv2__chord-card {
    background: var(--surface-tertiary) !important;
    border: 1px solid var(--border-color);
}
[data-theme="midnight"] .navv2__agenda-stat,
[data-theme="midnight"] .navv2__crew-status {
    background: rgba(255,255,255,0.04) !important;
    color: var(--color-gray-700);
}
[data-theme="midnight"] .navv2__crew-name,
[data-theme="midnight"] .navv2__agenda-stat-num,
[data-theme="midnight"] .navv2__agenda-date {
    color: var(--color-gray-900) !important;
}

/* --- Search modal (inline JS-styled) won't reskin via CSS class because
   the JS writes inline style attrs. Override by attribute selector so the
   inline style is replaced at runtime. */
[data-theme="premium"] #wcSearchModal > div {
    background: var(--surface-primary) !important;
    box-shadow: var(--shadow-xl) !important;
}
[data-theme="premium"] #wcSearchModal kbd {
    background: var(--surface-tertiary) !important;
    border-color: var(--border-color) !important;
    color: var(--color-gray-700) !important;
}
[data-theme="midnight"] #wcSearchModal > div {
    background: var(--surface-primary) !important;
}
[data-theme="midnight"] #wcSearchModal kbd {
    background: rgba(255,255,255,0.06) !important;
    border-color: rgba(255,255,255,0.10) !important;
    color: var(--color-gray-700) !important;
}


/* ===================================================================
 * ADMIN PORTAL: cream -> white background override
 * ===================================================================
 *
 * Operator feedback: "everything is to cream" -- the warm-50 (#FAFAF7)
 * canvas dominates the admin portal and washes out content. Force the
 * page + section backgrounds to pure white so cards, tables, and form
 * surfaces read cleanly. Borders + section dividers stay warm so the
 * brand still feels Wasatch.
 *
 * Loaded LAST in admin/css/themes.css so it wins the cascade.
 * Public site, customer portal, and book.php are NOT affected -- this
 * file is only loaded by admin pages via getAdminNavLinks() chrome.
 * =================================================================== */

body.bg-warm-50,
body[class*="bg-warm-50"],
.admin-shell body,
body.admin-portal {
    background-color: #FFFFFF !important;
}

/* Tailwind utility overrides that paint cream backgrounds on admin pages. */
.bg-warm-50  { background-color: #FFFFFF !important; }
.bg-warm-100 { background-color: #FAFAFA !important; }  /* very subtle gray for hover/active strips */

/* Section bands previously alternating white <-> warm-50 collapse to
 * white <-> #FAFAFA so the rhythm survives without the cream cast. */
section.bg-warm-50 { background-color: #FFFFFF !important; }
main.bg-warm-50    { background-color: #FFFFFF !important; }

/* Keep the warm border tokens -- they read fine on white + maintain
 * the Wasatch ink palette. */
.border-warm-100 { border-color: #F1EEEA !important; }
.border-warm-200 { border-color: #E8E3DC !important; }

/* [lnum] 12 Oct 2026: lining figures everywhere in the admin (the serif defaulted to old-style, so 0.0 read as o.o) */
body { font-variant-numeric: lining-nums; }
