/*
 * Design Tokens — nguồn thiết kế duy nhất (prom2 §2.4). Không trang nào tự tạo màu/spacing riêng.
 * Light/Dark theme qua [data-theme] (prom1 AI03).
 */
:root {
  /* Brand */
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-soft: #eff6ff;
  --color-accent: #7c3aed;
  --gradient-brand: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);

  /* Surface & text (light) */
  --color-background: #f8fafc;
  --color-surface: #ffffff;
  --color-surface-2: #f1f5f9;
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;
  --color-text: #0f172a;
  --color-text-2: #334155;
  --color-muted: #64748b;
  --color-on-primary: #ffffff;

  /* Semantic */
  --color-success: #15803d;
  --color-success-soft: #dcfce7;
  --color-warning: #b45309;
  --color-warning-soft: #fef3c7;
  --color-danger: #b91c1c;
  --color-danger-soft: #fee2e2;
  --color-info: #1d4ed8;
  --color-info-soft: #dbeafe;

  /* Typography */
  --font-sans: "Be Vietnam Pro", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: clamp(1.75rem, 1.4rem + 1.5vw, 2.25rem);
  --text-hero: clamp(2.25rem, 1.6rem + 3.2vw, 3.75rem);
  --leading-tight: 1.2;
  --leading-normal: 1.6;

  /* Spacing (4px scale) */
  --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;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
  --ring: 0 0 0 3px rgba(37, 99, 235, 0.45);

  /* Z-index */
  --z-header: 50;
  --z-drawer: 80;
  --z-modal: 90;
  --z-toast: 100;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur-fast: 120ms;
  --dur: 200ms;
  --dur-slow: 400ms;

  /* Layout */
  --container: 1200px;
  --container-narrow: 760px;
  --header-h: 64px;
  --touch: 44px;
  --sidebar-w: 300px;
}

[data-theme="dark"] {
  --color-primary: #60a5fa;
  --color-primary-hover: #93c5fd;
  --color-primary-soft: rgba(96, 165, 250, 0.12);
  --color-accent: #a78bfa;
  --gradient-brand: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
  --color-background: #0b1120;
  --color-surface: #111827;
  --color-surface-2: #1e293b;
  --color-border: #1f2a3d;
  --color-border-strong: #334155;
  --color-text: #e2e8f0;
  --color-text-2: #cbd5e1;
  --color-muted: #94a3b8;
  --color-on-primary: #0b1120;
  --color-success: #4ade80;
  --color-success-soft: rgba(74, 222, 128, 0.12);
  --color-warning: #fbbf24;
  --color-warning-soft: rgba(251, 191, 36, 0.12);
  --color-danger: #f87171;
  --color-danger-soft: rgba(248, 113, 113, 0.12);
  --color-info: #93c5fd;
  --color-info-soft: rgba(147, 197, 253, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --ring: 0 0 0 3px rgba(96, 165, 250, 0.5);
  color-scheme: dark;
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur: 0ms; --dur-slow: 0ms; }
}
