/* ============================================================
   Zenith Audience™ · TailAdmin Styling Overrides
   ============================================================ */

:root {
  --primary: #0f172a;
  --primary-cyan: #00E5CF;
  --primary-purple: #B845FF;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --brand: #0284c7;
}

/* Base resets & typography */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
}

/* Google Material Symbols */
.material-symbols-rounded {
  font-family: 'Material Symbols Rounded', sans-serif;
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  user-select: none;
  vertical-align: middle;
}
.material-symbols-rounded.md-16 { font-size: 16px; }
.material-symbols-rounded.md-14 { font-size: 14px; }
.material-symbols-rounded.md-18 { font-size: 18px; }
.material-symbols-rounded.md-22 { font-size: 22px; }
.material-symbols-rounded.md-24 { font-size: 24px; }
.material-symbols-rounded.md-28 { font-size: 28px; }
.material-symbols-rounded.md-48 { font-size: 48px; }

/* Google Material Symbols */
.material-symbols-rounded {
  font-family: 'Material Symbols Rounded', sans-serif;
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  user-select: none;
  vertical-align: middle;
}
.material-symbols-rounded.md-16 { font-size: 16px; }
.material-symbols-rounded.md-18 { font-size: 18px; }
.material-symbols-rounded.md-22 { font-size: 22px; }
.material-symbols-rounded.md-24 { font-size: 24px; }
.material-symbols-rounded.md-28 { font-size: 28px; }
.material-symbols-rounded.md-48 { font-size: 48px; }

/* Tab Panels transition */
.tab-panel {
  display: none !important;
  animation: fadeIn 0.25s ease-out;
}

.tab-panel.active {
  display: flex !important;
  flex-direction: column;
}

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

/* Sidebar nav items — Legacy Pay style */
.nav-item {
  transition: all 0.2s ease-in-out !important;
  padding: 8px 12px !important;
  border-radius: 6px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
}

.nav-item.active {
  background-color: #0f172a !important;
  color: #ffffff !important;
  font-weight: 600 !important;
}

.nav-item:not(.active) {
  color: #475569 !important;
}

.nav-item:not(.active):hover {
  background-color: #f1f5f9 !important;
}

/* Custom shadow classes — Legacy Pay clean style */
.shadow-theme-md {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.shadow-theme-lg {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06) !important;
}

/* Cards & Layout — Legacy Pay clean style */
.saved-script-card {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
  transition: all 0.2s ease-in-out !important;
}

.dark .saved-script-card {
  background-color: rgba(255, 255, 255, 0.03) !important;
  border-color: #2d2d4f !important;
  box-shadow: 0px 4px 8px -2px rgba(0, 0, 0, 0.2), 0px 2px 4px -2px rgba(0, 0, 0, 0.1) !important;
}

.reel-card {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  height: auto !important;
}

.reel-card:hover {
  transform: none !important;
  box-shadow: none !important;
}

/* Force vertical aspect ratio for videos inside reel-card (mini phone screen) */
.reel-card video {
  width: 100% !important;
  aspect-ratio: 9 / 16 !important;
  object-fit: cover !important;
  background-color: #000000 !important;
  border-radius: 8px !important;
  margin: 0 !important;
}

/* Force vertical aspect ratio for thumb boxes inside reel-card */
.reel-thumb-box {
  width: 100% !important;
  aspect-ratio: 9 / 16 !important;
  max-height: none !important;
  background: #111 !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  margin: 6px 0 !important;
}

.reel-thumb-box img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 12px !important;
}

.saved-script-card h4, .video-block-card h4 {
  color: #101828;
}
.dark .saved-script-card h4, .dark .video-block-card h4 {
  color: #ffffff;
}

.saved-script-title {
  color: #101828 !important;
}
.dark .saved-script-title {
  color: #ffffff !important;
}

.saved-script-preview {
  color: #667085 !important;
}
.dark .saved-script-preview {
  color: #98A2B3 !important;
}

.saved-script-meta {
  color: #98A2B3 !important;
}
.dark .saved-script-meta {
  color: #667085 !important;
}

.saved-script-tag {
  background: #F2F4F7 !important;
  border-color: #E4E7EC !important;
  color: #475467 !important;
}
.dark .saved-script-tag {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: #2d2d4f !important;
  color: #D0D5DD !important;
}

.saved-script-fulltext {
  background: #F9FAFB !important;
  border-color: #E4E7EC !important;
  color: #344054 !important;
}
.dark .saved-script-fulltext {
  background: rgba(0, 0, 0, 0.3) !important;
  border-color: #2d2d4f !important;
  color: #CBD5E1 !important;
}

.reel-caption {
  font-size: 11px !important;
  color: #475467 !important;
  line-height: 1.4 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  margin-top: 6px !important;
  height: 30px !important;
}
.dark .reel-caption {
  color: #98a2b3 !important;
}

/* Grid dos vídeos do Banco de Vídeos — responsivo: quantas miniaturas couberem na largura */
.video-grid-library {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)) !important;
  gap: 14px !important;
  width: 100% !important;
  justify-content: start !important;
  align-items: start !important;
}

/* Grid dos roteiros salvos — 4 por linha em telas grandes (cards mais largos p/ caber os 4 botões) */
.saved-scripts-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 12px !important;
  width: 100% !important;
  align-items: stretch !important;
}

@media (max-width: 1400px) {
  .saved-scripts-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 1100px) {
  .saved-scripts-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 768px) {
  .saved-scripts-grid {
    grid-template-columns: repeat(1, 1fr) !important;
  }
}

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

.toast {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
}

.dark .toast {
  background-color: #101828;
  color: #ffffff;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Formatação de botões e estatísticas dos mini cards de telefone */
.reel-card button {
  width: 100% !important;
  font-size: 11px !important;
  padding: 6px 10px !important;
  border-radius: 8px !important;
  height: 32px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.reel-card .reel-stats {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  font-size: 11px !important;
  color: #475467 !important;
}

.reel-card .reel-stats span {
  display: inline-flex !important;
  align-items: center !important;
  gap: 2px !important;
}

.reel-card .btn-delete-reel {
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 0 !important;
  background: transparent !important;
  border: none !important;
}

.hidden { display: none !important; }

/* ── COMPOSITOR CONTROL BUTTONS (PREMIUM MODERN STYLE) ── */
.broll-mode-btn, .subtitle-style-btn, .subtitle-pos-btn, .framing-btn {
  font-size: 10px !important;
  font-weight: 700 !important;
  padding: 0 !important;
  width: 30px !important;
  height: 30px !important;
  border-radius: 8px !important;
  border: 1px solid #e4e7ec !important;
  background-color: #f8fafc !important;
  color: #475467 !important;
  transition: all 0.2s ease-in-out !important;
  cursor: pointer !important;
  outline: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.dark .broll-mode-btn, .dark .subtitle-style-btn, .dark .subtitle-pos-btn, .dark .framing-btn {
  border-color: rgba(255, 255, 255, 0.08) !important;
  background-color: rgba(255, 255, 255, 0.03) !important;
  color: #cbd5e1 !important;
}

.broll-mode-btn:hover, .subtitle-style-btn:hover, .subtitle-pos-btn:hover, .framing-btn:hover {
  background-color: #f1f5f9 !important;
  color: #1e293b !important;
}

.dark .broll-mode-btn:hover, .dark .subtitle-style-btn:hover, .dark .subtitle-pos-btn:hover, .dark .framing-btn:hover {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

/* Active State — Legacy Pay black accent */
.broll-mode-btn.active, .subtitle-style-btn.active, .subtitle-pos-btn.active {
  background: #0f172a !important;
  border-color: #0f172a !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

/* Toggle Subtitles Button (mesmo visual dos botões de ícone) */
#btn-toggle-subtitles {
  font-size: 10px !important;
  font-weight: 700 !important;
  padding: 0 !important;
  width: 30px !important;
  height: 30px !important;
  border-radius: 8px !important;
  border: 1px solid #e4e7ec !important;
  background-color: #f8fafc !important;
  color: #475467 !important;
  box-shadow: none !important;
  transition: all 0.2s ease-in-out !important;
  cursor: pointer !important;
  outline: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-transform: uppercase;
}

.dark #btn-toggle-subtitles {
  border-color: rgba(255, 255, 255, 0.08) !important;
  background-color: rgba(255, 255, 255, 0.03) !important;
  color: #cbd5e1 !important;
}

#btn-toggle-subtitles:hover {
  background-color: #f1f5f9 !important;
  color: #1e293b !important;
  box-shadow: none !important;
}

.dark #btn-toggle-subtitles:hover {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

/* Botão legenda ativa — Legacy Pay black accent */
#btn-toggle-subtitles.active {
  background: #0f172a !important;
  border-color: #0f172a !important;
  color: #ffffff !important;
}

/* O botão "Transcrever & Analisar" só aparece quando há vídeo carregado (habilitado) */
#btn-analyze-my-video[disabled] {
  display: none !important;
}

/* Busca única de B-Rolls no painel (removida) */

/* ── SIDEBAR COMPRIMÍVEL (expansão responsiva ao conteúdo) ── */
#sidebar {
  width: fit-content;
  min-width: min(190px, 14vw);
  max-width: 26vw;
}
/* Menu lateral responsivo e compacto (fonte menor) */
#sidebar .menu-item-text {
  font-size: 12px !important;
  white-space: nowrap;
}
#sidebar .sidebar-brand-text {
  font-size: 16px !important;
  white-space: nowrap;
}
#sidebar #sidebar-user-name {
  font-size: 12px !important;
  white-space: nowrap;
}
#sidebar.collapsed {
  width: 60px;
  padding-left: 10px;
  padding-right: 10px;
}
#sidebar.collapsed .menu-item-text,
#sidebar.collapsed .sidebar-brand-text,
#sidebar.collapsed .sidebar-user-info {
  display: none;
}
#sidebar.collapsed .nav-item {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
#sidebar.collapsed #sidebar-user-avatar {
  margin: 0 auto;
}
#sidebar.collapsed .nav-item .material-symbols-rounded {
  margin: 0;
}
/* No mobile o menu continua como gaveta (largura cheia) */
@media (max-width: 1023px) {
  #sidebar {
    width: 250px !important;
    max-width: 80vw !important;
  }
  #sidebar.collapsed {
    width: 250px !important;
    padding-left: 20px;
    padding-right: 20px;
  }
  #sidebar.collapsed .menu-item-text,
  #sidebar.collapsed .sidebar-brand-text,
  #sidebar.collapsed .sidebar-user-info {
    display: inline;
  }
}

/* ── GRID DO EDITOR: 3 colunas uniformes (33,33% cada) na mesma linha ──
   O bundle compilado não tem classes de grid; definimos aqui com CSS puro. */
 #dashboard-grid {
   display: grid;
   grid-template-columns: 1fr;
   gap: 24px 0;
 }
 @media (min-width: 768px) {
   #dashboard-grid {
     grid-template-columns: repeat(2, 1fr);
     gap: 24px 0;
   }
 }
 #card-timeline {
   grid-column: 1 / -1;
 }

/* Transições SECAS: nenhuma suavização no enquadramento/zoom dos vídeos */
#main-video-compositor, #broll-video,
#main-video-half, #broll-half {
  transition: none !important;
}
#dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px 0;
}
@media (min-width: 768px) {
  #dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px 0;
  }
}
#card-timeline {
  grid-column: 1 / -1;
}

/* ── HELPER TEXT SIZES FOR PRE-COMPILED BUNDLE COMPATIBILITY ── */
/* Garante a fonte padrão na aba do editor (sem sobrescrever a dos ícones) */
#tab-editor, #tab-editor :not(.material-symbols-rounded) {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.text-tiny {
  font-size: 10px !important;
}
.text-micro {
  font-size: 9px !important;
}

/* ── PLAY/PAUSE CONTROLS STYLING (MODERN PILL STATE) ── */
#btn-compositor-play, #btn-compositor-pause {
  font-size: 10px !important;
  font-weight: 700 !important;
  padding: 6px 12px !important;
  border-radius: 8px !important;
  background-color: #f8fafc !important;
  color: #475467 !important;
  border: 1px solid #e4e7ec !important;
  transition: all 0.2s ease-in-out !important;
  cursor: pointer !important;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.dark #btn-compositor-play, .dark #btn-compositor-pause {
  background-color: rgba(255, 255, 255, 0.03) !important;
  color: #cbd5e1 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}
#btn-compositor-play:hover, #btn-compositor-pause:hover {
  background-color: #f1f5f9 !important;
  color: #1e293b !important;
}
.dark #btn-compositor-play:hover, .dark #btn-compositor-pause:hover {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

/* Transcription/analysis button states — Legacy Pay black style */
#btn-analyze-my-video {
  background: #0f172a !important;
  color: #ffffff !important;
  border-radius: 8px !important;
  border: none !important;
  font-weight: 600 !important;
  box-shadow: none !important;
  transition: all 0.2s ease-in-out !important;
  cursor: pointer !important;
}

#btn-analyze-my-video:hover:not(:disabled) {
  background: #1e293b !important;
  box-shadow: none !important;
}

#btn-analyze-my-video:disabled {
  background: #f1f5f9 !important;
  color: #94a3b8 !important;
  border: 1px solid #e2e8f0 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
  opacity: 0.65 !important;
}

.dark #btn-analyze-my-video:disabled {
  background: rgba(255, 255, 255, 0.05) !important;
  color: rgba(255, 255, 255, 0.3) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Export Video button states — Legacy Pay style */
#btn-export-video {
  background: #0f172a !important;
  color: #ffffff !important;
  border-radius: 8px !important;
  border: none !important;
  font-weight: 600 !important;
  box-shadow: none !important;
  transition: all 0.2s ease-in-out !important;
  cursor: pointer !important;
}

#btn-export-video:hover {
  background: #1e293b !important;
  box-shadow: none !important;
}

/* TikTok search result card buttons — Legacy Pay style */
.btn-pin-broll {
  background: #0f172a !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  transition: all 0.2s ease-in-out !important;
}
.btn-pin-broll:hover:not(:disabled) {
  background: #1e293b !important;
  box-shadow: none !important;
}

/* Secondary button — Legacy Pay outline style */
.btn-secondary {
  background: #ffffff !important;
  color: #475569 !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  font-weight: 500 !important;
  transition: all 0.2s ease-in-out !important;
}
.btn-secondary:hover {
  background: #f8fafc !important;
  color: #0f172a !important;
}

/* Botão "Escolher" do Banco de Vídeos: preto com outline (sobrepõe .btn-secondary) */
.reel-card .btn-use-reference {
  color: #000000 !important;
  background: transparent !important;
  border: 1.5px solid #000000 !important;
  font-weight: 500 !important;
  font-size: 11px !important;
  border-radius: 8px !important;
}
.reel-card .btn-use-reference:hover {
  background: #000000 !important;
  color: #ffffff !important;
  border-color: #000000 !important;
}

/* Hide video file info strip as requested by the user */
#video-info {
  display: none !important;
}

/* Botão Play/Pause só aparece ao passar o mouse sobre o player */
#btn-compositor-toggle {
  opacity: 0;
}
#compositor-wrapper:hover #btn-compositor-toggle {
  opacity: 1;
}

/* Spinner for buttons during async tasks */
.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: btn-spin-anim 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
}
@keyframes btn-spin-anim {
  to { transform: rotate(360deg); }
}

/* Draggable dashboard cards styling */
.dashboard-card {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, opacity 0.2s ease;
  user-select: none;
}

.dashboard-card h3 {
  cursor: grab;
}

.dashboard-card h3:active {
  cursor: grabbing;
}

.dashboard-card.dragging {
  opacity: 0.45 !important;
  transform: scale(0.985);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15) !important;
}

.dashboard-card.drag-over {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2) !important;
}

/* Dashboard Grid Layout: 2 colunas uniformes (50% cada) na mesma linha */
@media (min-width: 768px) {
  #dashboard-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 24px 0 !important;
    align-items: stretch !important;
  }
  #card-compositor { grid-column: span 1 !important; }
  #controls-column { grid-column: span 1 !important; }
  #card-timeline { grid-column: span 2 !important; }
  /* Mesma altura sempre (não expande); conteúdo interno rola */
  #card-compositor, #controls-column {
    height: 464px;
  }
}

/* ============================================================
   Gerador de Roteiros · componentes específicos
   ============================================================ */
#tab-generator .gen-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #9ca3af;
}

#tab-generator .gen-ref-media {
  width: 200px;
  max-width: 100%;
  margin: 0 auto;
  flex-shrink: 0;
}

#tab-generator .gen-video-tile {
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 8px;
  background: #000;
}

#tab-generator .gen-video-tile video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#tab-generator .gen-ref-info {
  min-width: 0;
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#tab-generator .gen-caption {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#tab-generator .gen-badge {
  border-radius: 9999px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
}

#tab-generator .gen-output {
  background: #f9faf9;
  min-height: 480px;
}

#tab-generator .gen-transcript {
  max-height: 96px;
  overflow-y: auto;
}

#tab-generator .gen-hook-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-right: 4px;
  border-radius: 4px;
  background: #f3f4f6;
  font-size: 10px;
  font-weight: 700;
  color: #6b7280;
}

#tab-generator .gen-analyze-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Utilitários ausentes no build do Tailwind, usados na interface */
.leading-relaxed { line-height: 1.625; }
.resize-y { resize: vertical; }

#tab-generator .gen-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}

@media (min-width: 1280px) {
  #tab-generator .gen-columns {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.05fr) minmax(0, 1.2fr);
  }
}

#tab-generator .gen-primary-btn {
  background: #0f172a;
  color: #ffffff;
}

#tab-generator .gen-primary-btn:hover {
  background: #1e293b;
}
