/**
 * LabPulse Design Tokens
 * -----------------------------------------------------------------
 * Single source of truth for color, spacing, radius, shadow and
 * typography so every component file stays consistent and themeable.
 *
 * Phase 2 (Web Color & Visual Design Foundation): the brand scale
 * below was repainted from the original Step-1 red into a Dr. Yanga's
 * Colleges navy, and a new gold --accent-* scale + a dedicated
 * --danger-* scale were added (danger was previously borrowed from
 * the brand-red scale by coincidence - now decoupled so "primary"
 * and "destructive" never have to be the same hue again). Every
 * component file already reads colors exclusively through these
 * custom properties (see components.css/layout.css/base.css), so
 * this file is the ONLY place the rebrand needed to happen - no
 * component rule changed shape, only the token values underneath
 * them did. A small set of --color-* semantic aliases were added at
 * the bottom per the Phase 2 spec's naming suggestion; they are pure
 * aliases onto the tokens above (nothing in the project reads them
 * yet) so existing component code keeps using the original,
 * already-proven names.
 * -----------------------------------------------------------------
 */
:root {
    /* Brand navy scale - Dr. Yanga's Colleges primary color. Filled
       buttons, the active sidebar link, the brand mark and the avatar
       all use --primary-500/600 with white text on top - deliberately
       identical in both themes (see the dark-theme block's comment)
       since navy-with-white-text reads correctly on either page
       theme without adjustment. */
    --primary-50:  #eaf0fb;
    --primary-100: #cedbf2;
    --primary-200: #a3bce3;
    --primary-300: #7495ce;
    --primary-400: #4a6cb3;
    --primary-500: #1e3a70; /* base Dr. Yanga navy */
    --primary-600: #172d59;
    --primary-700: #112143;
    --primary-800: #0a1630;
    --primary-900: #060d1c;

    /* Accent gold scale - Dr. Yanga's Colleges gold, used selectively
       (notification dot, the new .btn-accent primitive, small
       highlight moments) rather than as a second primary color. */
    --accent-50:  #fbf2d9;
    --accent-100: #f5e0ac;
    --accent-200: #edc873;
    --accent-300: #e2ae45;
    --accent-400: #d29a1e;
    --accent-500: #b8860b; /* base Dr. Yanga gold */
    --accent-600: #966d09;
    --accent-700: #745507;
    --accent-800: #523c05;
    --accent-900: #302303;

    /* Danger scale - decoupled from --primary-* now that primary is
       navy, not red. Same values the old brand-red scale used, kept
       exactly so every existing destructive-action affordance
       (.btn-danger, .alert-danger, delete/remove confirmations) stays
       visually identical to before this rebrand. */
    --danger-50:  #fdecee;
    --danger-100: #fad0d4;
    --danger-200: #f2a3aa;
    --danger-300: #e8757f;
    --danger-400: #dc4652;
    --danger-500: #c8102e;
    --danger-600: #a50d26;
    --danger-700: #820a1e;
    --danger-800: #5e0716;
    --danger-900: #3b040e;

    /* Neutral scale - a cool, faintly blue-tinted gray (not a pure
       desaturated gray) so borders/muted text/the sidebar all quietly
       reinforce the navy identity without ever reading as "blue
       everywhere." Lightness steps intentionally match the previous
       scale's, so contrast against text/surfaces is unchanged. */
    --neutral-0:   #ffffff;
    --neutral-50:  #f5f7fb;
    --neutral-100: #eaeef5;
    --neutral-200: #dbe1eb;
    --neutral-300: #c2cad9;
    --neutral-400: #97a2b8;
    --neutral-500: #6b7690;
    --neutral-600: #4f5972;
    --neutral-700: #363e54;
    --neutral-800: #232a3d;
    --neutral-900: #151a29;

    /* Semantic status colors (kept distinct from brand navy/gold).
       Available/In Use/Idle/Offline/Disabled/Maintenance are
       unchanged from the original palette (already accessible and
       already distinct from one another - Phase 2 only needed to add
       Locked, not touch the other six). Locked uses a teal that
       shares no hue family with any of the other six, so it can never
       visually collapse into Offline (gray) or Disabled (red) again -
       see components.css's new .badge-locked. */
    --status-available-fg: #157347;
    --status-available-bg: #e3f6ec;
    --status-inuse-fg:     #1755b3;
    --status-inuse-bg:     #e6effe;
    --status-idle-fg:      #8a5900; /* Phase 9B Step 79: AA on its badge (was #9a6400) */
    --status-idle-bg:      #fdf1d9;
    --status-offline-fg:   #565c66;
    --status-offline-bg:   #eceef0;
    --status-disabled-fg:  #9a3b42;
    --status-disabled-bg:  #fbe9ea;
    --status-maintenance-fg: #6e4aa6;
    --status-maintenance-bg: #f1ebfa;
    --status-locked-fg:    #0f6e6e;
    --status-locked-bg:    #e1f4f4;
    /* PENDING (e.g. a computer awaiting Admin approval, a backup still
       running) - indigo, distinct from every other status hue here
       (blue/green/amber/gray/red/purple/teal) so it can never be
       mistaken for Maintenance (purple) or In Use (blue). */
    --status-pending-fg:   #4f46a3;
    --status-pending-bg:   #ecebf9;

    /* Surface / text roles */
    --surface-page:    var(--neutral-50);
    --surface-card:    var(--neutral-0);
    --surface-sidebar: var(--neutral-900);
    --surface-topbar:  var(--neutral-0);
    --surface-hover:   var(--neutral-100);
    --surface-subtle:  var(--neutral-50);
    --surface-2:       var(--surface-subtle);
    --border-subtle:   var(--neutral-200);

    /* v1.0.1: the sidebar used to be permanently dark navy regardless
       of the active page theme (--surface-sidebar above, "deliberately
       identical in both themes" per the Phase 2 rationale) - reported
       as a real Light Mode bug ("sidebar remains visually dark") and
       now made theme-reactive via this dedicated token set, semantic
       naming per this pass's own suggestion. Light Mode: a clean white
       sidebar with a right border to separate it from content (same
       role --surface-topbar/--border-subtle already play elsewhere in
       Light Mode) - Dr. Yanga identity carried by the gold active-item
       accent, not by a permanently-dark panel. Dark Mode below
       restores the exact original always-was-dark navy look
       unchanged - nothing about Dark Mode's sidebar appearance changes. */
    --sidebar-bg:           var(--neutral-0);
    --sidebar-border:       var(--border-subtle);
    --sidebar-text:         var(--text-primary);
    --sidebar-text-muted:   var(--text-secondary);
    --sidebar-icon:         var(--text-secondary);
    --sidebar-hover-bg:     var(--surface-hover);
    --sidebar-hover-text:   var(--text-primary);
    --sidebar-active-bg:    rgba(184, 134, 11, 0.10);
    --sidebar-active-text:  var(--text-primary);
    --sidebar-active-icon:  var(--accent-600);
    --sidebar-tag-bg:       var(--neutral-100);
    --sidebar-tag-text:     var(--text-secondary);
    --sidebar-divider:      var(--border-subtle);
    --sidebar-overlay-bg:   rgba(15, 17, 20, 0.5);
    --text-primary:    var(--neutral-900);
    /* Phase 9B Step 79: darker than --neutral-500/400 so secondary / muted text meets WCAG AA (>= 4.5:1) on every light surface. */
    --text-secondary:  #5b6680;
    --text-muted:      #5f6a84;
    --text-inverse:    var(--neutral-0);
    /* Accent used as a foreground color directly on a page/card surface
       (links, the stat-card icon glyph) - navy in light mode, a
       brighter navy-blue in dark mode for legibility (see the
       dark-theme block). Kept separate from --primary-500/600 (the
       FILLED button/badge/sidebar colors) for the same reason as
       before: a text-sized color and a fill-sized color don't always
       want the exact same shade. Danger text now has its own token
       (--danger-text) instead of sharing this one. */
    --accent-text:      var(--primary-600);
    --danger-text:      var(--danger-600);
    --focus-ring:       0 0 0 3px rgba(30, 58, 112, 0.28);
    --scrollbar-thumb:  var(--neutral-300);
    color-scheme: light;

    /* Typography */
    --font-sans: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;

    /* Spacing scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-pill: 999px;

    /* Shadow */
    --shadow-sm: 0 1px 2px rgba(16, 18, 21, 0.06);
    --shadow-md: 0 4px 14px rgba(16, 18, 21, 0.08);
    --shadow-lg: 0 12px 32px rgba(16, 18, 21, 0.12);

    /* Layout */
    --sidebar-width: 264px;
    --sidebar-width-collapsed: 76px;
    --topbar-height: 64px;
    --transition-fast: 150ms ease;
    --transition-base: 220ms ease;
}

/**
 * Dark theme
 * -----------------------------------------------------------------
 * Only the tokens above that name a *role* (surface/text/border/
 * shadow/status color) are redefined here - never the raw
 * --neutral-* / --primary-* / --accent-* / --danger-* scales themselves,
 * and never --primary-500/--primary-600 (every filled button/badge/
 * sidebar-active background, always paired with white text on top -
 * correct against either page theme, so it never needs to change).
 * Surfaces/text below keep the same cool navy undertone as the light
 * scale, just inverted to dark - "dark navy/charcoal" for the page,
 * a slightly lighter navy/charcoal for cards, per the Phase 2 spec.
 *
 * Two selectors carry the same value block on purpose (see
 * includes/layout/theme-init.php for how data-theme is applied
 * before first paint, and assets/js/modules/theme.js for the toggle).
 * ----------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --surface-page:    #10141f;
        --surface-card:    #181d2c;
        --surface-sidebar: #0a0d16;
        --surface-topbar:  #181d2c;
        --surface-hover:   #212739;
        --surface-subtle:  #1c2130;
        --surface-2:       var(--surface-subtle);
        --border-subtle:   #2b3247;
        --text-primary:    #e9ecf5;
        --text-secondary:  #a3aec4;
        --text-muted:      #8a94ad; /* Phase 9B Step 79: AA on dark cards (was #767f98) */
        --text-inverse:    #10141f;

        --accent-text: #8fb0e8;
        --danger-text: #ff5c6c;

        /* Pale-tint auxiliary stops only (backgrounds/borders/selection
           built from a soft wash of the brand navy) - never
           --primary-500/600 themselves. A dark theme's "soft wash" is
           a translucent tint over a dark surface rather than a pastel
           over white. */
        --primary-50:  rgba(74, 108, 179, 0.14);
        --primary-100: rgba(74, 108, 179, 0.22);
        --primary-200: rgba(74, 108, 179, 0.38);
        --primary-700: #8fb0e8;
        --primary-800: #d3e2fa;

        /* Same treatment for the gold accent scale's pale stops. */
        --accent-50:  rgba(226, 174, 69, 0.14);
        --accent-100: rgba(226, 174, 69, 0.22);
        --accent-200: rgba(226, 174, 69, 0.38);
        --accent-700: #e2ae45;
        --accent-800: #f5e0ac;

        --danger-50:  rgba(255, 90, 110, 0.12);
        --danger-100: rgba(255, 90, 110, 0.20);
        --danger-200: rgba(255, 90, 110, 0.36);
        --danger-700: #ff8a93;
        --danger-800: #ffd7da;

        --status-available-fg:   #3ddc84;
        --status-available-bg:   rgba(61, 220, 132, 0.16);
        --status-inuse-fg:       #8fbcff; /* Phase 9B Step 79: AA on dark surfaces (was #5b9bff) */
        --status-inuse-bg:       rgba(91, 155, 255, 0.16);
        --status-idle-fg:        #e8b13d;
        --status-idle-bg:        rgba(232, 177, 61, 0.16);
        --status-offline-fg:     #a3aec4;
        --status-offline-bg:     rgba(163, 174, 196, 0.16);
        --status-disabled-fg:    #ff6b73;
        --status-disabled-bg:    rgba(255, 107, 115, 0.16);
        --status-maintenance-fg: #b28aef;
        --status-maintenance-bg: rgba(178, 138, 239, 0.16);
        --status-locked-fg:      #4dd4d4;
        --status-locked-bg:      rgba(77, 212, 212, 0.16);
        --status-pending-fg:     #a5a0f5;
        --status-pending-bg:     rgba(165, 160, 245, 0.16);

        --focus-ring: 0 0 0 3px rgba(122, 162, 232, 0.42);
        --scrollbar-thumb: #3a4155;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.32);
        --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.40);
        --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.50);

        /* Sidebar: the exact original always-dark-navy look, unchanged -
           see the base :root block's comment for why this now needs to
           be restated per-theme instead of being theme-invariant. */
        --sidebar-bg:           #0a0d16;
        --sidebar-border:       rgba(255, 255, 255, 0.08);
        --sidebar-text:         var(--neutral-300);
        --sidebar-text-muted:   #8a94ad; /* Phase 9B Step 79: AA on the navy sidebar */
        --sidebar-icon:         var(--neutral-300);
        --sidebar-hover-bg:     rgba(255, 255, 255, 0.06);
        --sidebar-hover-text:   var(--neutral-0);
        --sidebar-active-bg:    rgba(184, 134, 11, 0.16);
        --sidebar-active-text:  var(--neutral-0);
        --sidebar-active-icon:  var(--accent-400);
        --sidebar-tag-bg:       rgba(255, 255, 255, 0.1);
        --sidebar-tag-text:     var(--neutral-300);
        --sidebar-divider:      rgba(255, 255, 255, 0.08);
        --sidebar-overlay-bg:   rgba(15, 17, 20, 0.5);

        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --surface-page:    #10141f;
    --surface-card:    #181d2c;
    --surface-sidebar: #0a0d16;
    --surface-topbar:  #181d2c;
    --surface-hover:   #212739;
    --surface-subtle:  #1c2130;
    --surface-2:       var(--surface-subtle);
    --border-subtle:   #2b3247;
    --text-primary:    #e9ecf5;
    --text-secondary:  #a3aec4;
    --text-muted:      #8a94ad; /* Phase 9B Step 79: AA on dark cards (was #767f98) */
    --text-inverse:    #10141f;

    --accent-text: #8fb0e8;
    --danger-text: #ff5c6c;

    --primary-50:  rgba(74, 108, 179, 0.14);
    --primary-100: rgba(74, 108, 179, 0.22);
    --primary-200: rgba(74, 108, 179, 0.38);
    --primary-700: #8fb0e8;
    --primary-800: #d3e2fa;

    --accent-50:  rgba(226, 174, 69, 0.14);
    --accent-100: rgba(226, 174, 69, 0.22);
    --accent-200: rgba(226, 174, 69, 0.38);
    --accent-700: #e2ae45;
    --accent-800: #f5e0ac;

    --danger-50:  rgba(255, 90, 110, 0.12);
    --danger-100: rgba(255, 90, 110, 0.20);
    --danger-200: rgba(255, 90, 110, 0.36);
    --danger-700: #ff8a93;
    --danger-800: #ffd7da;

    --status-available-fg:   #3ddc84;
    --status-available-bg:   rgba(61, 220, 132, 0.16);
    --status-inuse-fg:       #8fbcff; /* Phase 9B Step 79: AA on dark surfaces (was #5b9bff) */
    --status-inuse-bg:       rgba(91, 155, 255, 0.16);
    --status-idle-fg:        #e8b13d;
    --status-idle-bg:        rgba(232, 177, 61, 0.16);
    --status-offline-fg:     #a3aec4;
    --status-offline-bg:     rgba(163, 174, 196, 0.16);
    --status-disabled-fg:    #ff6b73;
    --status-disabled-bg:    rgba(255, 107, 115, 0.16);
    --status-maintenance-fg: #b28aef;
    --status-maintenance-bg: rgba(178, 138, 239, 0.16);
    --status-locked-fg:      #4dd4d4;
    --status-locked-bg:      rgba(77, 212, 212, 0.16);
    --status-pending-fg:     #a5a0f5;
    --status-pending-bg:     rgba(165, 160, 245, 0.16);

    --focus-ring: 0 0 0 3px rgba(122, 162, 232, 0.42);
    --scrollbar-thumb: #3a4155;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.32);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.40);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.50);

    --sidebar-bg:           #0a0d16;
    --sidebar-border:       rgba(255, 255, 255, 0.08);
    --sidebar-text:         var(--neutral-300);
    --sidebar-text-muted:   #8a94ad; /* Phase 9B Step 79: AA on the navy sidebar */
    --sidebar-icon:         var(--neutral-300);
    --sidebar-hover-bg:     rgba(255, 255, 255, 0.06);
    --sidebar-hover-text:   var(--neutral-0);
    --sidebar-active-bg:    rgba(184, 134, 11, 0.16);
    --sidebar-active-text:  var(--neutral-0);
    --sidebar-active-icon:  var(--accent-400);
    --sidebar-tag-bg:       rgba(255, 255, 255, 0.1);
    --sidebar-tag-text:     var(--neutral-300);
    --sidebar-divider:      rgba(255, 255, 255, 0.08);
    --sidebar-overlay-bg:   rgba(15, 17, 20, 0.5);

    color-scheme: dark;
}

/* An explicit Light choice must win over a dark OS setting too - the
   @media block above already guards itself with :not([data-theme="light"]),
   so nothing extra is needed here; this rule only exists so the intent
   reads clearly and to set color-scheme back for the explicit case. */
:root[data-theme="light"] {
    color-scheme: light;
}

/**
 * Semantic aliases (Phase 2 spec naming) - pure aliases onto the
 * tokens above. Nothing in the project reads these yet; they exist so
 * the naming convention requested for this phase is available for
 * future component work without renaming (and re-testing) every
 * existing rule that already reads --primary-500/--surface-card/etc.
 * "Elevated" surfaces (modals, dropdown panels) already share the
 * base card color today, differentiated only by shadow depth
 * (--shadow-lg vs --shadow-sm) - --color-surface-elevated reflects
 * that as-is rather than inventing a new, untested surface color.
 */
:root {
    --color-primary:          var(--primary-500);
    --color-primary-hover:    var(--primary-600);
    --color-accent:           var(--accent-500);
    --color-accent-hover:     var(--accent-600);
    --color-background:       var(--surface-page);
    --color-surface:          var(--surface-card);
    --color-surface-elevated: var(--surface-card);
    --color-border:           var(--border-subtle);
    --color-text:             var(--text-primary);
    --color-text-muted:       var(--text-secondary);
    --color-success:          var(--status-available-fg);
    --color-warning:          var(--status-idle-fg);
    --color-danger:           var(--danger-600);
    --color-info:             var(--status-inuse-fg);

    /* Named brand aliases (full UI/UX overhaul spec's own naming) -
       same underlying navy/gold scale as --primary-* / --accent-* above,
       just under the names that spec asked for. */
    --brand-navy:       var(--primary-500);
    --brand-navy-dark:  var(--primary-600);
    --brand-navy-light: var(--primary-300);
    --brand-gold:       var(--accent-500);
    --brand-gold-dark:  var(--accent-600);
    --brand-gold-light: var(--accent-300);
}

/**
 * Motion tokens - shared durations/easing for the small entrance/hover/
 * status-change animation system (components.css). Kept here so every
 * animated rule reads the SAME duration instead of scattering literal
 * "200ms" values - one place to retune the whole app's motion feel.
 * See base.css's `prefers-reduced-motion` block for how every one of
 * these is neutralized site-wide when the visitor has that OS setting.
 */
:root {
    --motion-fast: 150ms;
    --motion-base: 220ms;
    --motion-slow: 320ms;
    --motion-ease: cubic-bezier(0.2, 0.65, 0.3, 1);
}
