/* ============================================================
   EasyFile Design Tokens
   Version: 1.0
   
   Import this file FIRST in your application.
   All values use the --ef- prefix for namespacing.
   
   Usage:
     <link rel="stylesheet" href="design-tokens.css">
     <link rel="stylesheet" href="components.css">
   
   Theme control (set on <html> element):
     data-theme="light|dark"       — content area theme
     data-nav="light|soft|slate|dark"  — navigation theme
   ============================================================ */

/* ── GLOBAL TOKENS (theme-independent) ─────────────────────── */

:root {
  /* Typography */
  --ef-font: 'Inter', ui-sans-serif, system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  --ef-text-24: 24px;
  --ef-text-18: 18px;
  --ef-text-14: 14px;
  --ef-text-13: 13px;
  --ef-text-12: 12px;
  --ef-text-11: 11px;

  /* Spacing */
  --ef-space-4:  4px;
  --ef-space-8:  8px;
  --ef-space-12: 12px;
  --ef-space-16: 16px;
  --ef-space-24: 24px;
  --ef-space-32: 32px;

  /* Border Radius */
  --ef-radius-4:  4px;
  --ef-radius-6:  6px;
  --ef-radius-10: 10px;
  --ef-radius-14: 14px;

  /* Elevation */
  --ef-shadow-1: 0 1px 3px rgba(0, 0, 0, 0.06),
                 0 1px 2px rgba(0, 0, 0, 0.04);
  --ef-shadow-2: 0 4px 12px rgba(0, 0, 0, 0.1),
                 0 2px 4px rgba(0, 0, 0, 0.06);

  /* Primary */
  --ef-color-primary:       #2563eb;
  --ef-color-primary-hover:  #1d4ed8;
  --ef-color-primary-bg:    rgba(37, 99, 235, 0.08);
  --ef-color-primary-light: rgba(37, 99, 235, 0.25);
  --ef-color-focus:         rgba(37, 99, 235, 0.4);

  /* Danger */
  --ef-color-danger:        #dc2626;
  --ef-color-danger-hover:  #b91c1c;

  /* Semantic: Green (success, active) */
  --ef-green:      #16a34a;
  --ef-green-bg:   rgba(22, 163, 74, 0.08);
  --ef-green-text: #15803d;

  /* Semantic: Yellow (warning, pending) */
  --ef-yellow:      #d97706;
  --ef-yellow-bg:   rgba(217, 119, 6, 0.08);
  --ef-yellow-text: #b45309;

  /* Semantic: Red (error, overdue) */
  --ef-red:      #dc2626;
  --ef-red-bg:   rgba(220, 38, 38, 0.08);
  --ef-red-text: #b91c1c;

  /* Semantic: Blue (info, in-progress) */
  --ef-blue:      #2563eb;
  --ef-blue-bg:   rgba(37, 99, 235, 0.08);
  --ef-blue-text: #1d4ed8;

  /* Scale steps and aliases that stylesheets and components referenced before they existed. Each one resolved to
     nothing (the declaration was dropped) or to a hard-coded fallback that ignored the theme. They map onto the
     values above (the two borders are the existing yellow and red hues at 35%), and UndefinedCssTokenTests now fails
     on any --ef-* use with no definition. */
  --ef-text-15: 15px;
  --ef-text-16: 16px;
  --ef-text-20: 20px;
  --ef-space-2:  2px;
  --ef-space-6:  6px;
  --ef-radius-8: 8px;
  --ef-shadow-3: 0 4px 12px rgba(0, 0, 0, 0.2);
  --ef-shadow-4: 0 8px 24px rgba(0, 0, 0, 0.28);
  --ef-font-mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  --ef-motion-fast: 120ms;
  --ef-primary: var(--ef-color-primary);
  --ef-accent:  var(--ef-color-primary);
  --ef-danger:  var(--ef-color-danger);
  --ef-warning: var(--ef-yellow-text);
  --ef-color-warn-text: var(--ef-yellow-text);
  --ef-amber:        var(--ef-yellow);
  --ef-amber-bg:     var(--ef-yellow-bg);
  --ef-amber-border: rgba(217, 119, 6, 0.35);   /* --ef-yellow at 35% */
  --ef-red-border:   rgba(220, 38, 38, 0.35);   /* --ef-red at 35% */
  --ef-semantic-error:   var(--ef-red);
  --ef-semantic-success: var(--ef-green);
  --ef-semantic-warning: var(--ef-yellow);
}


/* ── CONTENT THEME: LIGHT (default) ───────────────────────── */

[data-theme="light"] {
  --ef-bg:         #f8f9fb;
  --ef-surface:    #ffffff;
  --ef-surface-2:  #f1f3f5;
  --ef-text:       #1e293b;
  /* WAS #64748b, which measured 4.28:1 against --ef-surface-2 — just under the 4.5:1 WCAG AA floor for normal
     text. That is the single most-used text/background pair in the app: EVERY table header and every grey badge
     sits on surface-2, so one failing pair meant a real readability miss on all 17 admin screens at once (found
     by measuring the rendered pages, not by reading CSS).
     #5b6779 is the same slate hue one step darker: 5.16:1 on surface-2 and 5.74:1 on white, so it clears AA on
     both grounds it actually lands on while keeping the muted look. Dark mode's #94a3b8 already measures 5.71:1
     on its own surface-2 and is left alone. */
  --ef-text-muted: #5b6779;
  --ef-border:     #e2e8f0;
  /* Theme-dependent aliases (see the global aliases above). */
  --ef-surface-alt:   var(--ef-bg);
  --ef-text-secondary: var(--ef-text-muted);
}


/* ── CONTENT THEME: DARK ──────────────────────────────────── */

[data-theme="dark"] {
  --ef-bg:         #0f172a;
  --ef-surface:    #1e293b;
  --ef-surface-2:  #253249;
  --ef-text:       #e2e8f0;
  --ef-text-muted: #94a3b8;
  --ef-border:     #334155;
  --ef-surface-alt:   var(--ef-bg);
  --ef-text-secondary: var(--ef-text-muted);
}


/* ── NAV THEME: LIGHT (LOB style — white/light gray) ──────── */

[data-nav="light"] {
  --nav-bg:        #ffffff;
  --nav-bg-2:      #f8f9fb;
  --nav-text:      #64748b;
  --nav-text-active: #1e293b;
  --nav-hover:     rgba(0, 0, 0, 0.04);
  --nav-active-bg: var(--ef-color-primary-bg);
  --nav-active-text: var(--ef-color-primary);
  --nav-accent:    var(--ef-color-primary);
  --nav-divider:   #e2e8f0;
  --nav-border:    #e2e8f0;
  --nav-brand:     #1e293b;
  --nav-env-bg:    var(--ef-green-bg);
  --nav-env-text:  var(--ef-green-text);
  --header-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}


/* ── NAV THEME: SOFT (muted blue-gray) ────────────────────── */

[data-nav="soft"] {
  --nav-bg:        #f0f4f8;
  --nav-bg-2:      #e8edf2;
  --nav-text:      #506477;
  --nav-text-active: #1a3352;
  --nav-hover:     rgba(0, 0, 0, 0.05);
  --nav-active-bg: rgba(37, 99, 235, 0.1);
  --nav-active-text: #1d4ed8;
  --nav-accent:    #2563eb;
  --nav-divider:   #d5dde6;
  --nav-border:    #d5dde6;
  --nav-brand:     #1a3352;
  --nav-env-bg:    var(--ef-green-bg);
  --nav-env-text:  var(--ef-green-text);
  --header-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}


/* ── NAV THEME: SLATE (medium dark) ───────────────────────── */

[data-nav="slate"] {
  --nav-bg:        #1e293b;
  --nav-bg-2:      #263448;
  --nav-text:      #94a3b8;
  --nav-text-active: #f1f5f9;
  --nav-hover:     rgba(255, 255, 255, 0.06);
  --nav-active-bg: rgba(96, 165, 250, 0.15);
  --nav-active-text: #93c5fd;
  --nav-accent:    #60a5fa;
  --nav-divider:   rgba(255, 255, 255, 0.08);
  --nav-border:    rgba(255, 255, 255, 0.08);
  --nav-brand:     #f1f5f9;
  --nav-env-bg:    rgba(74, 222, 128, 0.15);
  --nav-env-text:  #4ade80;
  --header-shadow: none;
}


/* ── NAV THEME: DARK (deep navy) ──────────────────────────── */

[data-nav="dark"] {
  --nav-bg:        #0f172a;
  --nav-bg-2:      #162033;
  --nav-text:      #7b8ba5;
  --nav-text-active: #f1f5f9;
  --nav-hover:     rgba(255, 255, 255, 0.06);
  --nav-active-bg: rgba(96, 165, 250, 0.15);
  --nav-active-text: #93c5fd;
  --nav-accent:    #60a5fa;
  --nav-divider:   rgba(255, 255, 255, 0.06);
  --nav-border:    rgba(255, 255, 255, 0.06);
  --nav-brand:     #f1f5f9;
  --nav-env-bg:    rgba(74, 222, 128, 0.15);
  --nav-env-text:  #4ade80;
  --header-shadow: none;
}
