/* Estilos canónicos para el Sincronizador de Subtítulos FPS */

:root {
  --bg-primary: #0b0f19;
  --bg-surface: #111827;
  --bg-card: #172133;
  --bg-card-hover: #1e2c44;
  --bg-input: #1a2639;
  --border-color: #24344d;
  --border-focus: #3b82f6;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --accent-purple: #8b5cf6;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f8fafc;
  --border-color: #e2e8f0;
  --border-focus: #2563eb;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
}

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

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

/* Layout */
.tool-layout {
  max-width: 1280px;
  width: 100%;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  flex: 1;
}

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

.tool-main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Hero */
.hero-banner {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(59, 130, 246, 0.08) 100%);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
}

.hero-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
}

.badge-purple {
  background: rgba(139, 92, 246, 0.18);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

[data-theme="light"] .badge-purple {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}

.badge-blue {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.hero-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 820px;
}

/* Zona Drag & Drop */
.dropzone-card {
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.25rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.dropzone-card:hover,
.dropzone-card.dragover {
  border-color: var(--accent-primary);
  background: var(--bg-card-hover);
}

.dropzone-icon {
  color: var(--accent-primary);
  margin-bottom: 0.75rem;
}

.dropzone-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

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

.dropzone-file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Modos de sincronización */
.sync-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  background: var(--bg-card);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.sync-tab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: all 0.2s;
}

.sync-tab-btn:hover {
  color: var(--text-primary);
}

.sync-tab-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
}

/* Paneles de Control */
.card-main {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title svg {
  color: var(--accent-primary);
}

/* Presets rápidos */
.preset-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.btn-preset {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-preset:hover {
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.btn-preset.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--accent-primary);
  color: #60a5fa;
}

/* Formularios */
.form-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-select,
.form-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0.65rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.95rem;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  cursor: pointer;
  padding-right: 2.5rem;
}

.form-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* Botones rápidos de ajuste de desfase */
.quick-adjust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn-quick-step {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  padding: 0.35rem 0.65rem;
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-quick-step:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
}

/* Botón principal */
.btn-primary {
  width: 100%;
  min-height: 44px;
  background: var(--accent-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background-color 0.2s, transform 0.1s;
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
}

.btn-primary:active {
  transform: scale(0.99);
}

/* Editor Dual y Tabla de Comparación */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.editor-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.editor-label {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.subtitles-textarea {
  width: 100%;
  height: 280px;
  padding: 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.4;
  resize: vertical;
  white-space: pre;
}

.subtitles-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* Panel de telemetría de sincronización */
.sync-summary-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(59, 130, 246, 0.08) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.summary-stat-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.summary-stat {
  display: flex;
  flex-direction: column;
}

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

.summary-stat-value {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.summary-stat-value.diff-neg {
  color: #38bdf8;
}

.summary-stat-value.diff-pos {
  color: #f59e0b;
}

.download-actions-row {
  display: flex;
  gap: 0.5rem;
}

.btn-secondary {
  min-height: 40px;
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s;
}

.btn-secondary:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
}

/* Tabla de Cues y previsualización */
.cues-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-top: 1rem;
  max-height: 320px;
}

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

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

.cues-table th {
  background: var(--bg-input);
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-primary);
  position: sticky;
  top: 0;
  z-index: 2;
}

.cues-table td.time-col {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  white-space: nowrap;
}

.badge-diff {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  display: inline-block;
}

.badge-diff.faster {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.badge-diff.slower {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

/* Modal Canónico */
.fijate-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
  padding: 1rem;
}

.fijate-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.fijate-modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.25s;
}

.fijate-modal-overlay.active .fijate-modal-box {
  transform: translateY(0);
}

.fijate-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.fijate-modal-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
}

.fijate-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
}

.fijate-modal-body {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.fijate-modal-footer {
  display: flex;
  justify-content: flex-end;
}

/* Responsividad */
@media (max-width: 900px) {
  .sync-tabs {
    grid-template-columns: 1fr;
  }
  .comparison-grid {
    grid-template-columns: 1fr;
  }
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}
