/* ==========================================================================
   Conversor de subtítulos VTT a SRT - Estilos Canónicos
   Fijate Tools
   ========================================================================== */

:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Modo oscuro por defecto */
  --bg-app: #0a0e17;
  --bg-card: #111726;
  --bg-card-hover: #162035;
  --bg-input: #0d1322;
  --bg-secondary: #1a2238;
  --border-color: #232f48;
  --border-focus: #3b82f6;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;

  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 14px 34px rgba(0, 0, 0, 0.45);
}

html[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #ffffff;
  --bg-secondary: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: #2563eb;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #94a3b8;

  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 20px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 14px 34px rgba(15, 23, 42, 0.12);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.25;
}

/* Layout y Contención */
.tool-layout {
  max-width: 1200px;
  width: 100%;
  margin: 1.5rem auto 3.5rem;
  padding: 0 1.25rem;
  flex: 1 0 auto;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
}

.card-main {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2.5rem;
}

/* Barra de Dirección y Presets */
.direction-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--border-color);
}

.direction-selector {
  display: flex;
  gap: 0.5rem;
  background-color: var(--bg-secondary);
  padding: 0.3rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.btn-direction {
  height: 42px;
  padding: 0 1.15rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-direction:hover {
  color: var(--text-main);
}

.btn-direction.active {
  background-color: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.badge-fmt {
  font-family: var(--font-mono);
  font-weight: 700;
  background-color: var(--bg-input);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--accent-blue);
}

.example-presets {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.caption-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.chip-example {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-example:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-focus);
}

/* Zona de Drag & Drop */
.dropzone-box {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.75rem 1.25rem;
  text-align: center;
  background-color: var(--bg-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.dropzone-box:hover,
.dropzone-box.drag-over {
  border-color: var(--accent-blue);
  background-color: var(--bg-card-hover);
}

.dropzone-icon {
  color: var(--accent-blue);
}

.dropzone-text strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text-main);
}

.dropzone-text span {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Editor Dual */
.editors-dual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.editor-column {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.editor-header {
  padding: 0.75rem 1rem;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.editor-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.editor-actions {
  display: flex;
  gap: 0.4rem;
}

.btn-editor-sm {
  height: 32px;
  padding: 0 10px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.8rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-editor-sm:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--accent-blue);
}

.btn-editor-sm.highlight {
  background-color: var(--accent-blue);
  color: #ffffff;
  border-color: var(--accent-blue);
}

.btn-editor-sm.highlight:hover {
  background-color: var(--accent-blue-hover);
}

.subtitles-textarea {
  width: 100%;
  height: 280px;
  padding: 0.85rem;
  background-color: var(--bg-input);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.55;
  border: none;
  outline: none;
  resize: vertical;
}

.editor-footer-meta {
  padding: 0.65rem 1rem;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stats-chip {
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.format-chip {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--accent-green);
}

.btn-text-link {
  background: transparent;
  border: none;
  font-family: var(--font-main);
  font-size: 0.8rem;
  color: var(--accent-blue);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-text-link:hover {
  text-decoration: underline;
}

/* Opciones de Saneamiento */
.clean-options-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.75rem;
}

.options-card-title {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.toggle-option {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
}

.toggle-option input[type="checkbox"] {
  margin-top: 3px;
  width: 17px;
  height: 17px;
  accent-color: var(--accent-blue);
  cursor: pointer;
}

.toggle-content {
  display: flex;
  flex-direction: column;
}

.toggle-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.toggle-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 2px;
}

.toggle-desc code {
  font-family: var(--font-mono);
  background-color: var(--bg-card);
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid var(--border-color);
}

/* Ajuste de Tiempo (Delay) */
.delay-adjustment-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-color);
}

.delay-label-group {
  display: flex;
  flex-direction: column;
}

.delay-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.delay-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.delay-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-time-step {
  height: 36px;
  padding: 0 10px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-time-step:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--accent-blue);
}

.delay-input-box {
  display: flex;
  align-items: center;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  height: 36px;
  padding: 0 0.5rem;
  width: 100px;
}

.input-offset-num {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: right;
}

.offset-unit {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-left: 4px;
}

/* Panel de Métricas */
.subtitles-metrics-panel {
  margin-bottom: 1.75rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
}

.metric-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.metric-num {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent-blue);
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Tabla de Cues e Inspección */
.cues-table-section {
  margin-top: 1.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  overflow: hidden;
}

.table-header-bar {
  padding: 0.85rem 1.15rem;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.table-title {
  font-size: 0.95rem;
}

.table-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.search-cues {
  height: 34px;
  padding: 0 0.85rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.82rem;
  outline: none;
  width: 200px;
}

.search-cues:focus {
  border-color: var(--border-focus);
}

.table-scroll-container {
  max-height: 420px;
  overflow-y: auto;
}

.cues-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.cues-table th,
.cues-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.cues-table th {
  background-color: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 2;
}

.cue-time-cell {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.cue-text-cell {
  color: var(--text-main);
}

.cue-cps-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
}

.cue-cps-badge.warning {
  color: var(--accent-amber);
}

.cue-cps-badge.normal {
  color: var(--accent-green);
}

/* Modales */
.custom-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.custom-modal-backdrop.active {
  display: flex;
}

.custom-modal-dialog {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.custom-modal-dialog.modal-wide {
  max-width: 680px;
}

.custom-modal-header {
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.custom-modal-title {
  font-size: 1.1rem;
  color: var(--text-main);
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.btn-close-modal:hover {
  color: var(--text-main);
}

.custom-modal-body {
  padding: 1.35rem;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.custom-modal-footer {
  padding: 1rem 1.35rem;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
}

.btn-action-primary,
.btn-action-secondary {
  height: 42px;
  padding: 0 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

.btn-action-primary {
  background-color: var(--accent-blue);
  color: #ffffff;
}

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

.btn-action-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

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

/* Animaciones */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsividad Móvil */
@media (max-width: 768px) {
  .tool-layout {
    padding: 0 0.85rem;
    margin: 1rem auto 2.5rem;
  }

  .card-main {
    padding: 1.15rem;
    border-radius: var(--radius-md);
  }

  .direction-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .direction-selector {
    flex-direction: column;
  }

  .btn-direction {
    width: 100%;
    justify-content: center;
  }

  .editors-dual-grid {
    grid-template-columns: 1fr;
  }

  .subtitles-textarea {
    height: 220px;
  }

  .delay-adjustment-row {
    flex-direction: column;
    align-items: stretch;
  }

  .delay-controls {
    flex-wrap: wrap;
    justify-content: center;
  }

  .search-cues {
    width: 100%;
  }

  .table-header-bar {
    flex-direction: column;
    align-items: stretch;
  }
}
