/* =========================================================
   VidCraft AI – Premium Dark Theme
   ========================================================= */

/* ---- Base Reset & Variables ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-base:       #07060f;
  --bg-surface:    #0e0c1a;
  --bg-elevated:   #161329;
  --bg-glass:      rgba(255,255,255,0.04);
  --bg-glass-hover:rgba(255,255,255,0.07);

  --purple-deep:   #3b0f7a;
  --purple:        #7c3aed;
  --purple-mid:    #9d5cff;
  --purple-light:  #c084fc;
  --cyan:          #06b6d4;
  --cyan-light:    #67e8f9;
  --pink:          #ec4899;

  --accent:        #7c3aed;
  --accent-glow:   rgba(124,58,237,0.35);
  --accent-border: rgba(124,58,237,0.25);

  --text-primary:  #f1f0f9;
  --text-secondary:#a094c7;
  --text-muted:    #5a5070;
  --text-disabled: #3a3450;

  --success:       #10b981;
  --success-bg:    rgba(16,185,129,0.12);
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --danger-bg:     rgba(239,68,68,0.12);
  --info:          #3b82f6;

  --border:        rgba(255,255,255,0.06);
  --border-accent: rgba(124,58,237,0.3);
  --border-hover:  rgba(124,58,237,0.5);

  --radius-sm:     8px;
  --radius:        14px;
  --radius-lg:     20px;
  --radius-xl:     28px;

  --shadow-sm:     0 2px 8px rgba(0,0,0,0.4);
  --shadow:        0 8px 32px rgba(0,0,0,0.5);
  --shadow-lg:     0 20px 60px rgba(0,0,0,0.7);
  --shadow-glow:   0 0 40px rgba(124,58,237,0.25);

  --transition:    0.25s cubic-bezier(0.4,0,0.2,1);
  --transition-slow: 0.4s cubic-bezier(0.4,0,0.2,1);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --header-h: 68px;
  --steps-h:  60px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- Animated Background ---- */
.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.15;
  animation: orbFloat 20s ease-in-out infinite;
}

.orb-1 {
  width: 700px; height: 700px;
  background: radial-gradient(circle, #7c3aed, transparent 70%);
  top: -200px; left: -200px;
  animation-duration: 25s;
}
.orb-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #06b6d4, transparent 70%);
  top: 30%; right: -150px;
  animation-duration: 18s;
  animation-delay: -8s;
}
.orb-3 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #ec4899, transparent 70%);
  bottom: -150px; left: 30%;
  animation-duration: 22s;
  animation-delay: -12s;
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 60px 60px;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0,0) scale(1); }
  33%       { transform: translate(60px,-40px) scale(1.1); }
  66%       { transform: translate(-40px,60px) scale(0.9); }
}

/* ---- Container ---- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---- Utilities ---- */
.hidden { display: none !important; }

/* =========================================================
   HEADER
   ========================================================= */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(7,6,15,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-mark {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 0 20px rgba(124,58,237,0.4);
}

.logo-icon { color: white; }

.logo-text-wrap { display: flex; flex-direction: column; }

.logo-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}
.logo-name em {
  font-style: normal;
  background: linear-gradient(90deg, var(--purple-mid), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-tagline {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.header-center { flex: 1; display: flex; justify-content: center; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.api-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 20px;
}

.api-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.api-dot--off  { background: var(--text-muted); }
.api-dot--on   { background: var(--success); box-shadow: 0 0 8px var(--success); animation: pulse 2s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* =========================================================
   BADGES
   ========================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.badge-gemini {
  background: linear-gradient(90deg, rgba(124,58,237,0.2), rgba(6,182,212,0.2));
  border: 1px solid rgba(124,58,237,0.3);
  color: var(--purple-light);
}
.badge-info {
  background: rgba(59,130,246,0.15);
  border: 1px solid rgba(59,130,246,0.25);
  color: #93c5fd;
}
.badge-success {
  background: var(--success-bg);
  border: 1px solid rgba(16,185,129,0.25);
  color: #6ee7b7;
}

/* =========================================================
   STEPS NAV
   ========================================================= */
.steps-nav {
  height: var(--steps-h);
  background: rgba(7,6,15,0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  position: sticky;
  top: var(--header-h);
  z-index: 90;
}

.steps-track {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 0;
  opacity: 0.4;
  transition: opacity var(--transition);
  flex-shrink: 0;
}
.step-item:hover { opacity: 0.7; }
.step-item.active { opacity: 1; }
.step-item.done { opacity: 0.7; }

.step-bubble {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all var(--transition);
  flex-shrink: 0;
}

.step-item.active .step-bubble {
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  border-color: transparent;
  color: white;
  box-shadow: 0 0 20px var(--accent-glow);
}
.step-item.done .step-bubble {
  background: rgba(16,185,129,0.2);
  border-color: rgba(16,185,129,0.4);
  color: var(--success);
}
.step-item.done .step-bubble::before { content: '✓'; }

.step-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}
.step-item.active .step-name { color: var(--text-primary); }

.step-connector {
  flex: 1;
  height: 1px;
  background: var(--border);
  min-width: 20px;
}

/* =========================================================
   MAIN & PANELS
   ========================================================= */
.main {
  padding: 32px 0 80px;
  position: relative;
  z-index: 1;
}

.panel {
  background: rgba(14,12,26,0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-lg);
  animation: panelIn 0.4s var(--transition-slow) both;
}

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

.panel-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 32px;
}

.panel-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(6,182,212,0.2));
  border: 1px solid var(--border-accent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

.panel-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.panel-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  gap: 16px;
}

.panel-hint {
  font-size: 13px;
  color: var(--text-muted);
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.2s;
}
.btn:hover::before { background: rgba(255,255,255,0.07); }
.btn:active { transform: scale(0.97); }

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple), #5b21b6);
  color: white;
  box-shadow: 0 4px 20px rgba(124,58,237,0.35);
}
.btn-primary:hover {
  box-shadow: 0 6px 28px rgba(124,58,237,0.55);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border-accent); }

.btn-outline {
  background: transparent;
  color: var(--purple-light);
  border: 1px solid var(--border-accent);
}
.btn-outline:hover {
  background: rgba(124,58,237,0.1);
  border-color: var(--border-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-glass); }

.btn-danger {
  background: rgba(239,68,68,0.2);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.3); }

.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
  box-shadow: 0 4px 20px rgba(16,185,129,0.3);
}
.btn-success:hover { box-shadow: 0 6px 28px rgba(16,185,129,0.5); transform: translateY(-1px); }

.btn-ai {
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  color: white;
  padding: 12px 28px;
  font-size: 15px;
  box-shadow: 0 6px 30px rgba(124,58,237,0.4);
}
.btn-ai:hover {
  box-shadow: 0 8px 40px rgba(124,58,237,0.65);
  transform: translateY(-2px);
}

.btn-export {
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  font-size: 16px;
  padding: 14px 28px;
  box-shadow: 0 6px 30px rgba(236,72,153,0.35);
}
.btn-export:hover {
  box-shadow: 0 8px 40px rgba(236,72,153,0.55);
  transform: translateY(-2px);
}

.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-xs { padding: 4px 10px; font-size: 11px; }
.btn-full { width: 100%; }

.btn-sparkle { animation: sparkleRotate 3s linear infinite; display: inline-block; }
@keyframes sparkleRotate {
  0%  { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* =========================================================
   FORM ELEMENTS
   ========================================================= */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}
.required { color: var(--pink); margin-left: 3px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.text-input, .select-input, .textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  width: 100%;
}
.text-input:focus, .select-input:focus, .textarea:focus {
  border-color: var(--purple-mid);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}
.text-input::placeholder, .textarea::placeholder { color: var(--text-muted); }

.textarea { resize: vertical; line-height: 1.6; }

.select-input { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23a094c7' viewBox='0 0 16 16'%3E%3Cpath d='M7.293 11.293a1 1 0 001.414 0l4-4a1 1 0 00-1.414-1.414L8 9.172 4.707 5.879a1 1 0 00-1.414 1.414l4 4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

.select-input option { background: var(--bg-elevated); }

.char-count {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(124,58,237,0.5);
  border: 2px solid var(--bg-base);
}
.slider::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  cursor: pointer;
  border: 2px solid var(--bg-base);
}

.slider-value {
  float: right;
  font-size: 13px;
  color: var(--purple-light);
  font-weight: 600;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* =========================================================
   STEP 1 – UPLOAD
   ========================================================= */
.upload-zone {
  border: 2px dashed rgba(124,58,237,0.35);
  border-radius: var(--radius-lg);
  padding: 60px 40px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-glass);
  position: relative;
  overflow: hidden;
}
.upload-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(124,58,237,0.05), transparent 70%);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--purple-mid);
  background: rgba(124,58,237,0.06);
  transform: scale(1.005);
  box-shadow: var(--shadow-glow);
}

.upload-zone-inner { position: relative; z-index: 1; }

.upload-animation { margin-bottom: 20px; }

.upload-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px; height: 80px;
  background: linear-gradient(135deg, rgba(124,58,237,0.15), rgba(6,182,212,0.15));
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  font-size: 36px;
  position: relative;
  animation: uploadBounce 3s ease-in-out infinite;
}

.upload-plus {
  position: absolute;
  bottom: -6px; right: -6px;
  width: 22px; height: 22px;
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: white;
  font-weight: 700;
  border: 2px solid var(--bg-surface);
}

@keyframes uploadBounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.upload-zone h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}
.upload-zone p { font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; }

.upload-formats { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }

.format-tag {
  padding: 3px 10px;
  background: rgba(124,58,237,0.1);
  border: 1px solid var(--border-accent);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--purple-light);
  letter-spacing: 0.5px;
}

.upload-limit { font-size: 11px; color: var(--text-muted); }

/* Clips Grid */
.clips-section { margin-top: 32px; }

.clips-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.clips-header h3 {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.clips-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px; height: 22px;
  background: var(--purple);
  color: white;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 700;
  padding: 0 6px;
}

.clips-info {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.clips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

/* Clip Card */
.clip-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  cursor: grab;
  position: relative;
  animation: clipIn 0.3s ease both;
}
.clip-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
  transform: translateY(-3px);
}
.clip-card:active { cursor: grabbing; }

@keyframes clipIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

.clip-thumb {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: var(--bg-base);
  overflow: hidden;
}

.clip-thumb canvas, .clip-thumb video {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

.clip-thumb-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(0,0,0,0.7) 100%);
  display: flex;
  align-items: flex-end;
  padding: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}
.clip-card:hover .clip-thumb-overlay { opacity: 1; }

.clip-duration {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0,0,0,0.75);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

.clip-order {
  position: absolute;
  top: 8px; left: 8px;
  width: 22px; height: 22px;
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  color: white;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clip-info {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.clip-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.clip-delete {
  width: 26px; height: 26px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s;
  flex-shrink: 0;
}
.clip-delete:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.drag-hint { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 16px; }

/* Sortable ghost */
.sortable-ghost { opacity: 0.3; border: 2px dashed var(--purple-mid); }
.sortable-chosen { cursor: grabbing; box-shadow: 0 10px 40px rgba(0,0,0,0.6); }

/* =========================================================
   STEP 2 – CONFIGURE
   ========================================================= */
.config-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 28px;
}

.platform-pills { display: flex; flex-wrap: wrap; gap: 8px; }

.pill-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.pill-check input { display: none; }
.pill-check:hover { border-color: var(--border-accent); color: var(--purple-light); }
.pill-check.active {
  background: rgba(124,58,237,0.15);
  border-color: var(--border-accent);
  color: var(--purple-light);
}

.ai-info-card {
  background: linear-gradient(135deg, rgba(124,58,237,0.1), rgba(6,182,212,0.1));
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
}

.ai-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.ai-card-icon {
  font-size: 24px;
  animation: sparkleRotate 4s linear infinite;
}

.ai-info-card h3 { font-size: 16px; font-weight: 700; }

.ai-info-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

.ai-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.ai-stat-item {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
}

.ai-stat-value {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(90deg, var(--purple-mid), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ai-stat-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.ai-features { display: flex; flex-direction: column; gap: 7px; }

.ai-feature {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tips-card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.tips-card h4 { font-size: 13px; font-weight: 700; margin-bottom: 12px; color: var(--text-secondary); }
.tips-card ul { padding-left: 16px; }
.tips-card li { font-size: 12px; color: var(--text-muted); line-height: 1.7; }

/* =========================================================
   STEP 3 – SCRIPT & DUBBING
   ========================================================= */
.script-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
}

.script-editor-panel { display: flex; flex-direction: column; }

.script-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  flex-wrap: wrap;
  gap: 8px;
}

.script-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.script-actions { display: flex; gap: 6px; }

.script-textarea {
  flex: 1;
  min-height: 280px;
  resize: vertical;
  line-height: 1.8;
  font-size: 15px;
  border-radius: 0;
  border-top: none;
  border-bottom: none;
}

.subtitle-preview-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.subtitle-preview-label { font-size: 11px; color: var(--text-muted); font-weight: 600; white-space: nowrap; }

.subtitle-preview-text {
  font-size: 14px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8), 0 0 2px black;
  flex: 1;
}

/* Voice Panel */
.voice-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.voice-panel-inner {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100%;
  overflow-y: auto;
  max-height: 700px;
}

.voice-panel-title { font-size: 16px; font-weight: 700; margin-bottom: 20px; }

.tts-model-select { display: flex; flex-direction: column; gap: 8px; }

.model-option { cursor: pointer; }
.model-option input { display: none; }

.model-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.model-card:hover { border-color: var(--border-accent); }
.model-option.active .model-card {
  background: rgba(124,58,237,0.12);
  border-color: var(--purple-mid);
}

.model-icon { font-size: 20px; }
.model-name { font-size: 13px; font-weight: 700; }
.model-desc { font-size: 11px; color: var(--text-muted); }
.model-badge {
  margin-left: auto;
  padding: 2px 8px;
  background: linear-gradient(90deg, rgba(124,58,237,0.3), rgba(6,182,212,0.3));
  border: 1px solid var(--border-accent);
  border-radius: 10px;
  font-size: 9px;
  font-weight: 700;
  color: var(--cyan-light);
  letter-spacing: 0.3px;
}

/* Audio Visualizer */
.audio-viz {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 40px;
  margin: 16px 0;
  opacity: 0.3;
  transition: opacity 0.3s;
}
.audio-viz.active { opacity: 1; }

.viz-bar {
  width: 5px;
  background: linear-gradient(to top, var(--purple), var(--cyan));
  border-radius: 3px;
  height: 4px;
  transition: height 0.1s;
}
.audio-viz.active .viz-bar { animation: vizAnim 0.8s ease-in-out infinite; }
.viz-bar:nth-child(1)  { animation-delay: 0.0s; }
.viz-bar:nth-child(2)  { animation-delay: 0.1s; }
.viz-bar:nth-child(3)  { animation-delay: 0.2s; }
.viz-bar:nth-child(4)  { animation-delay: 0.3s; }
.viz-bar:nth-child(5)  { animation-delay: 0.4s; }
.viz-bar:nth-child(6)  { animation-delay: 0.3s; }
.viz-bar:nth-child(7)  { animation-delay: 0.2s; }
.viz-bar:nth-child(8)  { animation-delay: 0.1s; }
.viz-bar:nth-child(9)  { animation-delay: 0.0s; }
.viz-bar:nth-child(10) { animation-delay: 0.05s; }

@keyframes vizAnim {
  0%, 100% { height: 4px; }
  50%       { height: 32px; }
}

.preview-controls { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

/* =========================================================
   STEP 4 – EXPORT
   ========================================================= */
.export-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 32px;
  align-items: start;
}

.preview-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.canvas-device-frame {
  background: #1a1a2e;
  border: 2px solid var(--border-accent);
  border-radius: 24px;
  padding: 12px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  position: relative;
}

.canvas-phone-top {
  width: 60px; height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin: 0 auto 10px;
}

.canvas-container {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  width: 270px;
  height: 480px;
}

#mainCanvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.canvas-idle-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}

.idle-content { text-align: center; }
.idle-icon { font-size: 40px; margin-bottom: 8px; }
.idle-content p { font-size: 12px; color: var(--text-muted); }

.video-controls-bar {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vc-progress {
  height: 3px;
  background: var(--bg-glass);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
}
.vc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--cyan));
  width: 0%;
  transition: width 0.1s linear;
  border-radius: 2px;
}

.vc-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vc-btn {
  width: 28px; height: 28px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.2s;
}
.vc-btn:hover { background: rgba(124,58,237,0.15); border-color: var(--border-accent); }

.vc-time {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}
.vc-sep { color: var(--text-muted); }
.vc-spacer { flex: 1; }

/* Export Settings Panel */
.export-settings-panel { display: flex; flex-direction: column; gap: 20px; }

.settings-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.settings-title { font-size: 16px; font-weight: 700; margin-bottom: 20px; }

.color-options { display: flex; gap: 8px; }
.color-opt { cursor: pointer; }
.color-opt input { display: none; }
.color-opt span {
  display: block;
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 2px solid transparent;
  transition: all 0.2s;
}
.color-opt.active span, .color-opt:has(input:checked) span {
  border-color: var(--purple-mid);
  box-shadow: 0 0 10px rgba(124,58,237,0.5);
}

.export-actions-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.export-progress-area {
  margin-top: 8px;
}

.export-progress-bar {
  height: 6px;
  background: var(--bg-glass);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.export-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--cyan));
  width: 0%;
  transition: width 0.3s;
  border-radius: 3px;
  animation: progressShimmer 2s linear infinite;
}
@keyframes progressShimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.export-progress-text {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
}

.export-results { display: flex; flex-direction: column; gap: 8px; }

.export-success-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: var(--success-bg);
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--success);
}

/* =========================================================
   MODAL
   ========================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay:not(.hidden) {
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-xl);
  padding: 40px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
  position: relative;
}
.modal-overlay:not(.hidden) .modal-card {
  animation: modalIn 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  line-height: 1;
}
.modal-close-btn:hover {
  background: var(--danger-bg);
  border-color: rgba(239,68,68,0.3);
  color: var(--danger);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.85) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-icon { font-size: 48px; margin-bottom: 16px; display: block; }
.modal-card h2 { font-size: 22px; font-weight: 800; margin-bottom: 10px; }
.modal-card p  { font-size: 14px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 20px; }

.form-group { position: relative; }

.show-pass-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.show-pass-btn:hover { opacity: 1; }

.modal-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 24px;
  text-align: left;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

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

/* =========================================================
   LOADING OVERLAY
   ========================================================= */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7,6,15,0.9);
  backdrop-filter: blur(10px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.loading-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-xl);
  max-width: 320px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.loading-ring {
  width: 80px; height: 80px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-ring-inner {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--purple);
  border-right-color: var(--cyan);
  animation: spin 1s linear infinite;
}

.loading-ai-icon {
  font-size: 32px;
  animation: sparkleRotate 3s linear infinite;
}

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

.loading-card h3 { font-size: 18px; font-weight: 700; }
.loading-card p  { font-size: 13px; color: var(--text-secondary); }

.loading-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-glass);
  border-radius: 2px;
  overflow: hidden;
}
.loading-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--cyan));
  width: 0%;
  transition: width 0.3s;
  border-radius: 2px;
}

/* =========================================================
   TOAST
   ========================================================= */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 280px;
  max-width: 400px;
  pointer-events: all;
  animation: toastIn 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
  border-left: 3px solid var(--border);
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error   { border-left-color: var(--danger); }
.toast.toast-info    { border-left-color: var(--info); }
.toast.toast-warning { border-left-color: var(--warning); }

.toast.hide { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(50px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(60px); pointer-events: none; }
}

.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-msg  { font-size: 13px; font-weight: 500; line-height: 1.5; }

/* =========================================================
   SCROLLBAR
   ========================================================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb {
  background: rgba(124,58,237,0.3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(124,58,237,0.6); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
  .config-layout, .script-layout { grid-template-columns: 1fr; }
  .export-layout { grid-template-columns: 1fr; }
  .preview-area { align-items: center; }
  .canvas-container { width: 240px; height: 426px; }
}

@media (max-width: 640px) {
  .panel { padding: 24px 20px; }
  .panel-title { font-size: 20px; }
  .form-row { grid-template-columns: 1fr; }
  .header-inner { gap: 8px; }
  .logo-tagline, .header-center { display: none; }
  .steps-track { gap: 0; }
  .step-name { display: none; }
  .clips-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* =========================================================
   TRIM MODAL
   ========================================================= */
.trim-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(12px);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.trim-overlay:not(.hidden) { animation: fadeIn 0.2s ease; }
.trim-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 860px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(124,58,237,0.2);
  display: flex;
  flex-direction: column;
}
.trim-overlay:not(.hidden) .trim-card { animation: modalIn 0.3s cubic-bezier(0.34,1.56,0.64,1) both; }
.trim-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.trim-header-left { display: flex; align-items: center; gap: 14px; }
.trim-icon { font-size: 28px; }
.trim-header h3 { font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.trim-clip-name { font-size: 12px; color: var(--text-muted); }
.trim-video-section {
  display: grid;
  grid-template-columns: 1fr 100px;
  gap: 20px;
  padding: 20px 24px;
  align-items: center;
  background: rgba(0,0,0,0.25);
  border-bottom: 1px solid var(--border);
}
.trim-video-wrap {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16/9;
}
#trimVideo { width: 100%; height: 100%; object-fit: contain; display: block; }
.trim-video-time {
  position: absolute;
  bottom: 8px; right: 8px;
  background: rgba(0,0,0,0.75);
  color: white;
  padding: 3px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(4px);
}
.trim-frame-nav { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.trim-play-btn {
  width: 50px; height: 50px;
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  border: none; border-radius: 50%;
  color: white; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(124,58,237,0.4);
}
.trim-play-btn:hover { transform: scale(1.1); box-shadow: 0 6px 24px rgba(124,58,237,0.6); }
.trim-frame-btn {
  padding: 5px 8px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 10px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  white-space: nowrap; font-family: var(--font);
  width: 100%; text-align: center;
}
.trim-frame-btn:hover { background: rgba(124,58,237,0.15); border-color: var(--border-accent); color: var(--text-primary); }
.trim-timeline-section { padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; }
.trim-timeline-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); }
.trim-timeline-label strong { color: var(--purple-light); }
.trim-track-wrap {
  position: relative;
  height: 56px;
  border: 2px solid var(--border-accent);
  border-radius: 6px;
  overflow: hidden;
}
.trim-thumb-strip { position: absolute; top:0; left:0; width:100%; height:100%; display:block; background: var(--bg-base); }
.trim-shade {
  position: absolute; top:0; bottom:0;
  background: rgba(0,0,0,0.72);
  pointer-events: none; z-index: 2;
}
.trim-shade-left  { left: 0; width: 0%; }
.trim-shade-right { right: 0; width: 0%; }
.trim-position-needle {
  position: absolute; top:0; bottom:0;
  width: 2px; background: white; left: 0%;
  z-index: 4; pointer-events: none;
  box-shadow: 0 0 6px rgba(255,255,255,0.8);
}
.trim-range {
  position: absolute; inset:0;
  width: 100%; height: 100%;
  -webkit-appearance: none; appearance: none;
  background: transparent; cursor: pointer;
  z-index: 5; outline: none; margin: 0;
  pointer-events: none;
}
.trim-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 64px;
  border-radius: 3px; cursor: ew-resize;
  pointer-events: all;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
.trim-range-start::-webkit-slider-thumb { background: var(--purple-mid); }
.trim-range-end::-webkit-slider-thumb   { background: var(--cyan); }
.trim-range::-webkit-slider-runnable-track { background: transparent; height: 100%; }
.trim-range::-moz-range-thumb {
  width: 12px; height: 64px;
  border-radius: 3px; cursor: ew-resize;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.6);
  pointer-events: all;
}
.trim-range-start::-moz-range-thumb { background: var(--purple-mid); }
.trim-range-end::-moz-range-thumb   { background: var(--cyan); }
.trim-range::-moz-range-track { background: transparent; }
.trim-shortcut-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.trim-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  gap: 12px; flex-wrap: wrap; flex-shrink: 0;
}
.trim-result-info { font-size: 13px; color: var(--text-secondary); flex: 1; }
.trim-footer-btns { display: flex; gap: 10px; }
.clip-trim-badge {
  position: absolute; bottom: 6px; left: 6px;
  background: rgba(124,58,237,0.9); color: white;
  padding: 2px 7px; border-radius: 4px;
  font-size: 9px; font-weight: 700;
  backdrop-filter: blur(4px); z-index: 3;
}
.clip-trim-btn {
  width: 26px; height: 26px;
  background: rgba(124,58,237,0.12);
  border: 1px solid var(--border-accent);
  border-radius: 6px; color: var(--purple-light);
  font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; flex-shrink: 0;
}
.clip-trim-btn:hover { background: rgba(124,58,237,0.3); }
@media (max-width: 640px) {
  .trim-video-section { grid-template-columns: 1fr; }
  .trim-frame-nav { flex-direction: row; flex-wrap: wrap; justify-content: center; }
}
