/* =============================================================================
   VidPipe Studio — Design Tokens (the foundation)
   Loaded FIRST. All other CSS files inherit these variables.
   Single source of truth for color, spacing, radius, shadow, typography, motion.
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* === COLOR — Light === */
  --color-bg: #FAFAFA;
  --color-surface: #FFFFFF;
  --color-surface-2: #F4F4F5;
  --color-surface-3: #E4E4E7;
  --color-border: rgba(0, 0, 0, 0.06);
  --color-border-strong: rgba(0, 0, 0, 0.10);
  --color-border-stronger: rgba(0, 0, 0, 0.16);

  --color-text: #09090B;
  --color-text-2: #52525B;
  --color-text-3: #A1A1AA;
  --color-text-4: #D4D4D8;

  /* Brand — single accent across the entire app */
  --color-brand: #5B5EF4;
  --color-brand-hover: #4B4ED4;
  --color-brand-soft: rgba(91, 94, 244, 0.08);
  --color-brand-mid: rgba(91, 94, 244, 0.16);

  /* States */
  --color-success: #10B981;
  --color-success-soft: rgba(16, 185, 129, 0.08);
  --color-warn: #F59E0B;
  --color-warn-soft: rgba(245, 158, 11, 0.08);
  --color-danger: #EF4444;
  --color-danger-soft: rgba(239, 68, 68, 0.08);
  --color-info: #3B82F6;
  --color-info-soft: rgba(59, 130, 246, 0.08);

  /* === SPACING (4/8 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;
  --space-16: 64px;

  /* === RADIUS === */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-pill: 9999px;

  /* === SHADOWS — subtle elevation === */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 48px rgba(0, 0, 0, 0.10), 0 8px 16px rgba(0, 0, 0, 0.04);
  --shadow-brand: 0 4px 14px rgba(91, 94, 244, 0.20);

  /* === TYPOGRAPHY — Inter only === */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  /* Type scale */
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 32px;
  --text-4xl: 40px;

  /* Line heights */
  --leading-tight: 1.2;
  --leading-snug: 1.4;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;

  /* Letter spacing */
  --tracking-tight: -0.02em;
  --tracking-tighter: -0.03em;
  --tracking-wide: 0.04em;

  /* Weight */
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;

  /* === MOTION === */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 120ms;
  --duration-base: 200ms;
  --duration-slow: 320ms;

  /* === LAYOUT === */
  --sidebar-w: 220px;
  --topbar-h: 56px;
  --content-max: 1200px;

  /* === LEGACY ALIASES (so existing CSS keeps working) === */
  --bg: var(--color-bg);
  --surface: var(--color-surface);
  --surface-2: var(--color-surface-2);
  --surface-3: var(--color-surface-3);
  --border: var(--color-border);
  --border-2: var(--color-border-strong);
  --border-3: var(--color-border-stronger);
  --text: var(--color-text);
  --text-2: var(--color-text-2);
  --text-3: var(--color-text-3);
  --text-4: var(--color-text-4);
  --accent: var(--color-brand);
  --accent-light: var(--color-brand);
  --accent-dark: var(--color-brand-hover);
  --accent-bg: var(--color-brand-soft);
  --accent-bg-2: var(--color-brand-mid);
  --accent-soft: var(--color-brand-soft);
  --accent-mid: var(--color-brand-mid);
  --accent2: var(--color-brand-hover);
  --success: var(--color-success);
  --success-bg: var(--color-success-soft);
  --green: var(--color-success);
  --green2: var(--color-success);
  --green-soft: var(--color-success-soft);
  --green-border: var(--color-success);
  --danger: var(--color-danger);
  --danger-bg: var(--color-danger-soft);
  --red: var(--color-danger);
  --red-soft: var(--color-danger-soft);
  --warn: var(--color-warn);
  --warn-bg: var(--color-warn-soft);
  --warn-soft: var(--color-warn-soft);
  --info: var(--color-info);
  --info-bg: var(--color-info-soft);
  --c-bg: var(--color-bg);
  --c-surface: var(--color-surface);
  --c-border: var(--color-border);
  --c-border2: var(--color-border-strong);
  --c-text: var(--color-text);
  --c-text2: var(--color-text-2);
  --c-text3: var(--color-text-3);
  --r: var(--radius-md);
  --r-lg: var(--radius-lg);
  --radius: var(--radius-lg);
  --radius-sm: 8px;
  --radius-lg: var(--radius-xl);
  --radius-xl: var(--radius-2xl);
  --shadow: var(--shadow-sm);
  --bg-blur: rgba(250, 250, 250, 0.85);
  --surface-hover: var(--color-surface-2);
  --topbar-h: 56px;
  --navbar-h: 56px;
}

/* === DARK THEME === */
[data-theme="dark"],
.admin-app[data-theme="dark"],
.team-app[data-theme="dark"] {
  --color-bg: #09090B;
  --color-surface: #18181B;
  --color-surface-2: #27272A;
  --color-surface-3: #3F3F46;
  --color-border: rgba(255, 255, 255, 0.06);
  --color-border-strong: rgba(255, 255, 255, 0.10);
  --color-border-stronger: rgba(255, 255, 255, 0.14);

  --color-text: #FAFAFA;
  --color-text-2: #A1A1AA;
  --color-text-3: #71717A;
  --color-text-4: #3F3F46;

  --color-brand-soft: rgba(91, 94, 244, 0.14);
  --color-brand-mid: rgba(91, 94, 244, 0.24);

  --color-success-soft: rgba(16, 185, 129, 0.14);
  --color-warn-soft: rgba(245, 158, 11, 0.14);
  --color-danger-soft: rgba(239, 68, 68, 0.14);
  --color-info-soft: rgba(59, 130, 246, 0.14);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.40);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.50);
  --shadow-xl: 0 20px 48px rgba(0, 0, 0, 0.60);

  --bg-blur: rgba(9, 9, 11, 0.85);
}

/* === RESET === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
}

#root { min-height: 100vh; }

a { color: var(--color-brand); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

code, pre, .mono { font-family: var(--font-mono); }

/* Scrollbar — minimal */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--color-text-4);
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--color-text-3); background-clip: padding-box; }

/* Selection */
::selection { background: var(--color-brand-mid); color: var(--color-text); }

/* Focus visible (accessibility) */
:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}
