/* ============================================================
   Tangazo AI — Main Stylesheet
   Theme: Dark Navy (#0a1628) + Golden (#d4a017) + White
   Font: Miranda Sans → Inter fallback
   ============================================================ */

/* ---------- CSS Variables ---------------------------------- */
:root {
  --primary: #0a1628;
  --primary-light: #1a2d4d;
  --primary-soft: rgba(10, 22, 40, 0.08);
  --secondary: #d4a017;
  --secondary-light: #e8b820;
  --secondary-soft: rgba(212, 160, 23, 0.12);
  --accent: #ffffff;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --border: #e5e9f0;
  --text: #1a2035;
  --text-muted: #6b7280;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 4px rgba(10,22,40,0.08);
  --shadow: 0 4px 16px rgba(10,22,40,0.1);
  --shadow-lg: 0 8px 32px rgba(10,22,40,0.14);
  --nav-height: 64px;
  --bottom-nav-height: 72px;
  --transition: all 0.2s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Miranda Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--secondary); text-decoration: none; }
a:hover { color: var(--secondary-light); }

img { max-width: 100%; height: auto; }

/* ---------- Bootstrap Overrides --------------------------- */
.btn-primary {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--secondary-light);
  border-color: var(--secondary-light);
  color: #fff;
}
.btn-outline-primary {
  color: var(--secondary);
  border-color: var(--secondary);
}
.btn-outline-primary:hover {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #fff;
}
.text-primary { color: var(--secondary) !important; }
.bg-primary { background: var(--primary) !important; }
.border-primary { border-color: var(--secondary) !important; }
.badge.bg-primary { background: var(--secondary) !important; }
.bg-primary-soft { background: var(--primary-soft) !important; }

/* ---------- Typography ------------------------------------- */
h1, h2, h3, h4, h5, h6 { font-weight: 700; color: var(--primary); line-height: 1.25; }
.text-golden { color: var(--secondary); }
.fw-800 { font-weight: 800; }

/* ---------- Auth Pages ------------------------------------- */
.auth-body {
  background: linear-gradient(135deg, var(--primary) 0%, #1e3a5f 60%, #0d2340 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-container {
  width: 100%;
  max-width: 440px;
}

.auth-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  text-align: center;
  margin-bottom: 2rem;
}
.auth-brand-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 2rem;
  color: var(--secondary);
  box-shadow: 0 4px 20px rgba(10,22,40,0.25);
}
.auth-brand-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin: 0 auto 1rem;
  display: block;
}
.auth-brand-name {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0 0 0.25rem;
}
.auth-brand-name span { color: var(--secondary); }
.auth-brand-tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.5rem;
}
.auth-subtitle {
  text-align: center;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.form-floating > .form-control:focus,
.form-floating > .form-control:not(:placeholder-shown) {
  padding-top: 1.625rem;
  padding-bottom: 0.625rem;
}
.form-control:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 0.2rem var(--secondary-soft);
}

/* Password toggle */
.pwd-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  z-index: 10;
}
.pwd-toggle:hover { color: var(--secondary); }

/* Language cards */
.lang-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}
.lang-card:hover { border-color: var(--secondary); }
.lang-card.selected { border-color: var(--secondary); background: var(--secondary-soft); }
.lang-card .lang-flag { font-size: 2rem; margin-bottom: 0.5rem; }
.lang-card .lang-name { font-weight: 600; font-size: 0.95rem; }
.lang-card .lang-sub { font-size: 0.8rem; color: var(--text-muted); }

/* ---------- Top Navigation --------------------------------- */
.user-navbar {
  background: var(--primary);
  height: var(--nav-height);
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 2px 12px rgba(10,22,40,0.15);
}
.navbar-brand-name {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
}
.navbar-brand-name span { color: var(--secondary); }

.nav-link-item {
  color: rgba(255,255,255,0.7) !important;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem !important;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.nav-link-item:hover, .nav-link-item.active {
  color: #fff !important;
  background: rgba(255,255,255,0.08);
}

.credit-badge {
  background: var(--secondary-soft);
  border: 1px solid var(--secondary);
  color: var(--secondary);
  border-radius: 20px;
  padding: 0.35rem 0.85rem;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-create-nav {
  background: var(--secondary);
  color: #fff !important;
  font-weight: 600;
  border-radius: 8px;
  padding: 0.45rem 1rem;
  border: none;
  font-size: 0.9rem;
  transition: var(--transition);
}
.btn-create-nav:hover {
  background: var(--secondary-light);
  color: #fff !important;
  transform: translateY(-1px);
}

/* ---------- Bottom Navigation (Mobile) --------------------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1040;
  box-shadow: 0 -4px 20px rgba(10,22,40,0.2);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: rgba(255,255,255,0.5);
  font-size: 0.65rem;
  font-weight: 500;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 10px;
  transition: var(--transition);
  min-width: 54px;
}
.bottom-nav-item i { font-size: 1.35rem; }
.bottom-nav-item:hover, .bottom-nav-item.active {
  color: var(--secondary);
  background: rgba(212,160,23,0.1);
}

.bottom-nav-create {
  background: var(--secondary);
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff !important;
  box-shadow: 0 4px 16px rgba(212,160,23,0.4);
  transition: var(--transition);
}
.bottom-nav-create:hover {
  background: var(--secondary-light);
  transform: scale(1.05);
}
.bottom-nav-create i { font-size: 1.6rem; }

/* ---------- Page Layout ------------------------------------ */
.page-content {
  padding-top: 1.5rem;
  padding-bottom: calc(var(--bottom-nav-height) + 1rem);
}
@media (min-width: 992px) {
  .page-content { padding-bottom: 2rem; }
}

.page-header {
  margin-bottom: 1.5rem;
}
.page-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0;
}
.page-header p { color: var(--text-muted); margin: 0.25rem 0 0; font-size: 0.9rem; }

/* ---------- Cards ----------------------------------------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  padding: 1rem 1.25rem;
}

/* Stat cards */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-icon.golden { background: var(--secondary-soft); color: var(--secondary); }
.stat-icon.blue { background: rgba(59,130,246,0.1); color: var(--info); }
.stat-icon.green { background: rgba(34,197,94,0.1); color: var(--success); }
.stat-icon.purple { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.stat-icon.red { background: rgba(239,68,68,0.1); color: var(--danger); }
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1; color: var(--primary); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 3px; }

/* Hero credit card */
.credit-hero {
  background: linear-gradient(135deg, var(--primary) 0%, #1a3060 100%);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.credit-hero::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 180px;
  height: 180px;
  background: rgba(212,160,23,0.08);
  border-radius: 50%;
}
.credit-hero::after {
  content: '';
  position: absolute;
  bottom: -60px;
  left: -20px;
  width: 220px;
  height: 220px;
  background: rgba(255,255,255,0.03);
  border-radius: 50%;
}
.credit-hero-amount {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  color: var(--secondary);
}
.credit-hero-label { font-size: 0.9rem; opacity: 0.7; margin-bottom: 0.5rem; }
.credit-hero-sub { font-size: 0.85rem; opacity: 0.6; margin-top: 0.5rem; }

/* ---------- Project / Video Cards -------------------------- */
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.project-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }

.project-thumb {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #1a2d4d, #0a1628);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: rgba(255,255,255,0.2);
  position: relative;
  overflow: hidden;
}
.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}
.project-status-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

.project-body { padding: 1rem; }
.project-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.35rem; line-height: 1.3; }
.project-meta { font-size: 0.78rem; color: var(--text-muted); }
.project-type-badge {
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 20px;
  padding: 3px 10px;
  display: inline-block;
}

/* ---------- Status Badges ---------------------------------- */
.badge-draft { background: #f3f4f6; color: #6b7280; }
.badge-rendering { background: rgba(59,130,246,0.12); color: #3b82f6; }
.badge-completed { background: rgba(34,197,94,0.12); color: #16a34a; }
.badge-failed { background: rgba(239,68,68,0.12); color: #dc2626; }
.badge-committed { background: rgba(212,160,23,0.12); color: #d97706; }

/* ---------- Wizard ----------------------------------------- */
.wizard-container {
  max-width: 800px;
  margin: 0 auto;
}

.wizard-progress {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.wizard-progress::-webkit-scrollbar { display: none; }

.wizard-step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  position: relative;
}
.wizard-step-dot:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 16px;
  left: calc(50% + 16px);
  width: calc(100% - 32px);
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.wizard-step-dot.completed:not(:last-child)::after { background: var(--secondary); }

.step-dot-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
  transition: var(--transition);
}
.wizard-step-dot.active .step-dot-circle {
  background: var(--secondary);
  color: #fff;
  box-shadow: 0 0 0 4px var(--secondary-soft);
}
.wizard-step-dot.completed .step-dot-circle {
  background: var(--success);
  color: #fff;
}
.step-dot-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wizard-step-dot.active .step-dot-label { color: var(--secondary); font-weight: 600; }
.wizard-step-dot.completed .step-dot-label { color: var(--success); }

.wizard-panel {
  display: none;
  animation: fadeInUp 0.3s ease;
}
.wizard-panel.active { display: block; }

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

/* Video type cards */
.video-type-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  background: var(--surface);
  height: 100%;
}
.video-type-card:hover { border-color: var(--secondary); box-shadow: var(--shadow); }
.video-type-card.selected {
  border-color: var(--secondary);
  background: var(--secondary-soft);
  box-shadow: 0 0 0 3px rgba(212,160,23,0.15);
}
.video-type-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.video-type-name { font-weight: 700; font-size: 0.9rem; margin-bottom: 0.25rem; }
.video-type-desc { font-size: 0.78rem; color: var(--text-muted); margin: 0; }

/* Option pills */
.option-pill {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  transition: var(--transition);
  background: var(--surface);
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
}
.option-pill:hover { border-color: var(--secondary); }
.option-pill.selected { border-color: var(--secondary); background: var(--secondary-soft); color: var(--primary); }
.option-pill .pill-icon { font-size: 1.5rem; margin-bottom: 0.35rem; }
.option-pill .pill-sub { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }

/* Tone chips */
.tone-chip {
  display: inline-block;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}
.tone-chip:hover { border-color: var(--secondary); color: var(--secondary); }
.tone-chip.selected {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #fff;
  font-weight: 600;
}

/* Script textarea */
.script-textarea {
  min-height: 220px;
  font-family: 'Inter', monospace;
  font-size: 0.9rem;
  line-height: 1.7;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  resize: vertical;
  transition: var(--transition);
}
.script-textarea:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px var(--secondary-soft);
}

/* Scene cards */
.scene-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}
.scene-card:hover { border-color: var(--secondary); box-shadow: var(--shadow); }
.scene-card-header {
  background: var(--primary);
  color: #fff;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.scene-card-body { padding: 1rem; background: var(--surface); }
.scene-text { font-size: 0.88rem; line-height: 1.65; color: var(--text); }
.scene-image-placeholder {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #e8ecf4, #d0d7e8);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: rgba(10,22,40,0.2);
  position: relative;
  overflow: hidden;
}
.scene-image-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

/* Voice character cards */
.voice-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: var(--transition);
  background: var(--surface);
}
.voice-card:hover { border-color: var(--secondary); box-shadow: var(--shadow); }
.voice-card.selected {
  border-color: var(--secondary);
  background: var(--secondary-soft);
}
.voice-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--secondary);
}
.voice-name { font-weight: 700; font-size: 0.9rem; }
.voice-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.voice-tag {
  font-size: 0.7rem;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 10px;
  padding: 2px 8px;
  font-weight: 500;
}

/* Storyboard */
.storyboard-scene {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  gap: 0;
}
.storyboard-thumb {
  width: 140px;
  min-height: 90px;
  flex-shrink: 0;
  background: #1a2d4d;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.2);
  font-size: 1.5rem;
}
.storyboard-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.storyboard-info { padding: 0.85rem 1rem; flex: 1; }
.storyboard-number { font-size: 0.72rem; font-weight: 700; color: var(--secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.storyboard-text { font-size: 0.85rem; line-height: 1.6; color: var(--text); margin-top: 4px; }

/* Audio player */
.audio-player-bar {
  background: var(--primary);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.audio-player-bar audio { display: none; }
.audio-play-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--secondary);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}
.audio-play-btn:hover { background: var(--secondary-light); transform: scale(1.05); }
.audio-timeline { flex: 1; height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px; cursor: pointer; }
.audio-progress { height: 100%; background: var(--secondary); border-radius: 2px; width: 0%; transition: width 0.1s linear; }
.audio-time { font-size: 0.75rem; opacity: 0.7; flex-shrink: 0; }

/* Render progress */
.render-progress-card {
  background: linear-gradient(135deg, var(--primary) 0%, #1a3060 100%);
  border-radius: var(--radius-lg);
  padding: 2rem;
  color: #fff;
  text-align: center;
}
.render-icon-spin {
  font-size: 3rem;
  color: var(--secondary);
  animation: spin 2s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.render-percent {
  font-size: 3rem;
  font-weight: 800;
  color: var(--secondary);
  line-height: 1;
}

/* ---------- Explore Page ----------------------------------- */
.explore-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.explore-card {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  cursor: pointer;
}
.explore-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }

.explore-thumb {
  aspect-ratio: 16/9;
  background: #1a2d4d;
  position: relative;
  overflow: hidden;
}
.explore-thumb img, .explore-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}
.explore-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10,22,40,0.4);
  opacity: 0;
  transition: var(--transition);
}
.explore-card:hover .explore-play-overlay { opacity: 1; }
.explore-play-btn {
  width: 54px;
  height: 54px;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--primary);
}

.explore-card-body { padding: 0.85rem; }
.explore-card-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 0.4rem; line-height: 1.3; }
.explore-card-meta { font-size: 0.75rem; color: var(--text-muted); display: flex; gap: 0.75rem; }
.explore-card-meta i { margin-right: 3px; }

/* Explore video player */
.explore-player-wrapper {
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  aspect-ratio: 16/9;
}
.explore-player-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-actions-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.video-action-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface);
  transition: var(--transition);
  color: var(--text);
}
.video-action-btn:hover { border-color: var(--secondary); color: var(--secondary); }
.video-action-btn.active { background: var(--secondary-soft); border-color: var(--secondary); color: var(--secondary); }

/* ---------- Filter Tabs ----------------------------------- */
.filter-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.filter-tabs::-webkit-scrollbar { display: none; }

.filter-tab {
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 0.4rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  background: var(--surface);
  color: var(--text);
}
.filter-tab:hover { border-color: var(--secondary); color: var(--secondary); }
.filter-tab.active {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #fff;
  font-weight: 600;
}

/* ---------- Credits Page ----------------------------------- */
.package-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: var(--transition);
  position: relative;
  background: var(--surface);
  cursor: pointer;
}
.package-card:hover { border-color: var(--secondary); box-shadow: var(--shadow); }
.package-card.popular {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(212,160,23,0.15);
}
.package-popular-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--secondary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 14px;
  border-radius: 20px;
  white-space: nowrap;
}
.package-credits { font-size: 2.5rem; font-weight: 800; color: var(--primary); line-height: 1; }
.package-credits span { font-size: 1rem; font-weight: 400; color: var(--text-muted); }
.package-price { font-size: 1.2rem; font-weight: 700; color: var(--secondary); margin-top: 0.5rem; }
.package-bonus { font-size: 0.8rem; color: var(--success); font-weight: 600; margin-top: 2px; }

/* ---------- Transaction list ------------------------------ */
.transaction-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.transaction-item:last-child { border-bottom: none; }
.transaction-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.transaction-icon.credit { background: rgba(34,197,94,0.1); color: var(--success); }
.transaction-icon.debit { background: rgba(239,68,68,0.1); color: var(--danger); }
.transaction-icon.reserve { background: rgba(245,158,11,0.1); color: var(--warning); }
.transaction-amount { font-weight: 700; font-size: 0.95rem; }
.transaction-amount.credit { color: var(--success); }
.transaction-amount.debit { color: var(--danger); }
.transaction-desc { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }
.transaction-date { font-size: 0.78rem; color: var(--text-muted); }

/* ---------- Alerts ---------------------------------------- */
#alertBox .alert {
  border-radius: var(--radius);
  border: none;
  font-size: 0.9rem;
}

/* ---------- Forms ----------------------------------------- */
.form-label { font-weight: 600; font-size: 0.88rem; color: var(--primary); margin-bottom: 0.4rem; }
.form-control, .form-select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  padding: 0.6rem 0.875rem;
  transition: var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px var(--secondary-soft);
}
.form-text { font-size: 0.78rem; color: var(--text-muted); }

/* ---------- Tables ---------------------------------------- */
.table-responsive { border-radius: var(--radius); overflow: hidden; }
.table { margin: 0; font-size: 0.88rem; }
.table th {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg);
  border-color: var(--border);
  padding: 0.75rem 1rem;
}
.table td { border-color: var(--border); padding: 0.85rem 1rem; vertical-align: middle; }
.table tbody tr:hover { background: var(--bg); }

/* ---------- Pagination ------------------------------------- */
.pagination .page-link {
  border-radius: var(--radius-sm) !important;
  margin: 0 2px;
  border: 1.5px solid var(--border);
  color: var(--text);
  font-size: 0.875rem;
  padding: 0.4rem 0.85rem;
  transition: var(--transition);
}
.pagination .page-link:hover { background: var(--secondary-soft); border-color: var(--secondary); color: var(--secondary); }
.pagination .page-item.active .page-link {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #fff;
}

/* ---------- Empty States ---------------------------------- */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}
.empty-state i { font-size: 3.5rem; margin-bottom: 1rem; opacity: 0.3; }
.empty-state h5 { font-weight: 700; margin-bottom: 0.5rem; color: var(--text); }
.empty-state p { font-size: 0.9rem; margin-bottom: 1.5rem; }

.empty-state .empty-create-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  min-height: 4.9rem;
  min-width: 13rem;
  padding: 0 1.8rem;
  line-height: 1;
}

.empty-state .empty-create-btn i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.7rem;
  height: 2.7rem;
  margin: 0;
  font-size: 2.7rem;
  line-height: 1;
  opacity: 0.35;
}

.empty-state .empty-create-btn span {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

/* ---------- Loading States -------------------------------- */
.skeleton {
  background: linear-gradient(90deg, #f0f2f5 25%, #e8eaed 50%, #f0f2f5 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Modal helpers --------------------------------- */
.modal-content { border-radius: var(--radius-lg); border: none; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--border); padding: 1.25rem 1.5rem; }
.modal-footer { border-top: 1px solid var(--border); padding: 1rem 1.5rem; }
.modal-body { padding: 1.5rem; }

/* ---------- Utilities ------------------------------------- */
.rounded-xl { border-radius: var(--radius) !important; }
.rounded-2xl { border-radius: var(--radius-lg) !important; }
.gap-xs { gap: 0.35rem !important; }
.text-xs { font-size: 0.75rem !important; }
.text-sm { font-size: 0.85rem !important; }
.hover-lift { transition: var(--transition); }
.hover-lift:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.icon-circle {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---------- Responsive ------------------------------------ */
@media (max-width: 767.98px) {
  .auth-card { padding: 2rem 1.25rem; }
  .credit-hero { padding: 1.25rem; }
  .credit-hero-amount { font-size: 2.25rem; }
  .page-content { padding-top: 1rem; }
  .wizard-container { padding: 0 0.25rem; }
  .storyboard-thumb { width: 90px; }
  .explore-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
}

@media (max-width: 575.98px) {
  .explore-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Product UI Refresh
   ============================================================ */
.app-body {
  background:
    linear-gradient(180deg, rgba(10,22,40,0.035), rgba(10,22,40,0) 220px),
    #f6f8fc;
}

.app-main.with-nav { min-height: calc(100vh - var(--nav-height)); }

.app-topnav {
  height: 72px;
  position: sticky;
  top: 0;
  z-index: 1030;
  background: rgba(255,255,255,0.92);
  border-bottom: 1px solid rgba(10,22,40,0.08);
  backdrop-filter: blur(16px);
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--primary);
  text-decoration: none;
}

.brand-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--primary);
  color: var(--secondary);
  box-shadow: 0 12px 24px rgba(10,22,40,0.16);
}
.brand-logo-img {
  height: 32px;
  width: auto;
  object-fit: contain;
  display: block;
}

.brand-name { font-weight: 800; font-size: 1.18rem; color: var(--primary); }
.brand-ai { color: var(--secondary); }
.nav-links .nav-link {
  color: #455168;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.48rem 0.75rem;
  border-radius: 999px;
}
.nav-links .nav-link:hover,
.nav-links .nav-link.active {
  color: var(--primary);
  background: rgba(10,22,40,0.06);
}

.page-content {
  max-width: 1180px;
  margin: 0 auto;
}

.page-header {
  padding: 0.25rem 0;
}

.page-header h1 {
  font-size: clamp(1.55rem, 1.2rem + 1vw, 2.15rem);
  letter-spacing: 0;
}

.bg-primary-gradient,
.credit-hero-card {
  background: linear-gradient(135deg, #0a1628 0%, #17345f 68%, #243b61 100%);
}

.page-header.bg-primary-gradient {
  border-radius: 0 0 24px 24px;
  margin-top: -1.5rem;
  box-shadow: 0 22px 40px rgba(10,22,40,0.16);
}

.credit-hero-card {
  border-radius: 22px;
  padding: 1.35rem;
  color: #fff;
  box-shadow: 0 20px 44px rgba(10,22,40,0.18);
}

.credit-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
}

.stat-card {
  min-height: 104px;
  align-items: flex-start;
  flex-direction: column;
  gap: 0.65rem;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(10,22,40,0.07);
}

.stat-card .stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 1.1rem;
}

.bg-success-soft { background: rgba(34,197,94,0.12) !important; }
.bg-warning-soft { background: rgba(245,158,11,0.12) !important; }
.bg-info-soft { background: rgba(59,130,246,0.12) !important; }

.quick-action-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-height: 72px;
  padding: 0.85rem;
  background: #fff;
  border: 1px solid rgba(10,22,40,0.08);
  border-radius: 16px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(10,22,40,0.06);
}

.quick-action-card:hover {
  color: var(--primary);
  border-color: rgba(212,160,23,0.38);
  transform: translateY(-2px);
}

.quick-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  flex: 0 0 auto;
}

.project-list {
  display: grid;
  gap: 0.75rem;
}

.project-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  border: 1px solid rgba(10,22,40,0.08);
  border-radius: 16px;
}

.project-item:hover {
  color: var(--text);
  border-color: rgba(212,160,23,0.35);
  box-shadow: 0 14px 28px rgba(10,22,40,0.08);
}

.project-item .project-thumb {
  width: 62px;
  height: 62px;
  aspect-ratio: 1;
  border-radius: 14px;
}

.x-small { font-size: 0.72rem; }
.status-badge {
  border-radius: 999px;
  padding: 0.28rem 0.62rem;
  font-size: 0.72rem;
  font-weight: 800;
  background: rgba(10,22,40,0.06);
  color: var(--primary);
}
.status-completed { background: rgba(34,197,94,0.12); color: #15803d; }
.status-processing { background: rgba(59,130,246,0.12); color: #2563eb; }
.status-failed { background: rgba(239,68,68,0.12); color: #dc2626; }

.bottom-nav {
  height: 78px;
  background: rgba(10,22,40,0.96);
  border-top: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(18px);
}

.bottom-nav .create-btn .create-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  margin-top: -24px;
  border-radius: 18px;
  background: var(--secondary);
  color: #fff;
  box-shadow: 0 14px 28px rgba(212,160,23,0.34);
}

.wizard-page {
  max-width: 980px;
  margin: 0 auto;
}

.wizard-header {
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(10,22,40,0.08);
  border-top: 0;
  border-radius: 0 0 24px 24px;
  box-shadow: 0 16px 34px rgba(10,22,40,0.08);
  backdrop-filter: blur(16px);
}

.wizard-title { color: var(--primary); }
.step-indicator {
  min-width: 58px;
  text-align: center;
  border-radius: 999px;
  padding: 0.24rem 0.6rem;
  background: rgba(10,22,40,0.06);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 800;
}

.wizard-header .wizard-progress {
  height: 5px;
  margin: 0;
  background: rgba(10,22,40,0.08);
  overflow: hidden;
}

.wizard-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary), #f2c94c);
  transition: width 0.25s ease;
}

.step-pills {
  overflow-x: auto;
  scrollbar-width: none;
}
.step-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(10,22,40,0.1);
  border-radius: 999px;
  padding: 0.32rem 0.72rem;
  background: #fff;
  color: #667085;
  font-size: 0.74rem;
  font-weight: 800;
}
.step-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.step-pill.completed {
  background: rgba(34,197,94,0.12);
  border-color: rgba(34,197,94,0.22);
  color: #15803d;
}

.wizard-body {
  padding-bottom: 110px;
}

.wizard-step {
  background: #fff;
  border: 1px solid rgba(10,22,40,0.08);
  border-radius: 22px;
  padding: clamp(1rem, 2vw, 1.5rem);
  box-shadow: 0 18px 42px rgba(10,22,40,0.08);
}

.video-type-grid,
.lang-grid,
.ratio-grid,
.tone-grid {
  display: grid;
  gap: 0.85rem;
}

.video-type-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.lang-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.ratio-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tone-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }

.type-card,
.lang-card,
.ratio-card,
.template-card {
  height: 100%;
  padding: 1rem;
  border: 1.5px solid rgba(10,22,40,0.12);
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.type-card:hover,
.lang-card:hover,
.ratio-card:hover,
.template-card:hover {
  transform: translateY(-2px);
  border-color: rgba(212,160,23,0.45);
  box-shadow: 0 14px 28px rgba(10,22,40,0.08);
}

.type-card.selected,
.lang-card.selected,
.ratio-card.selected,
.template-option input:checked + .template-card {
  border-color: var(--secondary);
  background: linear-gradient(180deg, #fff, rgba(212,160,23,0.08));
  box-shadow: 0 0 0 4px rgba(212,160,23,0.12);
}

.type-icon {
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  margin-bottom: 0.8rem;
  background: rgba(10,22,40,0.06);
  color: var(--primary);
  font-size: 1.3rem;
}

.type-label,
.ratio-label {
  font-weight: 800;
  color: var(--primary);
}

.flag-emoji {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background: rgba(10,22,40,0.06);
  color: var(--primary);
  font-weight: 900;
  margin-bottom: 0.75rem;
}

.ratio-visual {
  margin: 0 auto 0.75rem;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #31537f);
  border: 3px solid rgba(212,160,23,0.45);
}
.ratio-916 { width: 42px; height: 68px; }
.ratio-11 { width: 58px; height: 58px; }
.ratio-169 { width: 78px; height: 44px; }

.tone-chip {
  border-radius: 14px;
  text-align: center;
  background: #fff;
}

.wizard-action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--bottom-nav-height);
  z-index: 1030;
  background: rgba(255,255,255,0.94);
  border-top: 1px solid rgba(10,22,40,0.08);
  backdrop-filter: blur(16px);
}

.wizard-action-bar .btn-primary,
.wizard-page .btn-primary,
.btn.btn-primary {
  background: linear-gradient(135deg, var(--secondary), #e8b820) !important;
  border-color: var(--secondary) !important;
  color: #fff !important;
  box-shadow: 0 12px 26px rgba(212,160,23,0.22);
}

.wizard-action-bar .btn-primary:hover,
.wizard-page .btn-primary:hover,
.btn.btn-primary:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

.cost-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.48rem 0.82rem;
  background: rgba(212,160,23,0.12);
  color: var(--primary);
  font-size: 0.84rem;
  font-weight: 800;
}

.script-editor textarea,
.scene-editor-card textarea,
.asset-card textarea {
  min-height: 120px;
}

.scene-editor-card,
.asset-card {
  border: 1px solid rgba(10,22,40,0.1);
  border-radius: 18px;
  padding: 1rem;
  margin-bottom: 1rem;
  background: #fff;
  box-shadow: 0 10px 28px rgba(10,22,40,0.06);
}

.scene-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.8rem;
  margin-bottom: 0.8rem;
  border-bottom: 1px solid rgba(10,22,40,0.08);
}

.scene-actions { display: flex; gap: 0.4rem; }
.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(10,22,40,0.12);
  border-radius: 10px;
  background: #fff;
  color: var(--primary);
}
.icon-btn:hover { border-color: var(--secondary); color: var(--secondary); }
.icon-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

.voice-card {
  display: block;
  border-radius: 18px;
}

.voice-card.selected {
  border-color: var(--secondary);
  box-shadow: 0 0 0 4px rgba(212,160,23,0.12);
}

.asset-card {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1rem;
}

.asset-preview {
  min-height: 150px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, #e8edf6, #dce4f3);
  color: rgba(10,22,40,0.28);
  font-size: 2rem;
}

.asset-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.asset-card.approved {
  border-color: rgba(34,197,94,0.4);
  background: linear-gradient(180deg, #fff, rgba(34,197,94,0.05));
}

.logo-upload-area {
  min-height: 140px;
  display: grid;
  place-items: center;
  border: 1.5px dashed rgba(10,22,40,0.18);
  border-radius: 18px;
  background: #fafbfd;
  cursor: pointer;
}

.logo-upload-area:hover { border-color: var(--secondary); background: rgba(212,160,23,0.05); }
.logo-preview-img { max-height: 80px; border-radius: 12px; }

.storyboard-shell {
  display: grid;
  place-items: center;
  padding: 1rem;
  border-radius: 22px;
  background: #0a1628;
}

.storyboard-phone {
  width: min(100%, 380px);
  max-height: 680px;
  overflow: auto;
  border-radius: 26px;
  background: #fff;
  padding: 0.8rem;
}

.storyboard-brand {
  color: #fff;
  padding: 0.85rem;
  border-radius: 18px;
  font-weight: 900;
  margin-bottom: 0.75rem;
}

.storyboard-mini {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 0.75rem;
  padding: 0.65rem;
  border: 1px solid rgba(10,22,40,0.08);
  border-radius: 16px;
  margin-bottom: 0.65rem;
}

.storyboard-mini-thumb {
  width: 92px;
  height: 116px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #edf1f7;
}
.storyboard-mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.storyboard-mini p { margin: 0.25rem 0 0; color: var(--text-muted); font-size: 0.8rem; line-height: 1.45; }

.cost-summary-card {
  background: #fff;
  border: 1px solid rgba(10,22,40,0.08);
  border-radius: 18px;
  overflow: hidden;
}
.cost-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.92rem 1rem;
  border-bottom: 1px solid rgba(10,22,40,0.08);
}
.cost-row:last-child { border-bottom: 0; }
.total-row { background: rgba(212,160,23,0.09); }

.explore-grid {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.explore-card {
  border: 1px solid rgba(10,22,40,0.08);
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(10,22,40,0.08);
}

.explore-thumb {
  background: linear-gradient(135deg, #0a1628, #274d78);
}

.package-card {
  border-radius: 18px;
  box-shadow: 0 12px 26px rgba(10,22,40,0.07);
}

.version-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem;
  border: 1px solid rgba(10,22,40,0.08);
  border-radius: 14px;
  margin-bottom: 0.65rem;
}

@media (min-width: 992px) {
  .wizard-action-bar {
    bottom: 0;
  }
}

@media (max-width: 767.98px) {
  .page-header.bg-primary-gradient {
    border-radius: 0 0 20px 20px;
  }
  .ratio-grid {
    grid-template-columns: 1fr;
  }
  .wizard-step {
    border-radius: 18px;
  }
  .asset-card {
    grid-template-columns: 1fr;
  }
  .asset-preview {
    min-height: 190px;
  }
  .storyboard-mini {
    grid-template-columns: 78px 1fr;
  }
  .storyboard-mini-thumb {
    width: 78px;
    height: 98px;
  }
}
