/* ==========================================================================
   Nova Studio AI · Modern Cyber-Luxury Design System
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-primary: #07090e;
  --bg-secondary: #0d111a;
  --bg-tertiary: #131926;
  --bg-card: rgba(19, 25, 38, 0.7);
  --bg-card-hover: rgba(28, 36, 54, 0.85);
  --bg-glass: rgba(13, 17, 26, 0.65);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.35);
  --border-focus: #6366f1;

  /* Accent Colors */
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-secondary: #06b6d4;
  --accent-purple: #a855f7;
  --accent-pink: #ec4899;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #06b6d4 100%);
  --accent-glow: 0 0 25px rgba(99, 102, 241, 0.45);
  --accent-glow-cyan: 0 0 25px rgba(6, 182, 212, 0.45);

  /* Status Colors */
  --status-success: #10b981;
  --status-warning: #f59e0b;
  --status-error: #ef4444;
  --status-info: #3b82f6;

  /* Typography */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #020617;
  --font-sans: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Radii & Shadows */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

  /* Layout */
  --header-height: 72px;
  --sidebar-width: 440px;
}

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

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Background Glow */
.ambient-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-orb-1 {
  position: absolute;
  top: -10%;
  left: 15%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0) 70%);
  filter: blur(80px);
  animation: floatOrb 18s ease-in-out infinite alternate;
}

.glow-orb-2 {
  position: absolute;
  bottom: 5%;
  right: 10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.12) 0%, rgba(6, 182, 212, 0) 70%);
  filter: blur(90px);
  animation: floatOrb 22s ease-in-out infinite alternate-reverse;
}

.glow-orb-3 {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.08) 0%, rgba(168, 85, 247, 0) 70%);
  filter: blur(100px);
}

/* App Container */
.app-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  height: var(--header-height);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--accent-glow);
  color: white;
  font-size: 20px;
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(120deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--accent-secondary);
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* Navigation Tabs */
.header-nav {
  display: flex;
  align-items: center;
  background: rgba(13, 17, 26, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 5px;
  gap: 6px;
}

.nav-tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 22px;
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.nav-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab-btn.active {
  color: #ffffff;
  background: var(--accent-gradient);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.nav-tab-btn .badge-pill {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

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

.api-status-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--status-success);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.api-status-chip:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.4);
}

.api-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--status-success);
  box-shadow: 0 0 8px var(--status-success);
}

.btn-icon-header {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon-header:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-glow);
  transform: translateY(-1px);
}

/* Main Workspace */
.main-content {
  flex: 1;
  display: flex;
  position: relative;
}

.tab-pane {
  display: none;
  width: 100%;
  min-height: calc(100vh - var(--header-height));
  padding: 24px 32px;
  animation: fadeIn 0.35s ease forwards;
}

.tab-pane.active {
  display: flex;
  gap: 28px;
}

/* Layout Grid: Studio Layout (Left Control, Right Canvas/Result) */
.studio-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 28px;
  width: 100%;
  max-width: 1720px;
  margin: 0 auto;
}

/* Controls Panel */
.controls-panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: fit-content;
  box-shadow: var(--shadow-glass);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.panel-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

/* Mode Switchers (Pills) */
.mode-segmented {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  background: rgba(7, 9, 14, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}

.mode-btn {
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  white-space: nowrap;
}

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

.mode-btn.active {
  background: var(--bg-tertiary);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-label-extra {
  font-size: 12px;
  color: var(--text-muted);
}

.prompt-textarea-wrapper {
  position: relative;
}

.prompt-textarea {
  width: 100%;
  min-height: 110px;
  max-height: 220px;
  resize: vertical;
  background: rgba(7, 9, 14, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  outline: none;
  transition: all 0.2s;
}

.prompt-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  background: rgba(7, 9, 14, 0.9);
}

.prompt-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.prompt-chips-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.prompt-chips-scroll::-webkit-scrollbar {
  height: 4px;
}

.prompt-chip {
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.prompt-chip:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  color: #fff;
}

/* Aspect Ratio Cards Grid */
.aspect-ratio-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.ratio-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 6px;
  background: rgba(7, 9, 14, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.ratio-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
}

.ratio-card.active {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}

.ratio-preview-box {
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--text-muted);
  border-radius: 3px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s;
}

.ratio-card.active .ratio-preview-box {
  border-color: var(--accent-primary);
}

.ratio-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.ratio-desc {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Size Buttons */
.size-selector-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.size-btn {
  padding: 8px 6px;
  background: rgba(7, 9, 14, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.size-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.size-btn.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

/* Media Upload Slot / Dropzone */
.dropzone-area {
  border: 1.5px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  background: rgba(7, 9, 14, 0.4);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.dropzone-area:hover, .dropzone-area.dragover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.08);
}

.dropzone-icon {
  font-size: 24px;
  color: var(--accent-secondary);
}

.dropzone-text {
  font-size: 12px;
  color: var(--text-secondary);
}

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

/* Reference Images Grid (for Multi-image & Video Reference) */
.ref-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.ref-thumb-item {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-xs);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.ref-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ref-thumb-delete {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.ref-thumb-delete:hover {
  background: var(--status-error);
}

.ref-thumb-badge {
  position: absolute;
  bottom: 2px;
  left: 2px;
  background: rgba(0, 0, 0, 0.75);
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--accent-secondary);
}

/* Keyframe Dual Upload (First / Last Frame) */
.keyframes-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.keyframe-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Range Slider */
.range-slider-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.custom-range {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  -webkit-appearance: none;
}

.custom-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.7);
  transition: transform 0.15s;
}

.custom-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.range-val-badge {
  min-width: 44px;
  padding: 3px 8px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-xs);
  color: #a5b4fc;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

/* Generate Big Button */
.btn-generate {
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  border: none;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.55);
}

.btn-generate:active {
  transform: translateY(0);
}

.btn-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Canvas / Display Result Area */
.display-panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-height: 600px;
  box-shadow: var(--shadow-glass);
}

.display-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}

.display-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.display-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.display-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-tool {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-tool:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

/* Stage Area (Image Viewport / Video Player / Empty State) */
.stage-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 7, 11, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  min-height: 440px;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  gap: 14px;
}

.empty-icon {
  font-size: 48px;
  opacity: 0.7;
}

.empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 320px;
}

/* Rendered Image Stage */
.rendered-image-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 16px;
}

.rendered-image {
  max-width: 100%;
  max-height: 540px;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  object-fit: contain;
  transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
  cursor: zoom-in;
}

/* Floating Action Overlay on Generated Image */
.floating-overlay-actions {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(13, 17, 26, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
}

.btn-floating-action {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-floating-action:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.btn-floating-action.action-video {
  background: linear-gradient(135deg, #06b6d4, #6366f1);
}

/* Generation Info Bar */
.generation-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(7, 9, 14, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.meta-tags-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.meta-tag {
  font-size: 11px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
}

/* Loading & Progress States */
.generation-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px;
  text-align: center;
}

.spinner-glow {
  width: 56px;
  height: 56px;
  border: 3px solid rgba(99, 102, 241, 0.15);
  border-top-color: var(--accent-primary);
  border-right-color: var(--accent-secondary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: var(--accent-glow);
}

.loading-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.loading-subtext {
  font-size: 12px;
  color: var(--text-muted);
}

/* Video Player Container */
.video-player-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  position: relative;
}

.rendered-video {
  max-width: 100%;
  max-height: 520px;
  border-radius: var(--radius-sm);
  background: #000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
}

/* Video Task Timeline Step Indicator */
.task-timeline {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(13, 17, 26, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
}

.timeline-step {
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0.4;
  transition: all 0.3s;
}

.timeline-step.active {
  opacity: 1;
}

.timeline-step.completed {
  opacity: 0.85;
}

.step-icon-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.timeline-step.active .step-icon-circle {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 12px var(--accent-primary);
}

.timeline-step.completed .step-icon-circle {
  background: var(--status-success);
  border-color: var(--status-success);
}

.step-info {
  display: flex;
  flex-direction: column;
}

.step-title {
  font-size: 13px;
  font-weight: 600;
}

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

/* History Drawer & Modal Dialogs */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.drawer-backdrop.open {
  display: block;
  opacity: 1;
}

.history-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-subtle);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.2, 0, 0, 1);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.7);
}

.drawer-backdrop.open .history-drawer {
  transform: translateX(0);
}

.drawer-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.history-card:hover {
  border-color: var(--border-glow);
  background: var(--bg-card-hover);
}

.history-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  background: #000;
}

.history-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.history-prompt {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

/* Modal Popup (API Key & Lightbox) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  display: flex;
  opacity: 1;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.btn-secondary {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  border: none;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s cubic-bezier(0.2, 0, 0, 1) forwards;
}

.toast.toast-success {
  border-color: rgba(16, 185, 129, 0.4);
}
.toast.toast-error {
  border-color: rgba(239, 68, 68, 0.4);
}

/* Responsive adjustments */
@media (max-width: 1080px) {
  .studio-layout {
    grid-template-columns: 1fr;
  }
  .controls-panel {
    max-width: 100%;
  }
}
