/* ==========================================================================
   SmartApti — design tokens
   Single source of truth for colour, type, shape, shadow, spacing and motion.
   Mirrors the React app's src/index.css 1:1. Nothing here is Bootstrap aware;
   theme.css maps Bootstrap's own variables onto these tokens.
   ========================================================================== */

:root {
  color-scheme: light;

  /* Surfaces */
  --background: 210 40% 98%; /* #F8FAFC */
  --foreground: 222 47% 11%; /* slate-900 */
  --card: 0 0% 100%; /* #FFFFFF */
  --card-foreground: 222 47% 11%;
  --popover: 0 0% 100%;
  --popover-foreground: 222 47% 11%;
  --muted: 210 40% 96%;
  --muted-foreground: 215 16% 47%; /* slate-600 */

  /* Brand */
  --primary: 262 83% 58%; /* #7C3AED */
  --primary-foreground: 0 0% 100%;
  --primary-deep: 262 74% 50%; /* #6D28D9 */
  --secondary: 210 40% 96%;
  --secondary-foreground: 222 47% 11%;
  --accent: 189 94% 43%; /* #06B6D4 */
  --accent-foreground: 0 0% 100%;

  /* Semantic */
  --success: 160 84% 39%;
  --success-foreground: 0 0% 100%;
  --warning: 38 92% 50%;
  --warning-foreground: 32 95% 12%;
  --danger: 347 77% 50%;
  --danger-foreground: 0 0% 100%;
  --info: 199 89% 48%;
  --info-foreground: 0 0% 100%;

  /* Lines & focus */
  --border: 214 32% 91%; /* #E2E8F0 */
  --input: 214 32% 91%;
  --ring: 262 83% 58%;

  /* Charts */
  --chart-1: 262 83% 58%;
  --chart-2: 189 94% 43%;
  --chart-3: 160 84% 39%;
  --chart-4: 38 92% 50%;
  --chart-5: 347 77% 50%;

  /* Sidebar */
  --sidebar-background: 0 0% 100%;
  --sidebar-foreground: 222 47% 11%;
  --sidebar-primary: 262 83% 58%;
  --sidebar-primary-foreground: 0 0% 100%;
  --sidebar-accent: 262 100% 97%;
  --sidebar-accent-foreground: 262 74% 45%;
  --sidebar-border: 214 32% 91%;
  --sidebar-ring: 262 83% 58%;

  /* Type */
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-heading: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Type scale (px values from the React components) */
  --fs-10: 0.625rem;
  --fs-11: 0.6875rem;
  --fs-12: 0.75rem;
  --fs-13: 0.8125rem;
  --fs-14: 0.875rem;
  --fs-15: 0.9375rem;
  --fs-17: 1.0625rem;
  --fs-19: 1.1875rem;
  --fs-24: 1.5rem;
  --fs-28: 1.75rem;
  --fs-34: 2.125rem;
  --lh-tight: 1.15;
  --lh-snug: 1.35;
  --lh-relaxed: 1.65;

  /* Shape */
  --radius: 0.75rem;
  --radius-card: 0.75rem;
  --radius-ctl: 0.625rem;
  --radius-lg: var(--radius);
  --radius-md: calc(var(--radius) - 2px);
  --radius-sm: calc(var(--radius) - 4px);

  /* Shadow */
  --shadow-card: 0 1px 2px 0 rgb(15 23 42 / 0.04), 0 1px 3px 0 rgb(15 23 42 / 0.06);
  --shadow-lift: 0 12px 32px -14px rgb(15 23 42 / 0.22), 0 2px 8px -3px rgb(15 23 42 / 0.08);
  --shadow-modal: 0 28px 70px -24px rgb(15 23 42 / 0.4);
  --shadow-glow: 0 12px 32px -14px hsl(262 83% 58% / 0.55);

  /* Layout */
  --sidebar-w: 268px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;
  --content-max: 1400px;
  --space-section: 96px;

  /* Motion */
  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 150ms;
  --dur-base: 200ms;

  /* Tenant branding slot (exam surface only) */
  --exam-accent: 262 83% 58%;
}

/* Dark theme — same key set, nothing omitted, so every component inherits. */
[data-bs-theme="dark"] {
  color-scheme: dark;

  --background: 240 29% 6%; /* #0B0B14 */
  --foreground: 210 40% 96%;
  --card: 240 22% 10%; /* #14141F */
  --card-foreground: 210 40% 96%;
  --popover: 240 24% 11%;
  --popover-foreground: 210 40% 96%;
  --muted: 240 18% 14%;
  --muted-foreground: 217 15% 65%;

  --primary: 262 83% 64%;
  --primary-foreground: 0 0% 100%;
  --primary-deep: 262 74% 55%;
  --secondary: 240 18% 14%;
  --secondary-foreground: 210 40% 96%;
  --accent: 189 94% 55%;
  --accent-foreground: 200 100% 8%;

  --success: 158 64% 52%;
  --success-foreground: 160 100% 8%;
  --warning: 43 96% 56%;
  --warning-foreground: 30 100% 8%;
  --danger: 350 89% 62%;
  --danger-foreground: 0 0% 100%;
  --info: 199 95% 62%;
  --info-foreground: 200 100% 8%;

  --border: 240 21% 19%; /* #26263A */
  --input: 240 18% 24%;
  --ring: 262 83% 68%;

  --sidebar-background: 240 26% 8%;
  --sidebar-foreground: 210 40% 96%;
  --sidebar-primary: 262 83% 64%;
  --sidebar-primary-foreground: 0 0% 100%;
  --sidebar-accent: 262 45% 18%;
  --sidebar-accent-foreground: 262 100% 90%;
  --sidebar-border: 240 21% 19%;
  --sidebar-ring: 262 83% 68%;

  --chart-1: 262 83% 64%;
  --chart-2: 189 94% 55%;
  --chart-3: 158 64% 52%;
  --chart-4: 43 96% 56%;
  --chart-5: 350 89% 62%;

  --shadow-card: 0 1px 2px 0 rgb(0 0 0 / 0.32), 0 1px 3px 0 rgb(0 0 0 / 0.28);
  --shadow-lift: 0 16px 36px -16px rgb(0 0 0 / 0.6), 0 2px 10px -4px rgb(0 0 0 / 0.4);
  --shadow-modal: 0 32px 80px -28px rgb(0 0 0 / 0.72);
}

/* Element defaults ---------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5 {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  color: hsl(var(--foreground));
}

p {
  margin: 0;
}

a {
  color: hsl(var(--primary));
  text-decoration: none;
}

::selection {
  background: hsl(var(--primary) / 0.2);
  color: hsl(var(--foreground));
}

/* Utility: type scale ------------------------------------------------------- */
.fs-10 { font-size: var(--fs-10); }
.fs-11 { font-size: var(--fs-11); }
.fs-12 { font-size: var(--fs-12); }
.fs-13 { font-size: var(--fs-13); }
.fs-14 { font-size: var(--fs-14); }
.fs-15 { font-size: var(--fs-15); }
.fs-17 { font-size: var(--fs-17); }
.fs-19 { font-size: var(--fs-19); }
.fs-24 { font-size: var(--fs-24); }
.fs-28 { font-size: var(--fs-28); }

/* Utility: token surfaces -------------------------------------------------- */
.text-fg { color: hsl(var(--foreground)) !important; }
.text-muted-fg { color: hsl(var(--muted-foreground)) !important; }
.text-brand { color: hsl(var(--primary)) !important; }
.text-success-fg { color: hsl(var(--success)) !important; }
.text-danger-fg { color: hsl(var(--danger)) !important; }
.text-warning-fg { color: hsl(var(--warning)) !important; }
.bg-card-surface { background-color: hsl(var(--card)) !important; }
.bg-muted-surface { background-color: hsl(var(--muted)) !important; }
.bg-popover-surface { background-color: hsl(var(--popover)) !important; }
.border-token { border-color: hsl(var(--border)) !important; }
.rounded-card { border-radius: var(--radius-card) !important; }
.rounded-ctl { border-radius: var(--radius-ctl) !important; }
.shadow-token-card { box-shadow: var(--shadow-card) !important; }
.shadow-token-modal { box-shadow: var(--shadow-modal) !important; }
.tabular { font-variant-numeric: tabular-nums; }

/* Motion preference is respected everywhere. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}