/* ZaloonStudio Web Suite - Premium Studio Stylesheet */

/* Bundled Caption Fonts (100% Identical to Desktop Plugin) */
@font-face {
  font-family: 'Jameel Noori Nastaleeq';
  src: url('../fonts/Jameel Noori Nastaleeq Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}
@font-face {
  font-family: 'Poppins';
  src: url('../fonts/Poppins-Bold.ttf') format('truetype');
  font-weight: bold;
}
@font-face {
  font-family: 'Montserrat';
  src: url('../fonts/Montserrat-Bold.ttf') format('truetype');
  font-weight: bold;
}
@font-face {
  font-family: 'Luckiest Guy';
  src: url('../fonts/LuckiestGuy-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Bebas Neue';
  src: url('../fonts/BebasNeue-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Bangers';
  src: url('../fonts/Bangers-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Caveat';
  src: url('../fonts/Caveat-Bold.ttf') format('truetype');
  font-weight: bold;
}
@font-face {
  font-family: 'Shrikhand';
  src: url('../fonts/Shrikhand-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Apple Garamond';
  src: url('../fonts/AppleGaramond-Bold.ttf') format('truetype');
  font-weight: bold;
}
@font-face {
  font-family: 'Apple Garamond';
  src: url('../fonts/AppleGaramond-BoldItalic.ttf') format('truetype');
  font-weight: bold;
  font-style: italic;
}

:root {
  --bg-primary: #0d0e12;
  --bg-secondary: #16181e;
  --bg-card: #1e2028;
  --bg-card-hover: #262933;
  --accent-cyan: #00f2fe;
  --accent-purple: #8b5cf6;
  --accent-gold: #fbbf24;
  --accent-green: #22c55e;
  --accent-pink: #ec4899;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #2b2e3b;
  --border-active: #22c55e;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --glow-purple: 0 0 20px rgba(139, 92, 246, 0.25);
  --glow-cyan: 0 0 20px rgba(0, 242, 254, 0.25);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header Navbar */
.navbar {
  height: 64px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

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

.brand-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #ffffff 40%, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text span {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.badge-version {
  font-size: 11px;
  font-weight: 700;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c084fc;
  padding: 3px 9px;
  border-radius: 9999px;
  letter-spacing: 0.5px;
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: #475569;
}

/* Studio Layout (Two Column Workspace) */
.studio-container {
  display: grid;
  grid-template-columns: 1fr 480px;
  gap: 24px;
  padding: 24px 28px;
  max-width: 1750px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
}

@media (max-width: 1200px) {
  .studio-container {
    grid-template-columns: 1fr;
  }
}

/* Left Column: Player & Dropzone */
.player-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.video-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
}

.video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
}

#main-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}

/* Upload Dropzone Placeholder */
.dropzone-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 40px;
  cursor: pointer;
  border: 2px dashed #3b4252;
  border-radius: var(--radius-md);
  margin: 20px;
  width: calc(100% - 40px);
  height: calc(100% - 40px);
  transition: all 0.2s;
  background: rgba(22, 24, 30, 0.6);
}

.dropzone-overlay:hover, .dropzone-overlay.dragover {
  border-color: var(--accent-purple);
  background: rgba(139, 92, 246, 0.08);
  box-shadow: inset 0 0 20px rgba(139, 92, 246, 0.2);
}

.dropzone-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
}

.dropzone-title {
  font-size: 19px;
  font-weight: 700;
  color: #f1f5f9;
}

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

/* LIVE CAPTION OVERLAY OVER VIDEO */
.caption-overlay {
  position: absolute;
  left: 5%;
  right: 5%;
  bottom: 12%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 20;
  transition: bottom 0.2s, top 0.2s;
}

.caption-overlay.pos-top {
  bottom: auto;
  top: 12%;
}

.caption-overlay.pos-middle {
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
}

.caption-cue-box {
  text-align: center;
  line-height: 1.35;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 8px;
  max-width: 90%;
  word-wrap: break-word;
  transition: all 0.1s ease-out;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.95), 0 0 20px rgba(0, 0, 0, 0.8);
}

/* Video Player Controls Bar */
.player-controls {
  padding: 16px 20px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline-slider-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.timecode-display {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 95px;
}

.custom-seekbar {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  background: #334155;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  transition: height 0.1s;
}

.custom-seekbar:hover {
  height: 8px;
}

.custom-seekbar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.7);
}

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

.btn-ctrl {
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: all 0.2s;
}

.btn-ctrl:hover {
  background: #334155;
  color: #ffffff;
}

.btn-ctrl.btn-play-pause {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: #ffffff;
  width: 44px;
  height: 44px;
}

.btn-ctrl.btn-play-pause:hover {
  transform: scale(1.05);
  box-shadow: var(--glow-purple);
}

/* ========================================================
   EXACT ZALOON TEMPLATE CARDS (Matching Desktop Plugin)
   ======================================================== */
.sidebar-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f1f5f9;
}

.template-list-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}

.template-list-container::-webkit-scrollbar {
  width: 6px;
}
.template-list-container::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}

/* Template Card */
.template-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  overflow: hidden;
  transition: all 0.2s;
}

.template-card:hover {
  background: var(--bg-card-hover);
  border-color: #64748b;
  transform: translateY(-1px);
}

.template-card.selected {
  border-color: var(--border-active);
  background: rgba(34, 197, 94, 0.06);
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.2);
}

.template-banner {
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
}

.template-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
}

.template-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.template-meta h3 {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.template-meta p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

.badge {
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 800;
  text-transform: uppercase;
}

.badge-green { background: #22c55e; color: #000; }
.badge-purple { background: linear-gradient(135deg, #8b5cf6, #ec4899); color: #fff; }
.badge-gold { background: linear-gradient(135deg, #FFE400, #FB6200); color: #000; }
.badge-cyan { background: linear-gradient(135deg, #00F2FE, #0077FE); color: #000; }

.select-indicator {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #4b5563;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  transition: all 0.2s;
  flex-shrink: 0;
}

.template-card.selected .select-indicator {
  border-color: var(--border-active);
  background: var(--border-active);
  color: #000;
}

/* ========================================================
   LIVE CAPTION STYLES OVER VIDEO SCREEN
   ======================================================== */

/* 1. Word Pop (Colored Box) */
.caption-word-pop-box {
  display: inline-block;
  background: #e11d48;
  color: #ffffff;
  padding: 4px 14px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(225, 29, 72, 0.6);
  animation: zaloonPopBounce 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes zaloonPopBounce {
  0% { transform: scale(0.85); opacity: 0.7; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1.0); opacity: 1; }
}

/* 2. Word Fill (Karaoke Word-by-Word) */
.caption-fill-word {
  display: inline-block;
  margin: 0 4px;
  transition: color 0.12s, transform 0.12s;
}

.caption-fill-word.active {
  transform: scale(1.1);
  text-shadow: 0 0 15px currentColor;
}

/* 3. Zaloon Style V3 (3-Tier Staggered Sandwich) */
.caption-v3-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}

.caption-v3-top {
  font-family: 'Poppins', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  transform: translateX(-40px);
  text-shadow: 0 2px 8px rgba(0,0,0,0.9);
}

.caption-v3-mid {
  font-family: 'Apple Garamond', Georgia, serif;
  font-style: italic;
  font-size: 42px;
  font-weight: 800;
  background: linear-gradient(135deg, #00F2FE, #0077FE);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 16px rgba(0, 242, 254, 0.85));
  margin: 2px 0;
  animation: zaloonPopBounce 0.2s ease-out;
}

.caption-v3-btm {
  font-family: 'Poppins', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  transform: translateX(40px);
  text-shadow: 0 2px 8px rgba(0,0,0,0.9);
}

/* 4. Clean Minimal Box */
.caption-clean-box {
  background: rgba(17, 17, 17, 0.85);
  color: #ffffff;
  padding: 6px 18px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.6);
  letter-spacing: 0.3px;
}

/* 5. Fire Glow */
.caption-fire-text {
  font-family: 'Impact', sans-serif;
  color: #ea580c;
  -webkit-text-stroke: 1.5px #000;
  text-shadow: 0 0 15px rgba(234, 88, 12, 0.8), 0 0 30px rgba(234, 88, 12, 0.5);
}

/* Urdu Nastaleeq Support */
.urdu-script {
  direction: rtl;
  font-family: 'Jameel Noori Nastaleeq', serif !important;
  line-height: 2.1 !important;
  font-size: 40px !important;
}

/* Form Settings Rows */
.setting-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-label {
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
  display: flex;
  justify-content: space-between;
}

.form-select, .form-input {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.form-select:focus, .form-input:focus {
  border-color: var(--accent-purple);
}

/* Big Action Button (Generate Captions) */
.btn-primary-action {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.35);
  transition: all 0.2s;
  width: 100%;
}

.btn-primary-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(139, 92, 246, 0.5);
}

.btn-primary-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Export Buttons Row */
.export-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-export {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: #e2e8f0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-export:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Modal for API Configuration */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-backdrop.open {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

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

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

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.btn-close:hover {
  color: #ffffff;
}

/* Progress / Toast Notification */
.toast-msg {
  position: fixed;
  bottom: 24px;
  right: 28px;
  background: var(--bg-card);
  border: 1px solid var(--accent-purple);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  display: none;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.toast-msg.show {
  display: flex;
  animation: slideInToast 0.3s forwards;
}

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