/* =====================================================================
   Design Tokens — TA Network AI Admin Portal
   Linear / Vercel-inspired SaaS system. Single source of truth for
   colour, type, radius, elevation and motion. Consumed by admin.css and
   every staff-* component, so theming happens here and nowhere else.

   Themes are switched by data-theme on <html> ("light" | "dark").
   The anti-FOUC script in _Layout sets it before first paint.
   ===================================================================== */

/* ── Type ─────────────────────────────────────────────────────────── */
:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono",
    Menlo, Consolas, monospace;

  /* display face for headings, brand marks & page titles */
  --font-display: "Plus Jakarta Sans", "Inter", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* fluid-ish type scale */
  --text-xs: 0.75rem;    /* 12 */
  --text-sm: 0.8125rem;  /* 13 */
  --text-base: 0.875rem; /* 14 */
  --text-md: 0.9375rem;  /* 15 */
  --text-lg: 1.0625rem;  /* 17 */
  --text-xl: 1.25rem;    /* 20 */
  --text-2xl: 1.5rem;    /* 24 */
  --text-3xl: 1.875rem;  /* 30 */

  --fw-regular: 450;
  --fw-medium: 530;
  --fw-semibold: 600;
  --fw-bold: 680;

  /* ── Radius ─────────────────────────────────────────────────────── */
  --radius-xs: 5px;
  --radius-sm: 7px;
  --radius: 9px;
  --radius-md: 11px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-pill: 999px;

  /* ── Spacing (4/8 rhythm) ───────────────────────────────────────── */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;

  /* ── Motion ─────────────────────────────────────────────────────── */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 120ms;
  --dur: 170ms;
  --dur-slow: 260ms;

  /* fixed brand accents used by charts / status (theme-independent hues) */
  --accent-indigo: #6366f1;
  --accent-violet: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-sky: #0ea5e9;
}

/* ── Light theme (default) ────────────────────────────────────────── */
:root,
:root[data-theme="light"] {
  color-scheme: light;

  /* app surfaces */
  --bg: #ffffff;          /* content area — white */
  --bg-subtle: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f4f5f7;   /* insets, hover fills */
  --surface-3: #eceef1;   /* pressed / stronger inset */

  /* borders — a touch stronger so white cards read on a white page */
  --border: #e4e6ea;
  --border-strong: #d3d6db;
  --border-subtle: #eef0f3;

  /* text */
  --text: #1a1d21;
  --text-muted: #5b616b;
  --text-subtle: #8a909a;
  --text-on-primary: #ffffff;

  /* primary (indigo/violet) */
  --primary: #5b5ef0;
  --primary-hover: #4a4de0;
  --primary-active: #4144cc;
  --primary-soft: #eef0fe;
  --primary-soft-fg: #4a4de0;
  --ring: rgba(91, 94, 240, 0.35);

  /* semantic */
  --success: #16a34a;
  --success-soft: #dcfce7;
  --success-fg: #15803d;
  --danger: #e5484d;
  --danger-hover: #cf3438;
  --danger-soft: #fef1f1;
  --danger-fg: #c22a2f;
  --warning: #d97706;
  --warning-soft: #fef4e2;
  --warning-fg: #b45309;
  --info-soft: #e6f1fe;
  --info-fg: #1d6fe0;

  /* sidebar — a refined graphite rail, near-constant across themes */
  --sidebar-bg: #101218;
  --sidebar-fg: #c3c8d2;
  --sidebar-fg-muted: #8b93a3;
  --sidebar-hover-bg: #1b1e26;
  --sidebar-active-bg: #26283a;
  --sidebar-active-fg: #ffffff;
  --sidebar-border: #1e212a;
  --sidebar-brand-fg: #ffffff;

  /* elevation — soft, layered, cool-tinted */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, 0.08), 0 2px 6px -2px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, 0.14), 0 4px 12px -4px rgba(16, 24, 40, 0.08);
  --shadow-xl: 0 24px 56px -12px rgba(16, 24, 40, 0.22);

  --chart-grid: #eef1f5;
  --chart-axis: #8a909a;
  --overlay: rgba(17, 20, 27, 0.42);
}

/* ── Dark theme ───────────────────────────────────────────────────── */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #16181d;
  --bg-subtle: #1b1e24;
  --surface: #1e2128;
  --surface-2: #262a32;
  --surface-3: #2e323b;

  --border: #313641;
  --border-strong: #404652;
  --border-subtle: #272b33;

  --text: #e9ebef;
  --text-muted: #9ba1ac;
  --text-subtle: #6b7280;
  --text-on-primary: #ffffff;

  /* matches the fixed brand indigo (--accent-indigo) so buttons, charts
     and the logo gradient read as one hue in dark mode */
  --primary: #6366f1;
  --primary-hover: #777af3;
  --primary-active: #8b8df5;
  --primary-soft: rgba(99, 102, 241, 0.18);
  --primary-soft-fg: #a5a8f9;
  --ring: rgba(99, 102, 241, 0.45);

  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.16);
  --success-fg: #4ade80;
  --danger: #f0575c;
  --danger-hover: #f2696e;
  --danger-soft: rgba(240, 87, 92, 0.15);
  --danger-fg: #f7999c;
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.15);
  --warning-fg: #fbbf24;
  --info-soft: rgba(59, 130, 246, 0.16);
  --info-fg: #7cb0f5;

  /* sidebar goes a touch darker than content for separation */
  --sidebar-bg: #101216;
  --sidebar-fg: #b8bdc8;
  --sidebar-fg-muted: #7b828f;
  --sidebar-hover-bg: #1d2026;
  --sidebar-active-bg: #2a2e38;
  --sidebar-active-fg: #ffffff;
  --sidebar-border: #24282f;
  --sidebar-brand-fg: #ffffff;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 14px -2px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 14px 36px -8px rgba(0, 0, 0, 0.65);
  --shadow-xl: 0 26px 60px -12px rgba(0, 0, 0, 0.7);

  --chart-grid: #2c303a;
  --chart-axis: #7c828d;
  --overlay: rgba(0, 0, 0, 0.6);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
    --dur: 0ms;
    --dur-slow: 0ms;
  }
}
