/* ═══════════════════════════════════════════════════════
   SLATE — Design System Tokens v3
   DOC-3 spec: Slack structure + Google clarity + selective glassmorphism
   Primary accent: Indigo (#6366f1) | Fonts: Inter + JetBrains Mono
═══════════════════════════════════════════════════════ */

/* ── DARK THEME (default) ── */
:root {
  /* Surfaces */
  --bg:  #0f1011;
  --s1:  #161719;
  --s2:  #1c1d20;
  --s3:  #242528;
  --s4:  #2c2d31;

  /* Borders */
  --b1:  #2a2b2f;
  --b2:  #3a3b40;
  --b3:  #4a4b52;

  /* Text */
  --tx:  #ececed;
  --t2:  #a8a9ad;
  --t3:  #6b6c72;
  --t4:  #45464b;

  /* Pipeline stage colors */
  --stage-research:  #60a5fa;
  --stage-working:   #f59e0b;
  --stage-preupload: #34d399;
  --stage-complete:  #a78bfa;

  /* Semantic colors */
  --accent:       #6366f1;
  --accent-hover: #818cf8;
  --accent-bg:    rgba(99,102,241,0.12);
  --success:      #34d399;
  --success-bg:   rgba(52,211,153,0.12);
  --warning:      #f59e0b;
  --warning-bg:   rgba(245,158,11,0.12);
  --error:        #f87171;
  --error-bg:     rgba(248,113,113,0.12);
  --info:         #60a5fa;
  --info-bg:      rgba(96,165,250,0.12);

  /* Glassmorphism */
  --glass-bg:     rgba(22,23,25,0.75);
  --glass-border: rgba(255,255,255,0.08);
  --glass-blur:   blur(20px);

  /* Radius (FIXED — never deviate) */
  --radius-xs:   4px;
  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'DM Mono', 'Fira Code', monospace;
  --text-xs:   11px;
  --text-sm:   12px;
  --text-base: 14px;
  --text-md:   15px;
  --text-lg:   18px;
  --text-xl:   22px;
  --text-2xl:  28px;
  --text-3xl:  36px;
  --weight-normal:   400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  /* Spacing (8px grid) */
  --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;

  /* Shadows */
  --shadow-sm:    0 1px 2px rgba(0,0,0,0.15);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.2);
  --shadow-lg:    0 8px 30px rgba(0,0,0,0.3);
  --shadow-glass: 0 8px 32px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.05);

  /* Transitions */
  --transition-fast: 0.1s ease;
  --transition-base: 0.15s ease;
  --transition-slow: 0.25s ease;

  /* ── Backward-compat aliases (legacy CSS still references these) ── */
  --blue:     #60a5fa;
  --blue-d:   rgba(96,165,250,0.12);
  --amber:    #f59e0b;
  --amber-d:  rgba(245,158,11,0.12);
  --amber-g:  rgba(245,158,11,0.28);
  --green:    #34d399;
  --green-d:  rgba(52,211,153,0.12);
  --red:      #f87171;
  --red-d:    rgba(248,113,113,0.12);
  --purple:   #a78bfa;
  --purple-d: rgba(167,139,250,0.12);
  /* Legacy bg2 → s2, accent-d → accent-bg */
  --bg2:      #1c1d20;
  --accent-d: rgba(99,102,241,0.12);
  /* Legacy radius/font */
  --r:    8px;
  --rs:   6px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'DM Mono', monospace;
}

body {
  background: var(--bg);
  color: var(--tx);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

/* ── LIGHT THEME ── */
body.light {
  --bg:  #f5f5f5;
  --s1:  #ffffff;
  --s2:  #fafafa;
  --s3:  #f0f0f0;
  --s4:  #e8e8e8;
  --b1:  #e5e5e5;
  --b2:  #d4d4d4;
  --b3:  #a3a3a3;
  --tx:  #171717;
  --t2:  #525252;
  --t3:  #a3a3a3;
  --t4:  #d4d4d4;

  --accent:       #4f46e5;
  --accent-hover: #6366f1;
  --accent-bg:    rgba(79,70,229,0.08);
  --success-bg:   rgba(52,211,153,0.08);
  --warning-bg:   rgba(245,158,11,0.08);
  --error-bg:     rgba(248,113,113,0.08);
  --info-bg:      rgba(96,165,250,0.08);

  --glass-bg:     rgba(255,255,255,0.88);
  --glass-border: rgba(0,0,0,0.06);

  --blue:     #2563eb;
  --blue-d:   rgba(37,99,235,0.10);
  --amber:    #d97706;
  --amber-d:  rgba(217,119,6,0.10);
  --amber-g:  rgba(217,119,6,0.22);
  --green:    #059669;
  --green-d:  rgba(5,150,105,0.10);
  --red:      #dc2626;
  --red-d:    rgba(220,38,38,0.10);
  --purple:   #7c3aed;
  --purple-d: rgba(124,58,237,0.10);
  --bg2:      #fafafa;
  --accent-d: rgba(79,70,229,0.08);

  background: var(--bg);
  color: var(--tx);
}

/* Light mode specific overrides */
body.light ::-webkit-scrollbar-thumb { background: #c0c4cc }
body.light #icon-rail  { border-right: 1.5px solid var(--b1) }
body.light #sidebar    { border-right: 1.5px solid var(--b1) }
body.light .topbar     { background: var(--s1); border-bottom: 1.5px solid var(--b1) }
body.light .cc-hero    { background: var(--s1); border-bottom: 1.5px solid var(--b1) }
body.light .cc-tabs    { background: var(--s1); border-bottom: 1.5px solid var(--b1) }
body.light .cc-stats-strip { background: var(--s1); border-top: 1.5px solid var(--b1) }
body.light .vc-row     { border-bottom: 1px solid var(--s3) }
body.light .vc-row:hover { background: var(--s3) }
body.light .sl-head    { background: var(--bg) }
body.light .sl-table th { background: var(--bg) }

/* ── GLASS UTILITY (approved elements only per spec) ── */
.glass {
  background: var(--glass-bg) !important;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border) !important;
  box-shadow: var(--shadow-glass);
}

/* ── TYPE BADGES (spec §3.5 — required on every video card) ── */
.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}
.type-badge.short  { background: rgba(96,165,250,0.10);  color: #60a5fa; }
.type-badge.medium { background: rgba(245,158,11,0.10);  color: #f59e0b; }
.type-badge.long   { background: rgba(248,113,113,0.10); color: #f87171; }

/* ── STAGE BADGES (spec §3.4) ── */
.stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}
.stage-badge.research   { background: var(--info-bg);    color: var(--stage-research); }
.stage-badge.working    { background: var(--warning-bg); color: var(--stage-working); }
.stage-badge.pre-upload { background: var(--success-bg); color: var(--stage-preupload); }
.stage-badge.complete   { background: rgba(167,139,250,0.12); color: var(--stage-complete); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--b2); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--b3); }

/* ── ANIMATIONS ── */
@keyframes toast-in {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes modal-in {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
@keyframes modalIn {
  from { opacity: 0; scale: 0.96; }
  to   { opacity: 1; scale: 1; }
}
@keyframes slide-in-right {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
@keyframes pulse-dot {
  0%,100% { opacity:1; }
  50%      { opacity:.35; }
}
