/* ==========================================================================
   LectorVoz Pro - Dark Mode Design System
   Paleta refinada, glassmorphism, tipografía moderna y micro-interacciones.
   ========================================================================== */

:root {
  /* Paleta Base Dark Mode */
  --bg-main: #0a0f1d;
  --bg-surface: #111827;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-card-hover: rgba(30, 41, 59, 0.9);
  --bg-elevated: #1e293b;
  --bg-input: #0d1527;

  /* Bordes & Separadores */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(56, 189, 248, 0.5);
  --border-glass: rgba(255, 255, 255, 0.12);

  /* Acentos y Gradientes */
  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-cyan: #06b6d4;
  --accent-indigo: #6366f1;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;

  --gradient-brand: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  --gradient-glow: radial-gradient(circle at top right, rgba(56, 189, 248, 0.15), transparent 40%);
  --gradient-accent: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);

  /* Texto */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  /* Resaltado de lectura */
  --highlight-bg: rgba(56, 189, 248, 0.22);
  --highlight-border: #38bdf8;
  --highlight-glow: 0 0 16px rgba(56, 189, 248, 0.35);

  /* Sombras */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.65);
  --shadow-neon: 0 0 20px rgba(59, 130, 246, 0.45);

  /* Tipografía y radios */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  /* Espaciados */
  --header-height: 76px;
}

/* Reset y Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 15% 15%, rgba(37, 99, 235, 0.1) 0px, transparent 40%),
    radial-gradient(at 85% 25%, rgba(6, 182, 212, 0.08) 0px, transparent 35%),
    radial-gradient(at 50% 90%, rgba(99, 102, 241, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar estilizada */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
  background: #27354f;
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: #3b5074;
}

/* ==========================================================================
   Header & Navegación Superior
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: rgba(10, 15, 29, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
}

.header-container {
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Logo Central de Ambystoma Technologies en el Header */
.header-logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  padding: 0 1rem;
  flex: 1;
  cursor: pointer !important;
  pointer-events: auto !important;
  text-decoration: none;
  z-index: 20;
}

.header-brand-logo {
  height: 50px;
  width: auto;
  max-width: 320px;
  object-fit: contain;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.55));
  transition: transform 0.2s ease, opacity 0.2s ease;
  cursor: pointer !important;
  pointer-events: auto !important;
}

.header-brand-logo:hover {
  transform: scale(1.03);
  opacity: 0.95;
}

@media (max-width: 1100px) {
  .header-logo-container {
    height: 44px;
    padding: 0 0.5rem;
  }
  .header-brand-logo {
    height: 38px;
    max-width: 220px;
  }
}

/* Estilos para Modal About */
.about-disclaimer {
  background: rgba(13, 21, 39, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  text-align: left;
  font-size: 0.86rem;
  line-height: 1.65;
  color: #cbd5e1;
}

.about-contact-box {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.15rem;
  color: #38bdf8;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.about-contact-box:hover {
  background: rgba(56, 189, 248, 0.22);
  transform: translateY(-1px);
}

/* Conmutador de Modos Principal (Pills en el Header) */
.mode-nav {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
}

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

.mode-btn.active {
  background: var(--gradient-brand);
  color: #ffffff;
  box-shadow: 0 2px 12px rgba(56, 189, 248, 0.4);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer !important;
  pointer-events: auto !important;
}

.brand-icon-box {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.brand-info h1,
.brand-title {
  font-size: 1.05rem;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #ffffff 40%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* Botones Base */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
  outline: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--gradient-brand);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.5);
  filter: brightness(1.08);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: #27354f;
  border-color: var(--border-focus);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-focus);
}

.btn-accent {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
}

.btn-accent:hover {
  filter: brightness(1.1);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.25);
}

.btn-icon {
  padding: 0.55rem;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Contenedores de Publicidad Reservados (Responsive Ad Units)
   ========================================================================== */
.ad-slot-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0.75rem 0;
  position: relative;
}

.ad-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.ad-container {
  width: 100%;
  background: rgba(17, 24, 39, 0.6);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.75rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.ad-container:hover {
  border-color: rgba(56, 189, 248, 0.35);
}

.ad-placeholder-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-muted);
}

.ad-placeholder-content svg {
  width: 22px;
  height: 22px;
  opacity: 0.5;
}

.ad-placeholder-content span {
  font-size: 0.75rem;
  font-weight: 500;
}

.ad-placeholder-content small {
  font-size: 0.65rem;
  color: #52627a;
}

/* Tamaños estándar de Ads */
.ad-header-banner {
  max-width: 970px;
  min-height: 90px;
}

.ad-sidebar-box {
  min-height: 250px;
  width: 100%;
}

.ad-footer-banner {
  max-width: 728px;
  min-height: 90px;
}

/* ==========================================================================
   Estructura Principal del Layout (Dos Columnas Responsivas)
   ========================================================================== */
.main-wrapper {
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.9fr;
  gap: 1.25rem;
  align-items: start;
}

/* Tarjetas Principales (Cards) */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: border-color 0.2s ease;
}

.card:hover {
  border-color: var(--border-glass);
}

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

.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.card-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.15);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

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

/* ==========================================================================
   Columna Izquierda: Archivo, Editor & Visor de Lectura
   ========================================================================== */
.left-column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Zona de Carga de Archivos (Dropzone) */
.dropzone {
  border: 2px dashed rgba(59, 130, 246, 0.35);
  border-radius: var(--radius-md);
  padding: 1.5rem 1rem;
  text-align: center;
  background: rgba(13, 21, 39, 0.6);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.dropzone:hover, .dropzone.dragover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  transform: translateY(-1px);
}

.dropzone-icon {
  font-size: 2.2rem;
  color: #38bdf8;
}

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

.dropzone-formats {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.file-info-badge {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-sm);
  color: #34d399;
  font-size: 0.82rem;
  font-weight: 500;
  width: 100%;
}

/* Pestañas de Vista: Editor vs Modo Lectura */
.view-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.tab-btn {
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

/* Área de Texto Editable */
.text-area-container {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.main-textarea {
  width: 100%;
  height: 420px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease;
}

.main-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

/* Visor Interactivo de Lectura (Modo Lectura con Resaltado) */
.reading-viewer {
  display: none;
  width: 100%;
  height: 420px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  overflow-y: auto;
  font-size: 1.05rem;
  line-height: 1.8;
  color: #cbd5e1;
}

.sentence-span {
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.sentence-span:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.sentence-span.active-reading {
  background: var(--highlight-bg);
  color: #ffffff;
  border-bottom: 2px solid var(--highlight-border);
  box-shadow: var(--highlight-glow);
  font-weight: 500;
}

/* Barra de herramientas y estadísticas del texto */
.text-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.text-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.text-actions-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* ==========================================================================
   Columna Derecha: Controles de Audio, Voz, Diccionario & Ads
   ========================================================================== */
.right-column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Panel Principal de Reproducción */
.playback-card {
  background: linear-gradient(145deg, rgba(23, 37, 84, 0.6) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1px solid rgba(59, 130, 246, 0.25);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.big-play-btn {
  width: 100%;
  height: 56px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  margin-bottom: 0.85rem;
  background: var(--gradient-brand);
  position: relative;
  overflow: hidden;
}

.big-play-btn.is-playing {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.4);
}

/* Botones Secundarios de Navegación */
.playback-controls-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.playback-controls-row .btn {
  padding: 0.55rem 0.25rem;
  font-size: 0.82rem;
}

/* Visualizador de Audio (Equalizer Bars) */
.audio-visualizer-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 28px;
  margin: 0.6rem 0;
}

.eq-bar {
  width: 4px;
  height: 6px;
  background: #38bdf8;
  border-radius: var(--radius-full);
  transition: height 0.15s ease;
}

.is-playing .eq-bar:nth-child(1) { animation: bounce 0.6s infinite ease-in-out; }
.is-playing .eq-bar:nth-child(2) { animation: bounce 0.8s infinite ease-in-out 0.1s; }
.is-playing .eq-bar:nth-child(3) { animation: bounce 0.7s infinite ease-in-out 0.2s; }
.is-playing .eq-bar:nth-child(4) { animation: bounce 0.9s infinite ease-in-out 0.3s; }
.is-playing .eq-bar:nth-child(5) { animation: bounce 0.65s infinite ease-in-out 0.15s; }
.is-playing .eq-bar:nth-child(6) { animation: bounce 0.85s infinite ease-in-out 0.25s; }

@keyframes bounce {
  0%, 100% { height: 6px; }
  50% { height: 26px; }
}

/* Barra de Progreso de Lectura */
.progress-container {
  width: 100%;
  margin-bottom: 0.65rem;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  cursor: pointer;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: var(--gradient-brand);
  border-radius: var(--radius-full);
  transition: width 0.25s ease;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Estado actual */
.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 0.4rem 0.6rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
}

.status-dot.active {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

/* ==========================================================================
   Configuración de Voz y Sliders
   ========================================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

.form-label span.val-badge {
  font-family: var(--font-mono);
  color: #38bdf8;
  font-size: 0.8rem;
}

.select-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.6rem 0.75rem;
  font-size: 0.88rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.select-control:focus {
  border-color: var(--border-focus);
}

/* Sliders personalizados */
.slider-control {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  outline: none;
  transition: background 0.2s ease;
}

.slider-control::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.slider-control::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: #ffffff;
}

/* Tarjeta rápida de Diccionario */
.dict-summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem;
  background: rgba(30, 41, 59, 0.5);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.dict-counter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dict-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

/* ==========================================================================
   Modales (Diccionario Fonético & Ajustes)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.modal-box {
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  background: #111827;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.2);
}

/* Tabla del Diccionario */
.dict-table-container {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

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

.dict-table th {
  background: var(--bg-elevated);
  padding: 0.65rem 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  position: sticky;
  top: 0;
  border-bottom: 1px solid var(--border-subtle);
}

.dict-table td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.dict-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.dict-input-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.input-control {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  outline: none;
  font-family: inherit;
}

.input-control:focus {
  border-color: var(--border-focus);
}

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

.toast {
  background: #1e293b;
  color: #ffffff;
  border: 1px solid var(--border-glass);
  padding: 0.75rem 1.15rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: toastIn 0.25s ease;
}

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

/* Footer del Sitio */
.site-footer {
  margin-top: auto;
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--border-subtle);
  background: rgba(10, 15, 29, 0.95);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

/* ==========================================================================
   Vistas de Aplicación y Transcripción de Audio
   ========================================================================== */
.app-view {
  display: block;
}

.app-view.hidden {
  display: none !important;
}

/* Botón de Grabación Pulsante */
.record-btn {
  width: 100%;
  height: 56px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  margin-bottom: 0.85rem;
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  color: #ffffff;
  box-shadow: 0 4px 18px rgba(244, 63, 94, 0.35);
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
}

.record-btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 24px rgba(244, 63, 94, 0.5);
}

.record-btn.is-recording {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  animation: pulse-recording 1.5s infinite ease-in-out;
}

@keyframes pulse-recording {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7);
  }
  50% {
    box-shadow: 0 0 0 14px rgba(244, 63, 94, 0);
  }
}

/* Selector de Hablante Actual */
.speaker-selector-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.speaker-btn {
  flex: 1;
  padding: 0.45rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  color: var(--text-secondary);
}

.speaker-btn.active.spk-1 {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
}

.speaker-btn.active.spk-2 {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border-color: rgba(168, 85, 247, 0.4);
}

/* Reproductor de Audio Embebido */
.audio-player-container {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.audio-player-container audio {
  width: 100%;
  height: 40px;
  outline: none;
  filter: invert(0.9) hue-rotate(180deg);
}

/* Cuadro de Texto de Transcripción */
.transcription-textarea {
  width: 100%;
  height: 420px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.75;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease;
}

.transcription-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

/* Opciones Checkbox con Estilo */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.84rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  accent-color: #3b82f6;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ==========================================================================
   Media Queries: Diseño 100% Responsivo para Celulares y Tablets
   ========================================================================== */
@media (max-width: 1024px) {
  .workspace-grid {
    grid-template-columns: 1fr;
    gap: 1.15rem;
  }

  .ad-header-banner,
  .ad-footer-banner {
    max-width: 100%;
  }

  .site-header {
    padding: 0 1rem;
  }

  .main-wrapper {
    padding: 1rem 0.85rem;
  }
}

@media (max-width: 768px) {
  /* Cabecera desanclada en móvil para no tapar la pantalla al hacer scroll */
  .site-header {
    position: static;
    height: auto;
    padding: 0.65rem 0.75rem;
  }

  .header-container {
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: space-between;
  }

  .brand-wrapper {
    gap: 0.55rem;
  }

  .brand-icon-box {
    width: 36px;
    height: 36px;
    font-size: 1.15rem;
  }

  .brand-title {
    font-size: 0.88rem;
    line-height: 1.2;
  }

  .header-logo-container {
    height: 38px;
    padding: 0 0.25rem;
    flex: 0 1 auto;
  }

  .header-brand-logo {
    height: 32px;
    max-width: 140px;
  }

  .header-actions {
    gap: 0.35rem;
  }

  .header-actions .btn {
    padding: 0.45rem 0.6rem;
    font-size: 0.82rem;
  }

  /* Conmutador de Modos ocupa todo el ancho inferior del header */
  .mode-nav {
    width: 100%;
    order: 10;
    margin-top: 0.2rem;
    display: flex;
    padding: 3px;
  }

  .mode-btn {
    flex: 1;
    justify-content: center;
    font-size: 0.84rem;
    padding: 0.55rem 0.6rem;
  }

  .main-wrapper {
    padding: 0.65rem 0.5rem;
    gap: 0.85rem;
  }

  .card {
    padding: 1rem 0.85rem;
    border-radius: var(--radius-md);
  }

  .card-header {
    margin-bottom: 0.75rem;
    padding-bottom: 0.6rem;
  }

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

  .card-subtitle {
    font-size: 0.72rem;
  }

  .dropzone {
    padding: 1.15rem 0.75rem;
    gap: 0.4rem;
  }

  .dropzone-icon {
    font-size: 1.8rem;
  }

  .dropzone-text {
    font-size: 0.86rem;
  }

  .dropzone-formats {
    font-size: 0.72rem;
  }

  .main-textarea, .reading-viewer {
    height: 260px;
    min-height: 240px;
    font-size: 0.88rem;
    padding: 0.75rem;
  }

  .text-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .text-stats {
    font-size: 0.72rem;
    justify-content: space-between;
    width: 100%;
  }

  .text-actions-bar {
    display: flex;
    gap: 0.35rem;
    width: 100%;
  }

  .text-actions-bar .btn {
    flex: 1;
    padding: 0.4rem 0.3rem;
    font-size: 0.75rem;
    justify-content: center;
  }

  .big-play-btn {
    height: 48px;
    font-size: 1rem;
    margin-bottom: 0.65rem;
  }

  .playback-controls-row {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.35rem;
    margin-bottom: 0.65rem;
  }

  .playback-controls-row .btn {
    padding: 0.5rem 0.2rem;
    font-size: 0.75rem;
  }

  .transcribe-options-grid {
    grid-template-columns: 1fr !important;
    gap: 0.65rem !important;
  }

  .transcription-textarea {
    height: 260px;
    min-height: 240px;
    font-size: 0.88rem;
    padding: 0.75rem;
  }

  .transcribe-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem !important;
  }

  .transcribe-actions-row button {
    flex: 1 1 calc(50% - 0.45rem);
    justify-content: center;
    padding: 0.55rem 0.5rem !important;
    font-size: 0.78rem !important;
  }

  .transcribe-actions-row #btnClearTranscript {
    flex: 0 0 auto;
    margin-left: 0 !important;
  }

  .record-btn {
    height: 48px;
    font-size: 0.98rem;
  }

  .ad-container {
    min-height: 60px;
    padding: 0.45rem;
    max-width: 100% !important;
    width: 100% !important;
    overflow: hidden !important;
  }

  .modal-box {
    max-width: 95vw;
    max-height: 92vh;
    border-radius: var(--radius-md);
  }

  .dict-input-row {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }
}

@media (max-width: 480px) {
  .brand-title br {
    display: none;
  }

  .brand-title {
    font-size: 0.82rem;
    white-space: normal;
  }

  .header-brand-logo {
    height: 28px;
    max-width: 115px;
  }

  .playback-controls-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .site-footer {
    padding: 1.25rem 0.75rem;
    font-size: 0.75rem;
  }
}

/* ==========================================================================
   Indicador de Carga y Barra de Progreso para Descarga de Audio
   ========================================================================== */
.download-loading-box {
  background: rgba(13, 21, 39, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.25s ease-out;
}

.download-spinner-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
}

.loading-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(56, 189, 248, 0.25);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

.download-progress-active {
  background: linear-gradient(90deg, #3b82f6, #06b6d4, #6366f1, #3b82f6);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.btn-disabled {
  opacity: 0.7;
  cursor: not-allowed !important;
  pointer-events: none;
}
