/**
 * ═══════════════════════════════════════════════════════════════════════════
 * THUMBNAILBUILDER.APP — CATALYST DESIGN SYSTEM
 * Premium Cinematic Glass UI
 * ═══════════════════════════════════════════════════════════════════════════
 *
 * Design Philosophy:
 * - Cinematic depth with layered glass surfaces
 * - Intentional asymmetry to feel human-crafted
 * - Soft glows that breathe, not pulse robotically
 * - Typography with character, not generic
 * - 60/40 visual weight distribution
 *
 * Hierarchy: ACCESSIBILITY → PERFORMANCE → CLARITY → DELIGHT → CONVERSION
 */

/* ═══════════════════════════════════════════════════════════════════════════
   1. DESIGN TOKENS — THE FOUNDATION
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ─────────────────────────────────────────────────────────────────────────
     COLOR SYSTEM — Cinematic Dark Palette
     ───────────────────────────────────────────────────────────────────────── */

  /* Background Depths — Not pure black, has warmth */
  --color-bg-void: #030306;           /* Deepest layer */
  --color-bg-base: #050508;           /* App background */
  --color-bg-raised: #0A0A0F;         /* Elevated surfaces */
  --color-bg-elevated: #12121A;       /* Cards, panels */
  --color-bg-floating: #1A1A24;       /* Modals, popovers */

  /* Surface Colors — Glass layers */
  --color-surface-glass: rgba(18, 18, 26, 0.72);
  --color-surface-glass-light: rgba(30, 30, 42, 0.65);
  --color-surface-glass-dark: rgba(8, 8, 12, 0.85);
  --color-surface-glass-frosted: rgba(255, 255, 255, 0.03);

  /* Brand Colors — The Soul */
  --color-primary: #FF5500;           /* Energetic orange */
  --color-primary-soft: #FF7733;      /* Hover state */
  --color-primary-muted: rgba(255, 85, 0, 0.15);
  --color-primary-glow: rgba(255, 85, 0, 0.4);

  --color-accent-purple: #9D00FF;     /* Creative accent */
  --color-accent-purple-soft: #B44DFF;
  --color-accent-purple-muted: rgba(157, 0, 255, 0.12);
  --color-accent-purple-glow: rgba(157, 0, 255, 0.35);

  --color-accent-cyan: #00D4FF;       /* Tech/AI accent */
  --color-accent-cyan-soft: #4DE1FF;
  --color-accent-cyan-muted: rgba(0, 212, 255, 0.1);
  --color-accent-cyan-glow: rgba(0, 212, 255, 0.3);

  /* Semantic Colors */
  --color-success: #00D68F;
  --color-success-muted: rgba(0, 214, 143, 0.12);
  --color-warning: #FFB800;
  --color-warning-muted: rgba(255, 184, 0, 0.12);
  --color-error: #FF3D71;
  --color-error-muted: rgba(255, 61, 113, 0.12);

  /* Text Colors — Careful contrast ratios */
  --color-text-primary: #F4F4F6;      /* 15.8:1 contrast */
  --color-text-secondary: #A0A0B0;    /* 7.2:1 contrast */
  --color-text-tertiary: #6B6B7A;     /* 4.6:1 contrast — use sparingly */
  --color-text-muted: #4A4A58;        /* Decorative only */
  --color-text-inverse: #050508;

  /* Border Colors */
  --color-border-subtle: rgba(255, 255, 255, 0.06);
  --color-border-default: rgba(255, 255, 255, 0.1);
  --color-border-strong: rgba(255, 255, 255, 0.18);
  --color-border-glow: rgba(255, 85, 0, 0.3);

  /* ─────────────────────────────────────────────────────────────────────────
     GLASS EFFECTS — The Magic
     ───────────────────────────────────────────────────────────────────────── */

  --glass-blur-sm: blur(8px);
  --glass-blur-md: blur(16px);
  --glass-blur-lg: blur(24px);
  --glass-blur-xl: blur(40px);

  --glass-noise: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");

  /* ─────────────────────────────────────────────────────────────────────────
     SHADOWS — Depth & Dimension
     ───────────────────────────────────────────────────────────────────────── */

  /* Soft shadows for depth */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3),
               0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.3),
               0 8px 16px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.35),
               0 16px 32px rgba(0, 0, 0, 0.25);
  --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.4),
               0 24px 48px rgba(0, 0, 0, 0.3);

  /* Glow shadows — brand personality */
  --glow-primary-sm: 0 0 12px rgba(255, 85, 0, 0.3);
  --glow-primary-md: 0 0 24px rgba(255, 85, 0, 0.35),
                     0 0 48px rgba(255, 85, 0, 0.15);
  --glow-primary-lg: 0 0 32px rgba(255, 85, 0, 0.4),
                     0 0 64px rgba(255, 85, 0, 0.2),
                     0 0 96px rgba(255, 85, 0, 0.1);

  --glow-purple-sm: 0 0 12px rgba(157, 0, 255, 0.25);
  --glow-purple-md: 0 0 24px rgba(157, 0, 255, 0.3),
                    0 0 48px rgba(157, 0, 255, 0.12);

  --glow-cyan-sm: 0 0 12px rgba(0, 212, 255, 0.25);
  --glow-cyan-md: 0 0 24px rgba(0, 212, 255, 0.3),
                  0 0 48px rgba(0, 212, 255, 0.12);

  /* Inset shadow for depth */
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.05),
                  inset 0 -1px 0 rgba(0, 0, 0, 0.2);

  /* ─────────────────────────────────────────────────────────────────────────
     BORDER RADIUS — Organic, Not Perfect
     ───────────────────────────────────────────────────────────────────────── */

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;        /* Intentionally not 8px — breaks the grid slightly */
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-2xl: 28px;
  --radius-full: 9999px;

  /* ─────────────────────────────────────────────────────────────────────────
     SPACING SCALE — 4px Base with Intentional Breaks
     ───────────────────────────────────────────────────────────────────────── */

  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;          /* Intentional break from 8px grid */
  --space-6: 24px;
  --space-7: 28px;          /* Another intentional break */
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-14: 56px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-32: 128px;

  /* ─────────────────────────────────────────────────────────────────────────
     TYPOGRAPHY — Character, Not Generic
     ───────────────────────────────────────────────────────────────────────── */

  /* Font Families */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Inter', var(--font-sans);  /* For headlines */
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;

  /* Font Sizes — Fluid with clamp() */
  --text-xs: clamp(0.6875rem, 0.65rem + 0.1vw, 0.75rem);     /* 11-12px */
  --text-sm: clamp(0.8125rem, 0.78rem + 0.1vw, 0.875rem);    /* 13-14px */
  --text-base: clamp(0.9375rem, 0.9rem + 0.12vw, 1rem);      /* 15-16px */
  --text-md: clamp(1rem, 0.95rem + 0.15vw, 1.125rem);        /* 16-18px */
  --text-lg: clamp(1.125rem, 1.05rem + 0.2vw, 1.25rem);      /* 18-20px */
  --text-xl: clamp(1.25rem, 1.15rem + 0.3vw, 1.5rem);        /* 20-24px */
  --text-2xl: clamp(1.5rem, 1.35rem + 0.4vw, 1.875rem);      /* 24-30px */
  --text-3xl: clamp(1.875rem, 1.65rem + 0.6vw, 2.5rem);      /* 30-40px */
  --text-4xl: clamp(2.25rem, 1.9rem + 0.9vw, 3.25rem);       /* 36-52px */

  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;
  --leading-loose: 1.8;

  /* Font Weights */
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Letter Spacing */
  --tracking-tighter: -0.03em;
  --tracking-tight: -0.015em;
  --tracking-normal: 0;
  --tracking-wide: 0.015em;
  --tracking-wider: 0.03em;
  --tracking-widest: 0.08em;

  /* ─────────────────────────────────────────────────────────────────────────
     TRANSITIONS & ANIMATIONS
     ───────────────────────────────────────────────────────────────────────── */

  /* Durations */
  --duration-instant: 75ms;
  --duration-fast: 150ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;
  --duration-slower: 450ms;
  --duration-slowest: 600ms;

  /* Easings — Premium feel */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.64, 0, 0.78, 0);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

  /* Composite Transitions */
  --transition-fast: var(--duration-fast) var(--ease-out);
  --transition-normal: var(--duration-normal) var(--ease-out);
  --transition-slow: var(--duration-slow) var(--ease-out);
  --transition-bounce: var(--duration-slow) var(--ease-bounce);

  /* ─────────────────────────────────────────────────────────────────────────
     Z-INDEX SCALE
     ───────────────────────────────────────────────────────────────────────── */

  --z-below: -1;
  --z-base: 0;
  --z-raised: 10;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-popover: 500;
  --z-toast: 600;
  --z-tooltip: 700;
  --z-max: 9999;
}

/* ═══════════════════════════════════════════════════════════════════════════
   2. GLASS PANEL COMPONENTS — The Signature Look
   ═══════════════════════════════════════════════════════════════════════════ */

/* Base Glass Panel */
.glass-panel {
  position: relative;
  background: var(--color-surface-glass);
  backdrop-filter: var(--glass-blur-md);
  -webkit-backdrop-filter: var(--glass-blur-md);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md), var(--shadow-inset);
  overflow: hidden;
}

/* Subtle noise texture overlay */
.glass-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glass-noise);
  opacity: 0.5;
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* Top highlight for depth */
.glass-panel::after {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.12) 30%,
    rgba(255, 255, 255, 0.12) 70%,
    transparent
  );
  pointer-events: none;
}

/* Dark Variant — For nested panels */
.glass-panel-dark {
  position: relative;
  background: var(--color-surface-glass-dark);
  backdrop-filter: var(--glass-blur-lg);
  -webkit-backdrop-filter: var(--glass-blur-lg);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg),
              inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

/* Light Variant — For contrast elements */
.glass-panel-light {
  position: relative;
  background: var(--color-surface-glass-light);
  backdrop-filter: var(--glass-blur-md);
  -webkit-backdrop-filter: var(--glass-blur-md);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.glass-panel-light::after {
  content: '';
  position: absolute;
  top: 0;
  left: 5%;
  right: 5%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.18) 20%,
    rgba(255, 255, 255, 0.18) 80%,
    transparent
  );
  pointer-events: none;
}

/* Glowing Variant — For focused/active elements */
.glass-panel-glow {
  position: relative;
  background: var(--color-surface-glass);
  backdrop-filter: var(--glass-blur-md);
  -webkit-backdrop-filter: var(--glass-blur-md);
  border: 1px solid var(--color-border-glow);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md),
              var(--glow-primary-sm),
              inset 0 0 24px rgba(255, 85, 0, 0.05);
}

.glass-panel-glow::before {
  content: '';
  position: absolute;
  inset: -1px;
  background: linear-gradient(
    135deg,
    rgba(255, 85, 0, 0.15),
    transparent 40%,
    transparent 60%,
    rgba(157, 0, 255, 0.1)
  );
  border-radius: inherit;
  z-index: -1;
  opacity: 0.6;
}

/* Purple Glow Variant */
.glass-panel-glow-purple {
  position: relative;
  background: var(--color-surface-glass);
  backdrop-filter: var(--glass-blur-md);
  -webkit-backdrop-filter: var(--glass-blur-md);
  border: 1px solid rgba(157, 0, 255, 0.3);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md),
              var(--glow-purple-sm),
              inset 0 0 24px rgba(157, 0, 255, 0.04);
}

/* Cyan Glow Variant */
.glass-panel-glow-cyan {
  position: relative;
  background: var(--color-surface-glass);
  backdrop-filter: var(--glass-blur-md);
  -webkit-backdrop-filter: var(--glass-blur-md);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md),
              var(--glow-cyan-sm),
              inset 0 0 24px rgba(0, 212, 255, 0.04);
}

/* ═══════════════════════════════════════════════════════════════════════════
   3. LAYOUT COMPONENTS — The Architecture
   ═══════════════════════════════════════════════════════════════════════════ */

/* Main Workspace Layout — 3 Column */
.workspace-layout {
  display: grid;
  grid-template-columns: 240px 1fr 320px;
  grid-template-rows: 1fr auto;
  gap: var(--space-5);
  height: 100vh;
  padding: var(--space-5);
  background: var(--color-bg-base);
  overflow: hidden;
}

/* Responsive: Tablet */
@media (max-width: 1280px) {
  .workspace-layout {
    grid-template-columns: 200px 1fr 280px;
    gap: var(--space-4);
    padding: var(--space-4);
  }
}

/* Responsive: Mobile — Stack vertically */
@media (max-width: 768px) {
  .workspace-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    padding: var(--space-3);
    gap: var(--space-3);
  }
}

/* Left Sidebar — Stepper + Info */
.sidebar-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  min-height: 0;
}

/* Center Main Area */
.main-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  min-height: 0;
  grid-row: span 2;
}

/* Right Sidebar — Controls */
.sidebar-right {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-default) transparent;
}

.sidebar-right::-webkit-scrollbar {
  width: 6px;
}

.sidebar-right::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-right::-webkit-scrollbar-thumb {
  background: var(--color-border-default);
  border-radius: var(--radius-full);
}

/* Preview Canvas Container */
.preview-canvas {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-void);
  border-radius: var(--radius-xl);
  overflow: hidden;
  min-height: 400px;
}

/* 16:9 Aspect Ratio Container */
.preview-frame {
  position: relative;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16 / 9;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}

/* Safe Frame Overlay — YouTube Safe Zone */
.safe-frame-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-raised);
}

/* Safe zone border */
.safe-frame-overlay::before {
  content: '';
  position: absolute;
  top: 5%;
  left: 3%;
  right: 3%;
  bottom: 5%;
  border: 1px dashed rgba(255, 85, 0, 0.3);
  border-radius: var(--radius-sm);
}

/* Corner indicators */
.safe-frame-corner {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-primary);
  opacity: 0.5;
}

.safe-frame-corner--tl {
  top: 5%;
  left: 3%;
  border-right: none;
  border-bottom: none;
  border-top-left-radius: var(--radius-xs);
}

.safe-frame-corner--tr {
  top: 5%;
  right: 3%;
  border-left: none;
  border-bottom: none;
  border-top-right-radius: var(--radius-xs);
}

.safe-frame-corner--bl {
  bottom: 5%;
  left: 3%;
  border-right: none;
  border-top: none;
  border-bottom-left-radius: var(--radius-xs);
}

.safe-frame-corner--br {
  bottom: 5%;
  right: 3%;
  border-left: none;
  border-top: none;
  border-bottom-right-radius: var(--radius-xs);
}

/* Variant Strip — Bottom Carousel */
.variant-strip {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.variant-strip::-webkit-scrollbar {
  display: none;
}

/* Individual Variant Thumbnail */
.variant-card {
  flex-shrink: 0;
  width: 160px;
  aspect-ratio: 16 / 9;
  background: var(--color-bg-elevated);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition:
    border-color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

.variant-card:hover {
  border-color: var(--color-border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.variant-card.active {
  border-color: var(--color-primary);
  box-shadow: var(--glow-primary-sm);
}

.variant-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Control Panel — Right Sidebar */
.control-panel {
  padding: var(--space-5);
}

.control-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
}

.control-panel__title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  letter-spacing: var(--tracking-tight);
}

.control-panel__section {
  margin-bottom: var(--space-6);
}

.control-panel__section:last-child {
  margin-bottom: 0;
}

.control-panel__label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

/* ═══════════════════════════════════════════════════════════════════════════
   4. INTERACTIVE ELEMENTS — Buttons, Inputs, Controls
   ═══════════════════════════════════════════════════════════════════════════ */

/* Button Reset */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Primary Button — Main CTA */
.btn-primary {
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    #E64D00 100%
  );
  color: white;
  box-shadow:
    var(--shadow-sm),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  min-height: 44px; /* Touch target */
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(
    135deg,
    var(--color-primary-soft) 0%,
    var(--color-primary) 100%
  );
  transform: translateY(-1px);
  box-shadow:
    var(--shadow-md),
    var(--glow-primary-sm);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Secondary Button */
.btn-secondary {
  background: var(--color-surface-glass-light);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-default);
  box-shadow: var(--shadow-sm);
  min-height: 44px;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-bg-floating);
  border-color: var(--color-border-strong);
  transform: translateY(-1px);
}

.btn-secondary:active:not(:disabled) {
  transform: translateY(0);
  background: var(--color-surface-glass-dark);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  min-height: 44px;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-surface-glass);
  color: var(--color-text-primary);
}

.btn-ghost:active:not(:disabled) {
  background: var(--color-surface-glass-dark);
}

/* Icon Button */
.btn-icon {
  padding: var(--space-3);
  width: 44px;
  height: 44px;
}

/* Button Sizes */
.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  min-height: 36px;
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-base);
  min-height: 52px;
}

/* ─────────────────────────────────────────────────────────────────────────
   Slider Control
   ───────────────────────────────────────────────────────────────────────── */

.slider-control {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.slider-control__input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-full);
  cursor: pointer;
  border: 1px solid var(--color-border-subtle);
}

.slider-control__input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: linear-gradient(
    135deg,
    var(--color-text-primary) 0%,
    var(--color-text-secondary) 100%
  );
  border-radius: 50%;
  cursor: grab;
  box-shadow: var(--shadow-md);
  border: 2px solid var(--color-bg-base);
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

.slider-control__input::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: var(--shadow-lg), var(--glow-primary-sm);
}

.slider-control__input::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
}

.slider-control__input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--color-text-primary);
  border-radius: 50%;
  cursor: grab;
  box-shadow: var(--shadow-md);
  border: 2px solid var(--color-bg-base);
}

.slider-control__value {
  min-width: 48px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ─────────────────────────────────────────────────────────────────────────
   Toggle Switch
   ───────────────────────────────────────────────────────────────────────── */

.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

.toggle-switch__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch__track {
  position: relative;
  width: 48px;
  height: 26px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-full);
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast);
}

.toggle-switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--color-text-secondary);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--transition-bounce),
    background-color var(--transition-fast);
}

.toggle-switch__input:checked + .toggle-switch__track {
  background: var(--color-primary-muted);
  border-color: var(--color-primary);
}

.toggle-switch__input:checked + .toggle-switch__track .toggle-switch__thumb {
  transform: translateX(22px);
  background: var(--color-primary);
}

.toggle-switch__input:focus-visible + .toggle-switch__track {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.toggle-switch__label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* ─────────────────────────────────────────────────────────────────────────
   Glass Input
   ───────────────────────────────────────────────────────────────────────── */

.input-glass {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  background: var(--color-surface-glass-dark);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  outline: none;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast);
  min-height: 44px;
}

.input-glass::placeholder {
  color: var(--color-text-muted);
}

.input-glass:hover {
  border-color: var(--color-border-default);
  background: var(--color-surface-glass);
}

.input-glass:focus {
  border-color: var(--color-primary);
  background: var(--color-surface-glass);
  box-shadow:
    0 0 0 3px var(--color-primary-muted),
    var(--shadow-sm);
}

/* Textarea variant */
.textarea-glass {
  resize: vertical;
  min-height: 100px;
  line-height: var(--leading-normal);
}

/* ─────────────────────────────────────────────────────────────────────────
   Dropdown Glass
   ───────────────────────────────────────────────────────────────────────── */

.dropdown-glass {
  position: relative;
}

.dropdown-glass__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  background: var(--color-surface-glass-dark);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    border-color var(--transition-fast),
    background-color var(--transition-fast);
  min-height: 44px;
}

.dropdown-glass__trigger:hover {
  border-color: var(--color-border-default);
  background: var(--color-surface-glass);
}

.dropdown-glass__trigger[aria-expanded="true"] {
  border-color: var(--color-primary);
  background: var(--color-surface-glass);
}

.dropdown-glass__icon {
  width: 16px;
  height: 16px;
  color: var(--color-text-tertiary);
  transition: transform var(--transition-fast);
}

.dropdown-glass__trigger[aria-expanded="true"] .dropdown-glass__icon {
  transform: rotate(180deg);
}

.dropdown-glass__menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  right: 0;
  background: var(--color-bg-floating);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition:
    opacity var(--transition-fast),
    transform var(--transition-fast),
    visibility var(--transition-fast);
  max-height: 280px;
  overflow-y: auto;
}

.dropdown-glass__menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-glass__item {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast);
}

.dropdown-glass__item:hover {
  background: var(--color-surface-glass);
  color: var(--color-text-primary);
}

.dropdown-glass__item.selected {
  background: var(--color-primary-muted);
  color: var(--color-primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   5. STEP INDICATOR — Progress Through the Workflow
   ═══════════════════════════════════════════════════════════════════════════ */

.stepper {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.step {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    transform var(--transition-fast);
  text-align: left;
  width: 100%;
}

.step:hover:not(.step--disabled) {
  background: var(--color-surface-glass);
}

.step--disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Step Number/Icon Circle */
.step__indicator {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--color-bg-elevated);
  border: 2px solid var(--color-border-default);
  border-radius: 50%;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-tertiary);
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-slow);
  flex-shrink: 0;
}

/* Completed State */
.step--completed .step__indicator {
  background: var(--color-success-muted);
  border-color: var(--color-success);
  color: var(--color-success);
}

.step--completed .step__indicator::after {
  content: '';
  width: 10px;
  height: 6px;
  border: 2px solid var(--color-success);
  border-top: none;
  border-right: none;
  transform: rotate(-45deg) translateY(-1px);
}

/* Active State — The Hero */
.step--active .step__indicator {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
  box-shadow: var(--glow-primary-md);
}

/* Pulsing glow for active step */
.step--active .step__indicator::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: var(--color-primary);
  opacity: 0;
  animation: step-pulse 2s ease-in-out infinite;
}

@keyframes step-pulse {
  0%, 100% {
    opacity: 0;
    transform: scale(1);
  }
  50% {
    opacity: 0.15;
    transform: scale(1.2);
  }
}

/* Step Content */
.step__content {
  flex: 1;
  min-width: 0;
}

.step__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-1);
  transition: color var(--transition-fast);
}

.step--active .step__title {
  color: var(--color-text-primary);
}

.step--completed .step__title {
  color: var(--color-text-secondary);
}

.step__description {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  display: none;
}

.step--active .step__description {
  display: block;
  color: var(--color-text-tertiary);
}

/* Connector Line */
.step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: calc(var(--space-4) + 17px);
  top: calc(100% - 2px);
  width: 2px;
  height: calc(var(--space-1) + 4px);
  background: var(--color-border-subtle);
  transition: background-color var(--transition-fast);
}

.step--completed:not(:last-child)::after {
  background: var(--color-success);
}

/* ═══════════════════════════════════════════════════════════════════════════
   6. ANIMATION CLASSES — Motion Design
   ═══════════════════════════════════════════════════════════════════════════ */

/* Respect user preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Entry Animations */
.fade-in {
  animation: fadeIn var(--duration-normal) var(--ease-out) both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.slide-up {
  animation: slideUp var(--duration-slow) var(--ease-out) both;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-down {
  animation: slideDown var(--duration-slow) var(--ease-out) both;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-left {
  animation: slideLeft var(--duration-slow) var(--ease-out) both;
}

@keyframes slideLeft {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.slide-right {
  animation: slideRight var(--duration-slow) var(--ease-out) both;
}

@keyframes slideRight {
  from {
    opacity: 0;
    transform: translateX(-24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.scale-in {
  animation: scaleIn var(--duration-slow) var(--ease-bounce) both;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.scale-in-bounce {
  animation: scaleInBounce var(--duration-slower) var(--ease-spring) both;
}

@keyframes scaleInBounce {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Stagger Children */
.stagger-children > * {
  animation: slideUp var(--duration-slow) var(--ease-out) both;
}

.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 50ms; }
.stagger-children > *:nth-child(3) { animation-delay: 100ms; }
.stagger-children > *:nth-child(4) { animation-delay: 150ms; }
.stagger-children > *:nth-child(5) { animation-delay: 200ms; }
.stagger-children > *:nth-child(6) { animation-delay: 250ms; }
.stagger-children > *:nth-child(7) { animation-delay: 300ms; }
.stagger-children > *:nth-child(8) { animation-delay: 350ms; }

/* Hover Effects */
.hover-lift {
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.hover-scale {
  transition: transform var(--transition-fast);
}

.hover-scale:hover {
  transform: scale(1.02);
}

.hover-glow {
  transition: box-shadow var(--transition-normal);
}

.hover-glow:hover {
  box-shadow: var(--glow-primary-md);
}

/* Attention Effects */
.pulse-glow {
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: var(--shadow-md);
  }
  50% {
    box-shadow: var(--shadow-md), var(--glow-primary-md);
  }
}

.pulse-border {
  animation: pulseBorder 2s ease-in-out infinite;
}

@keyframes pulseBorder {
  0%, 100% {
    border-color: var(--color-border-default);
  }
  50% {
    border-color: var(--color-primary);
  }
}

/* Shimmer Loading Effect */
.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.05) 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

/* Breathing Effect — More organic than robotic pulse */
.breathe {
  animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% {
    opacity: 0.7;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  }
}

/* Spin for loaders */
.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   7. UTILITY CLASSES — Quick Helpers
   ═══════════════════════════════════════════════════════════════════════════ */

/* Visually Hidden (Accessible) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus Ring */
.focus-ring:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Text Truncation */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Flex Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

/* Gap Utilities */
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Spacing Utilities */
.p-0 { padding: var(--space-0); }
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.px-1 { padding-left: var(--space-1); padding-right: var(--space-1); }
.px-2 { padding-left: var(--space-2); padding-right: var(--space-2); }
.px-3 { padding-left: var(--space-3); padding-right: var(--space-3); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-5 { padding-left: var(--space-5); padding-right: var(--space-5); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }

.py-1 { padding-top: var(--space-1); padding-bottom: var(--space-1); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-3 { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-5 { padding-top: var(--space-5); padding-bottom: var(--space-5); }
.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }

.m-0 { margin: var(--space-0); }
.m-auto { margin: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

/* Typography Utilities */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-md { font-size: var(--text-md); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }

.font-normal { font-weight: var(--weight-normal); }
.font-medium { font-weight: var(--weight-medium); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-bold { font-weight: var(--weight-bold); }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }

.tracking-tight { letter-spacing: var(--tracking-tight); }
.tracking-wide { letter-spacing: var(--tracking-wide); }
.tracking-wider { letter-spacing: var(--tracking-wider); }

.leading-none { line-height: var(--leading-none); }
.leading-tight { line-height: var(--leading-tight); }
.leading-normal { line-height: var(--leading-normal); }
.leading-relaxed { line-height: var(--leading-relaxed); }

/* Color Utilities */
.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-muted { color: var(--color-text-muted); }
.text-accent { color: var(--color-primary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }

/* Background Utilities */
.bg-base { background-color: var(--color-bg-base); }
.bg-raised { background-color: var(--color-bg-raised); }
.bg-elevated { background-color: var(--color-bg-elevated); }
.bg-floating { background-color: var(--color-bg-floating); }

/* Border Utilities */
.border { border: 1px solid var(--color-border-default); }
.border-subtle { border: 1px solid var(--color-border-subtle); }
.border-strong { border: 1px solid var(--color-border-strong); }
.border-none { border: none; }

.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Size Utilities */
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* Position Utilities */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.inset-0 { inset: 0; }

/* Overflow Utilities */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* Cursor Utilities */
.cursor-pointer { cursor: pointer; }
.cursor-grab { cursor: grab; }
.cursor-grabbing { cursor: grabbing; }
.cursor-not-allowed { cursor: not-allowed; }

/* Pointer Events */
.pointer-events-none { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }

/* User Select */
.select-none { user-select: none; }
.select-text { user-select: text; }

/* Z-Index Utilities */
.z-0 { z-index: var(--z-base); }
.z-10 { z-index: var(--z-raised); }
.z-50 { z-index: var(--z-overlay); }
.z-100 { z-index: var(--z-modal); }

/* ═══════════════════════════════════════════════════════════════════════════
   8. SPECIAL COMPONENTS — Thumbnailbuilder Specific
   ═══════════════════════════════════════════════════════════════════════════ */

/* Face Upload Zone */
.upload-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-8);
  background: var(--color-surface-glass-dark);
  border: 2px dashed var(--color-border-default);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition:
    border-color var(--transition-fast),
    background-color var(--transition-fast);
  min-height: 200px;
}

.upload-zone:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-muted);
}

.upload-zone.dragging {
  border-color: var(--color-primary);
  background: var(--color-primary-muted);
  border-style: solid;
}

.upload-zone__icon {
  width: 48px;
  height: 48px;
  color: var(--color-text-tertiary);
  transition: color var(--transition-fast);
}

.upload-zone:hover .upload-zone__icon {
  color: var(--color-primary);
}

.upload-zone__text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-align: center;
}

.upload-zone__hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Style Selector Grid */
.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-3);
}

.style-card {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--color-bg-elevated);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition:
    border-color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

.style-card:hover {
  border-color: var(--color-border-strong);
  transform: scale(1.02);
}

.style-card.selected {
  border-color: var(--color-primary);
  box-shadow: var(--glow-primary-sm);
}

.style-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.style-card__label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-3);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: white;
}

.style-card__check {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  width: 24px;
  height: 24px;
  background: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  transition:
    opacity var(--transition-fast),
    transform var(--transition-bounce);
}

.style-card.selected .style-card__check {
  opacity: 1;
  transform: scale(1);
}

/* Brief Input Card */
.brief-card {
  padding: var(--space-5);
}

.brief-card__label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3);
}

.brief-card__counter {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

/* Generation Progress */
.generation-progress {
  position: relative;
  padding: var(--space-6);
  text-align: center;
}

.generation-progress__spinner {
  width: 64px;
  height: 64px;
  border: 3px solid var(--color-border-subtle);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto var(--space-5);
}

.generation-progress__status {
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.generation-progress__substatus {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

.generation-progress__bar {
  height: 4px;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-full);
  margin-top: var(--space-5);
  overflow: hidden;
}

.generation-progress__fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--color-primary),
    var(--color-accent-purple)
  );
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-out);
}

/* Export Options */
.export-options {
  display: grid;
  gap: var(--space-3);
}

.export-option {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--color-surface-glass-dark);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    border-color var(--transition-fast),
    background-color var(--transition-fast);
}

.export-option:hover {
  border-color: var(--color-border-default);
  background: var(--color-surface-glass);
}

.export-option.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-muted);
}

.export-option__icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
}

.export-option.selected .export-option__icon {
  background: var(--color-primary);
  color: white;
}

.export-option__content {
  flex: 1;
}

.export-option__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
}

.export-option__description {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--color-bg-floating);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-toast);
  animation: slideUp var(--duration-slow) var(--ease-out);
}

.toast--success {
  border-color: var(--color-success);
  background: linear-gradient(
    135deg,
    var(--color-bg-floating),
    var(--color-success-muted)
  );
}

.toast--error {
  border-color: var(--color-error);
  background: linear-gradient(
    135deg,
    var(--color-bg-floating),
    var(--color-error-muted)
  );
}

.toast__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast--success .toast__icon {
  color: var(--color-success);
}

.toast--error .toast__icon {
  color: var(--color-error);
}

.toast__message {
  font-size: var(--text-sm);
  color: var(--color-text-primary);
}

.toast__close {
  padding: var(--space-1);
  color: var(--color-text-tertiary);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.toast__close:hover {
  color: var(--color-text-primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   9. BASE RESET & GLOBAL STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

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

* {
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-base);
  min-height: 100vh;
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  padding: var(--space-3) var(--space-4);
  background: var(--color-primary);
  color: white;
  z-index: var(--z-max);
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
}

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

a:hover {
  color: var(--color-primary-soft);
}

/* Selection styling */
::selection {
  background: var(--color-primary-muted);
  color: var(--color-text-primary);
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border-default);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-border-strong);
}

/* Focus visible for keyboard navigation */
:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   10. THUMBNAIL LOADING COMPONENT — Cinematic Glass Loading State
   ═══════════════════════════════════════════════════════════════════════════ */

/* Container that overlays the preview frame during generation */
.thumbnail-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-glass-dark);
  backdrop-filter: var(--glass-blur-lg);
  -webkit-backdrop-filter: var(--glass-blur-lg);
  border-radius: inherit;
  z-index: var(--z-overlay);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--duration-slow) var(--ease-out),
    visibility var(--duration-slow) var(--ease-out);
}

.thumbnail-loading.active {
  opacity: 1;
  visibility: visible;
}

/* ─────────────────────────────────────────────────────────────────────────
   Metamorphosis Animation Container
   ───────────────────────────────────────────────────────────────────────── */

.thumbnail-loading__metamorphosis {
  position: relative;
  width: 200px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-6);
}

/* Floating blocks that converge into thumbnail shape */
.thumbnail-loading__blocks {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  padding: 8px;
}

.thumbnail-loading__block {
  background: var(--color-surface-glass-light);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-xs);
  opacity: 0;
  transform: translateY(20px) scale(0.8);
  animation: blockFloat 2.5s var(--ease-out) infinite;
}

/* Staggered entrance for blocks */
.thumbnail-loading__block:nth-child(1) { animation-delay: 0ms; }
.thumbnail-loading__block:nth-child(2) { animation-delay: 50ms; }
.thumbnail-loading__block:nth-child(3) { animation-delay: 100ms; }
.thumbnail-loading__block:nth-child(4) { animation-delay: 150ms; }
.thumbnail-loading__block:nth-child(5) { animation-delay: 200ms; }
.thumbnail-loading__block:nth-child(6) { animation-delay: 250ms; }
.thumbnail-loading__block:nth-child(7) { animation-delay: 300ms; }
.thumbnail-loading__block:nth-child(8) { animation-delay: 350ms; }
.thumbnail-loading__block:nth-child(9) { animation-delay: 400ms; }
.thumbnail-loading__block:nth-child(10) { animation-delay: 450ms; }
.thumbnail-loading__block:nth-child(11) { animation-delay: 500ms; }
.thumbnail-loading__block:nth-child(12) { animation-delay: 550ms; }

@keyframes blockFloat {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
  }
  20% {
    opacity: 0.7;
    transform: translateY(-5px) scale(1);
  }
  40% {
    opacity: 1;
    transform: translateY(0) scale(1.05);
  }
  60% {
    opacity: 0.9;
    transform: translateY(-3px) scale(1);
  }
  80% {
    opacity: 0.6;
    transform: translateY(5px) scale(0.95);
  }
  100% {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
  }
}

/* Glowing thumbnail silhouette frame */
.thumbnail-loading__glow-frame {
  position: absolute;
  inset: 0;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-md);
  box-shadow:
    var(--glow-primary-md),
    inset 0 0 30px rgba(255, 85, 0, 0.1);
  opacity: 0;
  animation: glowPulse 2s ease-in-out infinite;
  animation-delay: 0.5s;
}

@keyframes glowPulse {
  0%, 100% {
    opacity: 0.3;
    box-shadow:
      0 0 20px rgba(255, 85, 0, 0.3),
      inset 0 0 20px rgba(255, 85, 0, 0.05);
  }
  50% {
    opacity: 0.8;
    box-shadow:
      0 0 40px rgba(255, 85, 0, 0.5),
      0 0 80px rgba(255, 85, 0, 0.2),
      inset 0 0 40px rgba(255, 85, 0, 0.1);
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   Progress Messages
   ───────────────────────────────────────────────────────────────────────── */

.thumbnail-loading__messages {
  position: relative;
  height: 28px;
  overflow: hidden;
  margin-bottom: var(--space-4);
}

.thumbnail-loading__message {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity var(--duration-normal) var(--ease-out),
    transform var(--duration-normal) var(--ease-out);
}

.thumbnail-loading__message.active {
  opacity: 1;
  transform: translateY(0);
}

.thumbnail-loading__message.exiting {
  opacity: 0;
  transform: translateY(-10px);
}

/* ─────────────────────────────────────────────────────────────────────────
   Progress Bar
   ───────────────────────────────────────────────────────────────────────── */

.thumbnail-loading__progress {
  width: 240px;
  margin-bottom: var(--space-5);
}

.thumbnail-loading__progress-track {
  height: 4px;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.thumbnail-loading__progress-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--color-primary),
    var(--color-accent-purple),
    var(--color-primary)
  );
  background-size: 200% 100%;
  border-radius: var(--radius-full);
  width: 0%;
  transition: width var(--duration-slow) var(--ease-out);
  animation: progressShimmer 2s linear infinite;
}

@keyframes progressShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   Multi-Thumbnail Indicator (Mini Glass Cards)
   ───────────────────────────────────────────────────────────────────────── */

.thumbnail-loading__variants {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.thumbnail-loading__variant-dot {
  width: 36px;
  height: 24px;
  background: var(--color-surface-glass);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  transition:
    border-color var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.thumbnail-loading__variant-dot.active {
  border-color: var(--color-primary);
  background: var(--color-primary-muted);
  color: var(--color-primary);
}

.thumbnail-loading__variant-dot.completed {
  border-color: var(--color-success);
  background: var(--color-success-muted);
  color: var(--color-success);
}

/* ─────────────────────────────────────────────────────────────────────────
   Cancel Button
   ───────────────────────────────────────────────────────────────────────── */

.thumbnail-loading__cancel {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-text-tertiary);
  background: transparent;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition:
    color var(--transition-fast),
    border-color var(--transition-fast),
    background-color var(--transition-fast);
}

.thumbnail-loading__cancel:hover {
  color: var(--color-text-secondary);
  border-color: var(--color-border-default);
  background: var(--color-surface-glass);
}

/* ─────────────────────────────────────────────────────────────────────────
   Error State
   ───────────────────────────────────────────────────────────────────────── */

.thumbnail-loading--error .thumbnail-loading__glow-frame {
  border-color: var(--color-error);
  box-shadow:
    0 0 20px rgba(255, 61, 113, 0.3),
    inset 0 0 20px rgba(255, 61, 113, 0.05);
  animation: none;
  opacity: 1;
}

.thumbnail-loading--error .thumbnail-loading__block {
  animation: none;
  opacity: 0.3;
  background: var(--color-error-muted);
  border-color: rgba(255, 61, 113, 0.3);
}

.thumbnail-loading__error-icon {
  width: 48px;
  height: 48px;
  color: var(--color-error);
  margin-bottom: var(--space-4);
}

.thumbnail-loading__error-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.thumbnail-loading__error-message {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-5);
  text-align: center;
  max-width: 280px;
}

.thumbnail-loading__retry {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: white;
  background: var(--color-error);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    transform var(--transition-fast);
}

.thumbnail-loading__retry:hover {
  background: #E6365F;
  transform: translateY(-1px);
}

/* ─────────────────────────────────────────────────────────────────────────
   Success State
   ───────────────────────────────────────────────────────────────────────── */

.thumbnail-loading--success .thumbnail-loading__glow-frame {
  border-color: var(--color-success);
  box-shadow:
    0 0 30px rgba(0, 214, 143, 0.4),
    inset 0 0 30px rgba(0, 214, 143, 0.1);
  animation: successPulse 0.6s ease-out;
  opacity: 1;
}

@keyframes successPulse {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.thumbnail-loading__success-check {
  width: 64px;
  height: 64px;
  background: var(--color-success);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  animation: successBounce 0.5s var(--ease-bounce);
}

.thumbnail-loading__success-check svg {
  width: 32px;
  height: 32px;
  color: white;
}

@keyframes successBounce {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  60% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   Crossfade Transition (Success → Thumbnail)
   ───────────────────────────────────────────────────────────────────────── */

.thumbnail-loading.fade-out {
  animation: loadingFadeOut var(--duration-slow) var(--ease-out) forwards;
}

@keyframes loadingFadeOut {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.02);
    visibility: hidden;
  }
}

/* The revealed thumbnail zooms slightly */
.preview-frame__image.reveal {
  animation: thumbnailReveal var(--duration-slower) var(--ease-out);
}

@keyframes thumbnailReveal {
  0% {
    opacity: 0;
    transform: scale(0.98);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   Reduced Motion Support
   ───────────────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .thumbnail-loading__block,
  .thumbnail-loading__glow-frame,
  .thumbnail-loading__progress-fill,
  .thumbnail-loading__success-check,
  .thumbnail-loading.fade-out,
  .preview-frame__image.reveal {
    animation: none;
  }

  .thumbnail-loading__block {
    opacity: 0.5;
    transform: none;
  }

  .thumbnail-loading__glow-frame {
    opacity: 0.5;
  }

  .thumbnail-loading__progress-fill {
    background: var(--color-primary);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   END OF CATALYST DESIGN SYSTEM
   ═══════════════════════════════════════════════════════════════════════════ */
