/* ==========================================================================
   AI Video Maker - Mongolian UI Stylesheet
   Modern Cyber-Dark Theme with Glassmorphism & High-Contrast Cyrillic Fonts
   ========================================================================== */

:root {
  --bg-primary: #0a0d14;
  --bg-surface: #111726;
  --bg-surface-elevated: #182238;
  --bg-surface-hover: #1f2b47;
  --bg-glass: rgba(17, 23, 38, 0.75);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(59, 130, 246, 0.3);
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-glow: rgba(59, 130, 246, 0.35);
  
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-gold: #f59e0b;
  --accent-rose: #f43f5e;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Montserrat', var(--font-sans);
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/*
 * HTML-ийн `hidden` атрибутыг хүчинтэй болгоно.
 *
 * Хөтчийн үндсэн дүрэм нь `display: none` боловч бидний өөрсдийн
 * `display: flex` зэрэг дүрэм түүнийг дардаг. Үүнээс болж `hidden`
 * тавьсан элемент харагдсаар байдаг байв.
 */
[hidden] { display: none !important; }

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Background Ambient Glows */
.glow-sphere {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
}
.sphere-1 {
  width: 500px;
  height: 500px;
  top: -100px;
  left: -100px;
  background: radial-gradient(circle, var(--accent-purple), transparent 70%);
}
.sphere-2 {
  width: 600px;
  height: 600px;
  bottom: -150px;
  right: -100px;
  background: radial-gradient(circle, var(--primary), transparent 70%);
}

/* ==========================================================================
   NAVIGATION BAR
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
}

.nav-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  font-size: 1.8rem;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.72rem;
  color: var(--accent-cyan);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.credits-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  color: #34d399;
  font-weight: 600;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
}

/* Нэвтэрсэн хэрэглэгчийн хаяг ба гарах товч */
.user-menu {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.user-menu[hidden] { display: none; }

.user-email {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 600;
  color: #cbd5e1;
  padding: 0.4rem 0.85rem;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: var(--radius-full);
}

.btn-logout {
  padding: 0.45rem 0.9rem;
  font-size: 0.8rem;
  color: #cbd5e1;
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.3);
}
.btn-logout:hover {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.08);
}

@media (max-width: 720px) {
  .user-email { max-width: 120px; }
}

/* ==========================================================================
   BUTTONS & BADGES
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: white;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #6d28d9);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-surface-hover);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #059669, #10b981);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
}
.btn-success:hover {
  background: linear-gradient(135deg, #047857, #059669);
  transform: translateY(-1px);
}

.btn-warning {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #111827;
  font-weight: 700;
}
.btn-warning:hover {
  background: linear-gradient(135deg, #b45309, #d97706);
}

.btn-qpay {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: white;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.3);
}
.btn-qpay:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  transform: translateY(-1px);
}

.btn-block { width: 100%; }
.btn-lg { padding: 0.9rem 1.5rem; font-size: 1rem; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}
.badge-success { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-info { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }

/* ==========================================================================
   STEPS PROGRESS BAR
   ========================================================================== */
.steps-nav {
  /* .app-layout already caps the width and adds the side gutter */
  margin: 1.5rem 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 10;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  opacity: 0.5;
  transition: var(--transition);
}

.step-item:hover, .step-item.active {
  opacity: 1;
}

.step-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  border: 2px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: var(--transition);
}

.step-item.active .step-circle {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-color: #60a5fa;
  color: white;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.step-item.completed .step-circle {
  background: #10b981;
  border-color: #34d399;
  color: white;
}

.step-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.step-item.active .step-label {
  color: var(--text-primary);
}

.step-line {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0 0.75rem;
}

/* The five Mongolian step labels cannot fit side by side on small screens,
   so the strip scrolls sideways instead of overflowing the page. */
@media (max-width: 860px) {
  .steps-nav {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
  }
  .step-item {
    flex: 0 0 auto;
  }
  .step-circle {
    flex: 0 0 auto;
  }
  .step-label {
    white-space: nowrap;
  }
  .step-line {
    flex: 0 0 24px;
    margin: 0 0.5rem;
  }
}

/* ==========================================================================
   APP LAYOUT & WORKSPACE GRID
   ========================================================================== */
.app-layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
  position: relative;
  z-index: 10;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* Grid/flex items default to min-width:auto, so any wide child (timeline blocks,
   long titles) can push a column past the 1440px container. Let them shrink. */
.workspace-grid > * {
  min-width: 0;
}

@media (max-width: 1024px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   PANELS & CARDS
   ========================================================================== */
.panel-left, .panel-right {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.panel-left > *, .panel-right > * {
  min-width: 0;
}

.step-section {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.step-section.active {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header h2 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.section-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

/* ==========================================================================
   FORM CONTROLS & INPUTS
   ========================================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: rgba(10, 13, 20, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.65rem 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: var(--transition);
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(10, 13, 20, 0.9);
}

.form-textarea {
  resize: vertical;
  line-height: 1.5;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.col {
  flex: 1;
}

/* Preset Chips */
.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  transition: var(--transition);
}

.chip:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--primary);
}

/* Drag and Drop Zone */
.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: rgba(10, 13, 20, 0.4);
}

.dropzone:hover, .dropzone.drag-over {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.05);
}

.drop-icon {
  font-size: 2rem;
  margin-bottom: 0.3rem;
}

.drop-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.drop-subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.file-hidden {
  display: none;
}

/* Uploaded Previews & PDF Box */
.upload-status-box {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-top: 0.5rem;
}

.uploaded-previews {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  margin-top: 0.5rem;
  padding-bottom: 0.3rem;
}

.thumb-preview {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.pdf-extracted-box {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-top: 0.5rem;
}

.pdf-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: #34d399;
  margin-bottom: 0.4rem;
}

.pdf-box-content {
  max-height: 80px;
  overflow-y: auto;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  white-space: pre-line;
}

/* Checkbox and Slider */
.checkbox-group {
  margin-bottom: 0.5rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.86rem;
  cursor: pointer;
}

.slider-header {
  display: flex;
  justify-content: space-between;
}

.slider-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.form-range {
  width: 100%;
  accent-color: var(--primary);
}

.btn-group-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.5rem;
}

/* ==========================================================================
   SCENE EDITOR CARDS (STEP 2)
   ========================================================================== */
.scenes-editor-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 0.3rem;
}

.scene-edit-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.scene-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.scene-num-badge {
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   POSTER EDITOR (STEP 3)
   ========================================================================== */
.toggle-tabs {
  display: flex;
  gap: 0.5rem;
  background: rgba(10, 13, 20, 0.6);
  padding: 0.3rem;
  border-radius: var(--radius-sm);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn.active {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.scene-nav-pills {
  display: flex;
  gap: 0.3rem;
}

.scene-pill-btn {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.scene-pill-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Theme Selector */
.theme-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.theme-option input { display: none; }

.theme-pill {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
}

.theme-cyber { background: linear-gradient(135deg, #1e1b4b, #312e81); color: #c084fc; border-color: #818cf8; }
.theme-luxury { background: linear-gradient(135deg, #262626, #404040); color: #fbbf24; border-color: #d97706; }
.theme-vibrant { background: linear-gradient(135deg, #881337, #be123c); color: #fda4af; border-color: #fb7185; }
.theme-ocean { background: linear-gradient(135deg, #0c4a6e, #0369a1); color: #38bdf8; border-color: #0284c7; }
.theme-emerald { background: linear-gradient(135deg, #064e3b, #047857); color: #6ee7b7; border-color: #10b981; }

.theme-option input:checked + .theme-pill {
  box-shadow: 0 0 12px currentColor;
  transform: scale(1.05);
}

/* ==========================================================================
   ALIGNMENT & TIMING ENGINE (STEP 4)
   ========================================================================== */
.mode-selection-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.mode-box {
  background: rgba(10, 13, 20, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  transition: var(--transition);
}

.mode-box input {
  margin-top: 0.2rem;
  accent-color: var(--primary);
}

.mode-box.active {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.08);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

.mode-box-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.mode-box-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* --- Видеоны хэлбэр сонгох (16:9 / 9:16) --- */
.format-grid .mode-box-content {
  width: 100%;
}

.format-shape {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--primary);
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--text-secondary);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.shape-landscape {
  width: 64px;
  height: 36px;
}

.shape-portrait {
  width: 30px;
  height: 53px;
}

.mode-box.active .format-shape {
  background: rgba(59, 130, 246, 0.3);
  color: var(--text-primary);
}

.form-hint {
  margin-top: 0.4rem;
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.timing-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

.timing-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.timing-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 13, 20, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  gap: 0.75rem;
}

.timing-item-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
}

.timing-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background: #1e293b;
  color: #94a3b8;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}

.timing-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.timing-duration-adjust {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dur-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  width: 26px;
  height: 26px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
}
.dur-btn:hover { background: var(--bg-surface-hover); }

.dur-val {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent-cyan);
  min-width: 48px;
  text-align: center;
}

/* ==========================================================================
   EXPORT ACTIONS & PROGRESS BOX (STEP 5)
   ========================================================================== */
.export-actions-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.render-progress-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.spinner-ring {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress-text {
  font-size: 0.88rem;
  color: #bfdbfe;
  font-weight: 500;
}

.render-success-box {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.success-icon { font-size: 2.2rem; }
.success-title { font-weight: 700; font-size: 1.05rem; color: #34d399; }
.success-meta { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.5rem; }

/* ==========================================================================
   VIDEO PLAYER CANVAS & INTERACTIVE TIMELINE (RIGHT PANEL)
   ========================================================================== */
.player-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.player-aspect {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.8);
}

/* Босоо (Reels) горимд тоглуулагч 9:16 болж, дэлгэцэнд багтахаар нарийсна */
.player-aspect.portrait {
  aspect-ratio: 9 / 16;
  max-width: min(340px, 52vh);
  margin-inline: auto;
}

#videoCanvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* Instagram-ийн доод талын товч, тайлбарын бүсээс дээш — рендертэй ижил */
.player-aspect.portrait .subtitle-overlay {
  bottom: 17%;
}

.subtitle-overlay {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  padding: 0 1rem;
  pointer-events: none;
  z-index: 20;
}

.subtitle-pill {
  background: rgba(0, 0, 0, 0.82);
  color: #ffffff;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  max-width: 85%;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  transition: all 0.15s ease;
}

.player-overlay-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  background: rgba(15, 23, 42, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.6rem;
  cursor: pointer;
  transition: var(--transition);
  opacity: 0.85;
}

.player-overlay-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: translate(-50%, -50%) scale(1.1);
  opacity: 1;
}

.current-slide-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Controls Bar */
.player-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding: 0.4rem 0.2rem;
}

.ctrl-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.ctrl-btn:hover { background: var(--bg-surface-hover); }

.time-display {
  font-family: monospace;
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.spacer { flex: 1; }

/* Interactive Timeline Track */
.timeline-wrapper {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  margin-bottom: 0.4rem;
}

.timeline-title { font-weight: 700; color: var(--text-secondary); }
.timeline-hint { color: var(--text-muted); }

.timeline-track {
  position: relative;
  height: 72px;
  background: rgba(10, 13, 20, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
}

.timeline-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  z-index: 30;
  pointer-events: none;
}

.timeline-slides {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  min-width: 0;
}

.timeline-empty-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.timeline-block {
  position: relative;
  height: 100%;
  min-width: 0;
  border-right: 2px solid var(--bg-primary);
  background: rgba(30, 41, 59, 0.8);
  overflow: hidden;
  transition: background 0.15s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.35rem 0.5rem;
}

.timeline-block:hover {
  background: rgba(59, 130, 246, 0.25);
}

.timeline-block.active {
  background: rgba(59, 130, 246, 0.4);
  border-top: 2px solid #60a5fa;
}

.timeline-block-title {
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-block-dur {
  font-size: 0.68rem;
  font-weight: 600;
  color: #93c5fd;
  font-family: monospace;
}

/* Script Preview Card */
.script-preview-card {
  margin-top: 0.5rem;
}

.script-box {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #e2e8f0;
  background: rgba(10, 13, 20, 0.6);
  padding: 1rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
  min-height: 70px;
}

/* ==========================================================================
   QPAY & PAYLINK PAYMENT MODAL
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.1rem;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}
.modal-close:hover { color: white; }

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Package Tabs */
.package-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.package-tab {
  background: rgba(10, 13, 20, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.4rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.package-tab.active {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.15);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.25);
}

.pkg-name { font-size: 0.78rem; font-weight: 700; color: var(--text-primary); }
.pkg-price { font-size: 0.95rem; font-weight: 800; color: var(--accent-cyan); margin: 0.2rem 0; }
.pkg-desc { font-size: 0.68rem; color: var(--text-muted); }

/* QR Code Section */
.qpay-qr-container {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.qr-box {
  position: relative;
  width: 130px;
  height: 130px;
  background: white;
  border-radius: var(--radius-sm);
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.qr-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-spinner {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.9);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: white;
  gap: 0.4rem;
  border-radius: var(--radius-sm);
}

.qr-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.qr-amount-label { font-size: 0.8rem; color: var(--text-secondary); }
.qr-amount-value { font-size: 1.4rem; font-weight: 800; color: #10b981; }
.qr-invoice-id { font-size: 0.75rem; color: var(--text-muted); font-family: monospace; }
.qr-timer { font-size: 0.78rem; color: var(--accent-gold); font-weight: 600; margin-top: 0.3rem; }

/* Bank Badges */
.bank-section-title { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.5rem; }
.bank-badges-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}

.bank-pill {
  background: rgba(10, 13, 20, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  color: #e2e8f0;
}

.test-payment-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.test-payment-text { font-size: 0.8rem; color: #fde68a; }

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 2000;
}

.toast {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toastIn 0.25s ease;
}

.toast-success { border-color: #10b981; }
.toast-error { border-color: #ef4444; }
.toast-info { border-color: #3b82f6; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }

/* --- Дуу хоолой ба слайдын тохиргооны тайлбар --- */
.field-note {
  font-size: 0.78rem;
  line-height: 1.5;
  color: #94a3b8;
  margin: 0.4rem 0 0;
}

/* Нэг үзэгдэлд хамаарах слайдуудыг цагийн шугам дээр өнгөөр бүлэглэнэ */
.timeline-block[data-scene="0"] { border-top: 3px solid #3b82f6; }
.timeline-block[data-scene="1"] { border-top: 3px solid #a855f7; }
.timeline-block[data-scene="2"] { border-top: 3px solid #10b981; }
.timeline-block[data-scene="3"] { border-top: 3px solid #f59e0b; }
.timeline-block[data-scene="4"] { border-top: 3px solid #ef4444; }

/* ==========================================================================
   ПОСТЕР ДОТОРХ ХЭРЭГЛЭГЧИЙН ЗУРАГ (STEP 3)
   ========================================================================== */
.photo-embed-group {
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
  padding-top: 0.9rem;
}

.mt-sm { margin-top: 0.75rem; }

.photo-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.photo-choice {
  position: relative;
  width: 64px;
  height: 64px;
  padding: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.15);
  transition: var(--transition);
}

.photo-choice img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-choice:hover { border-color: rgba(255, 255, 255, 0.45); }

.photo-choice.active {
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.6);
}

.photo-choice-none {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-secondary);
  text-align: center;
}

/* Ачаалагдаагүй зураг — постер дээр гарахгүй тул улаанаар тэмдэглэнэ */
.photo-choice.failed,
.thumb-preview.failed {
  border-color: #ef4444;
  opacity: 0.5;
}

.photo-picker-empty {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 0.25rem 0 0;
}

.theme-layout {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border-color: rgba(255, 255, 255, 0.18);
}

.theme-option input:checked + .theme-layout {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ==========================================================================
   УРАМШУУЛЛЫН КОД (PROMO CODE)
   ========================================================================== */
.promo-box {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  margin-bottom: 1rem;
}

.promo-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #34d399;
  margin-bottom: 0.55rem;
}

.promo-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  flex-wrap: wrap;
}

.promo-input {
  flex: 1 1 180px;
  min-width: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

/* Бичсэн код нь том үсгээр харагдана, харин жишээ нь бичсэн хэвээрээ —
   uppercase нь placeholder-ийг ч барьдаг тул түүнийг нь салгаж өгөв. */
.promo-input::placeholder {
  text-transform: none;
  letter-spacing: normal;
}

.promo-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.promo-result {
  margin-top: 0.55rem;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
}

.promo-ok { color: #34d399; }
.promo-bad { color: #f87171; }

/* ==========================================================================
   ТӨЛБӨР БОЛОМЖГҮЙ ҮЕИЙН МЭДЭГДЭЛ
   ========================================================================== */
.payment-down-box {
  background: rgba(245, 158, 11, 0.09);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1rem;
  text-align: center;
}

.payment-down-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fbbf24;
  margin-bottom: 0.45rem;
}

.payment-down-text {
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.4rem;
}

.payment-down-hint {
  font-size: 0.83rem;
  color: #34d399;
  font-weight: 600;
  line-height: 1.5;
}

.paylink-open {
  margin-top: 0.75rem;
  text-decoration: none;
  text-align: center;
}

/* ==========================================================================
   БҮТЭЭГДЭХҮҮНИЙ ЦЭС (нүүр хуудас)
   ========================================================================== */
.hub-layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  position: relative;
  z-index: 1;
}

.hub-hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.hub-title {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
}

.hub-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 560px;
  margin: 0 auto;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.25rem;
  align-items: stretch;
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.5rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  transition: var(--transition);
}

.product-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-3px);
}

/* Ашиглахад бэлэн бүтээгдэхүүнийг товойлгоно */
.product-card-live {
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: 0 0 34px rgba(59, 130, 246, 0.12);
}

.product-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
}

.icon-blue { box-shadow: inset 0 0 22px rgba(59, 130, 246, 0.35); }
.icon-cyan { box-shadow: inset 0 0 22px rgba(6, 182, 212, 0.35); }
.icon-rose { box-shadow: inset 0 0 22px rgba(244, 63, 94, 0.35); }

.product-state {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.28rem 0.6rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.state-live {
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.state-soon {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
}

.product-name {
  font-family: var(--font-heading);
  font-size: 1.18rem;
  font-weight: 800;
}

.product-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.55;
}

.product-points {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.product-points li::before {
  content: '▸ ';
  color: var(--primary);
}

/* Товчийг картын ёроолд нааж, бүх карт ижил өндөртэй харагдана */
.product-card .btn-block { margin-top: auto; }

.btn-disabled,
.btn-disabled:hover {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.hub-footnote {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Бүтээгдэхүүн хооронд буцах холбоос */
.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.8rem;
  margin-right: 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  transition: var(--transition);
  white-space: nowrap;
}

.nav-back:hover {
  color: var(--text-primary);
  border-color: var(--border-glow);
}

/* ===================================================================
   НИЙТЛЭГ ТӨЛБӨРИЙН ЦОНХ (shared.js динамикаар үүсгэнэ)
   ========================================================================== */
.shared-pay-amount {
  font-family: var(--font-heading);
  font-size: 1.9rem;
  font-weight: 900;
  text-align: center;
}

.shared-pay-invoice {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: -0.9rem;
}

.shared-pay-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.shared-pay-qr img {
  width: 210px;
  height: 210px;
  background: white;
  padding: 0.6rem;
  border-radius: var(--radius-md);
}

.shared-pay-hint { font-size: 0.82rem; color: var(--text-secondary); }
.shared-pay-timer { font-size: 0.78rem; color: var(--accent-gold); }

.shared-pay-down {
  padding: 1rem;
  border-radius: var(--radius-md);
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.25);
  font-size: 0.85rem;
}
.shared-pay-down p { color: var(--text-secondary); margin-top: 0.4rem; }

/* ==========================================================================
   ХАДМАЛ БҮТЭЭГЧ
   ========================================================================== */
.sub-layout {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sub-help {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* Сангийн багтаамжийн мэдэгдэл.
   Өнгө нь `data-tone`-оор солигдоно: ok (ногоон) → tight (шар) → full (улаан).
   Ингэснээр хэрэглэгч уншихаасаа өмнө байдлыг ХАРНА. */
.capacity-note {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
}

.capacity-note[data-tone="ok"] {
  border-color: rgba(59, 130, 246, 0.28);
  background: rgba(59, 130, 246, 0.07);
}

.capacity-note[data-tone="tight"] {
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(245, 158, 11, 0.08);
}

.capacity-note[data-tone="full"] {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
}

.capacity-icon {
  font-size: 1.1rem;
  line-height: 1.4;
  flex-shrink: 0;
}

.capacity-body { min-width: 0; }

.capacity-headline {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.capacity-detail {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.capacity-disk {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.capacity-disk:empty { display: none; }

/* Диск дүүрсэн үед хуулах талбарыг идэвхгүй харагдуулна */
.dropzone-disabled {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.6);
}

.sub-workspace {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 900px) {
  .sub-workspace { grid-template-columns: 1fr; }
}

.sub-video {
  width: 100%;
  border-radius: var(--radius-md);
  background: #000;
  margin-bottom: 0.65rem;
  max-height: 60vh;
}

.sub-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
  word-break: break-all;
}

/* Хуулалтын явц */
.upload-progress { margin-top: 1rem; }

.progress-track {
  height: 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  transition: width 0.2s ease;
}

.progress-label {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Таних явцын заалт */
.transcribe-status,
.render-progress {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-top: 0.9rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.22);
  font-size: 0.85rem;
}

.spinner {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.status-title { font-weight: 600; }
.status-note { font-size: 0.78rem; color: var(--text-secondary); margin-top: 0.15rem; }

/* Хадмалын жагсаалт */
.cue-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 0.35rem;
  margin-bottom: 1rem;
}

.cue-row {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 32px;
  gap: 0.55rem;
  align-items: start;
}

.cue-time {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.2rem;
  cursor: pointer;
  transition: var(--transition);
}

.cue-time:hover {
  background: rgba(6, 182, 212, 0.18);
  color: #a5f3fc;
}

.cue-text {
  width: 100%;
  resize: vertical;
  font-family: var(--font-sans);
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
}

.cue-text:focus {
  outline: none;
  border-color: var(--primary);
}

.cue-del {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem 0;
  transition: var(--transition);
}

.cue-del:hover {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.45);
}

.sub-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.font-scale {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.font-scale .form-input { padding: 0.5rem 0.65rem; }

/* Хадмал татах хэлбэрүүд (.srt / .vtt / .txt) */
.sub-downloads {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.downloads-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.downloads-row {
  display: flex;
  gap: 0.4rem;
}

.sub-actions .btn-lg { margin-left: auto; }

.render-done {
  margin-top: 1rem;
  padding: 1.1rem;
  border-radius: var(--radius-md);
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.28);
}

.done-title { font-weight: 700; margin-bottom: 0.25rem; }
.done-meta { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.85rem; }

/* Нарийн дэлгэцэнд толгой хэсэг эвдрэхгүй байх (бүтээгдэхүүний нэр урт) */
@media (max-width: 860px) {
  .nav-container {
    flex-wrap: wrap;
    gap: 0.6rem;
  }
  .brand-title { font-size: 1rem; }
  .brand-badge { display: none; }
  .nav-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .nav-actions .btn,
  .nav-actions .credits-pill,
  .nav-back { font-size: 0.78rem; }
}

/* ==========================================================================
   ДУБЛЯЖ
   ========================================================================== */
.dub-input-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 900px) {
  .dub-input-grid { grid-template-columns: 1fr; }
}

.dropzone-compact { min-height: 150px; }

.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.dub-text {
  width: 100%;
  min-height: 190px;
  resize: vertical;
}

.dub-text-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 0.4rem 0 0.9rem;
}

.estimate-ok { color: var(--accent-emerald); }
.estimate-over { color: var(--accent-gold); }

.dub-voice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.dub-audio {
  width: 100%;
  margin-bottom: 0.9rem;
}

/* Анхааруулга: дуу видеонооосоо урт байх зэрэг */
.dub-warning,
.dub-note {
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  margin-bottom: 0.9rem;
}

.dub-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fcd34d;
}

.dub-note {
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.dub-line {
  font-size: 0.86rem;
  line-height: 1.5;
  padding: 0.5rem 0.65rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

/* Дубляжийн мөрийн жагсаалтад устгах багана байхгүй */
#lineList .cue-row { grid-template-columns: 62px minmax(0, 1fr); }
=======
   ВИДЕО САН (МИНИЙ ВИДЕО)
   ========================================================================== */
.btn-library {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: white;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.3);
}
.btn-library:hover { filter: brightness(1.1); }
.btn-library[hidden] { display: none; }
.library-icon { font-size: 0.95rem; }

/* Сангийн цонх жагсаалт багтаах тул төлбөрийн цонхноос өргөн */
.modal-card-wide { max-width: 860px; }

.library-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-purple);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.9rem;
}
.library-hint strong { color: var(--text-primary); }

.library-status {
  font-size: 0.82rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.9rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.library-status.status-error {
  border-color: rgba(244, 63, 94, 0.4);
  color: #fda4af;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.85rem;
}

.library-item {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}
.library-item:hover { border-color: var(--border-glow); transform: translateY(-2px); }

/* Дэвсгэр зураггүй үед харьцааг хадгалахын тулд aspect-ratio */
.library-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0b1020 center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
}
.library-thumb.portrait { aspect-ratio: 9 / 16; }
.library-thumb-placeholder { font-size: 1.9rem; opacity: 0.55; }
.library-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: var(--transition);
}
.library-thumb:hover .library-play { opacity: 1; }

.library-duration {
  position: absolute;
  right: 6px;
  bottom: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.72);
  color: #e2e8f0;
}

.library-meta { padding: 0.6rem 0.7rem; display: flex; flex-direction: column; gap: 0.2rem; }
.library-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.library-sub { font-size: 0.7rem; color: var(--text-muted); }
.library-actions {
  display: flex;
  gap: 0.4rem;
  padding: 0 0.7rem 0.7rem;
}
.library-actions .btn { flex: 1; }
.library-del:hover { background: rgba(244, 63, 94, 0.18); border-color: var(--accent-rose); }

.library-empty { text-align: center; padding: 2.2rem 1rem; }
.library-empty-icon { font-size: 2.4rem; margin-bottom: 0.5rem; }
.library-empty-title { font-size: 0.98rem; font-weight: 600; color: var(--text-primary); }
.library-empty-text { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

.library-player { margin-bottom: 1rem; }
.library-player video {
  width: 100%;
  max-height: 46vh;
  border-radius: var(--radius-md);
  background: #000;
  border: 1px solid var(--border-color);
}
.library-player-actions { display: flex; gap: 0.5rem; margin-top: 0.6rem; }

/* Рендерийн дараах "санд хадгалагдсан" мэдэгдэл */
.saved-note {
  font-size: 0.78rem;
  line-height: 1.45;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.7rem;
  text-align: left;
}
.saved-note-ok {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}
.saved-note-warn {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fcd34d;
}

@media (max-width: 640px) {
  .modal-card-wide { max-width: 100%; }
  .library-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* Бүтээгдэхүүний нэрийн доорх монгол тайлбар */
.product-tagline {
  font-size: 0.78rem;
  color: var(--accent-cyan);
  font-weight: 600;
  margin-top: -0.55rem;
}

/* ==========================================================================
   AI ПОСТЕР (ЗУРГИЙН ЗАГВАРААР ЗУРСАН)
   ========================================================================== */
.ai-poster-card { margin-bottom: 1.25rem; }

.ai-poster-progress {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.9rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.ai-poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.ai-poster-grid:empty { display: none; }

.ai-poster-cell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  cursor: pointer;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.ai-poster-cell:hover {
  border-color: rgba(96, 165, 250, 0.5);
  transform: translateY(-2px);
}

.ai-poster-cell img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

/* Амжилтгүй болсон үзэгдэл — зургийн оронд шалтгааныг нь хэлнэ */
.ai-poster-empty {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  font-size: 0.78rem;
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.08);
}

.ai-poster-caption {
  padding: 0 0.5rem 0.45rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
