/**
 * Estilos para el Reproductor de Página Completa
 * Con diseño responsive y modo oscuro
 */

/* ==================== CONTENEDOR PRINCIPAL ==================== */
.page-reader-container {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ==================== BOTÓN FLOTANTE (MÓVIL) ==================== */
.page-reader-toggle-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10002;
  
  display: flex;
  align-items: center;
  gap: 10px;
  
  padding: 14px 20px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  border: none;
  border-radius: 50px;
  
  font-size: 15px;
  font-weight: 600;
  
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
  
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-reader-toggle-btn i {
  font-size: 20px;
}

.page-reader-toggle-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.page-reader-toggle-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.page-reader-toggle-btn.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(100px);
}

/* ==================== PANEL DE CONTROLES ==================== */
.page-reader-panel {
  position: fixed;
  bottom: -400px;
  left: 0;
  right: 0;
  z-index: 10003;
  
  background: white;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
  
  padding: 20px;
  
  transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-reader-panel.active {
  bottom: 0;
}

/* ==================== HEADER DEL PANEL ==================== */
.page-reader-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e5e7eb;
}

.page-reader-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
}

.page-reader-title i {
  font-size: 22px;
  color: #3b82f6;
}

.page-reader-header-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.page-reader-icon-btn {
  width: 36px;
  height: 36px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  background: #f3f4f6;
  border: none;
  border-radius: 50%;
  
  color: #6b7280;
  font-size: 16px;
  
  cursor: pointer;
  transition: all 0.2s ease;
}

.page-reader-icon-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

#page-reader-close-btn:hover {
  transform: rotate(90deg);
}

#page-reader-minimize-btn:hover {
  transform: scale(1.1);
}

/* ==================== CONTROLES ==================== */
.page-reader-controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Layout más compacto en móviles */
@media (max-width: 767px) {
  .page-reader-controls {
    gap: 12px;
  }
  
  /* Primera fila: Selector de voz y velocidad en una línea */
  .voice-selector-group,
  .speed-control {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  
  .voice-selector-group label,
  .speed-control label {
    font-size: 13px;
    white-space: nowrap;
    min-width: 50px;
  }
  
  .voice-select,
  .speed-control input[type="range"] {
    flex: 1;
  }
  
  .speed-value {
    min-width: 35px;
    font-size: 13px;
  }
}

/* Selector de voz */
.voice-selector-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.voice-selector-group label {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.voice-select {
  padding: 12px 16px;
  
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  
  font-size: 15px;
  color: #1f2937;
  
  cursor: pointer;
  transition: all 0.2s ease;
}

.voice-select:hover {
  border-color: #3b82f6;
  background: white;
}

.voice-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Control de velocidad */
.speed-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.speed-control label {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}

.speed-control input[type="range"] {
  width: 120px;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: #e5e7eb;
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

.speed-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
  transition: all 0.2s ease;
}

.speed-control input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 3px 8px rgba(59, 130, 246, 0.5);
}

.speed-control input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
  transition: all 0.2s ease;
}

.speed-control input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 3px 8px rgba(59, 130, 246, 0.5);
}

.speed-value {
  min-width: 40px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #3b82f6;
}

/* Modo oscuro para control de velocidad */
body.active .speed-control label {
  color: #e5e7eb;
}

body.active .speed-control input[type="range"] {
  background: #374151;
}

body.active .speed-control input[type="range"]::-webkit-slider-thumb {
  background: linear-gradient(135deg, #fdc21c 0%, #f59e0b 100%);
}

body.active .speed-control input[type="range"]::-moz-range-thumb {
  background: linear-gradient(135deg, #fdc21c 0%, #f59e0b 100%);
}

body.active .speed-value {
  color: #fdc21c;
}

/* Controles de reproducción */
.playback-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
}

.control-btn {
  width: 50px;
  height: 50px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  border: none;
  border-radius: 50%;
  
  font-size: 24px;
  
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-btn i {
  pointer-events: none;
}

/* Botón Play */
.play-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.play-btn:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.play-btn:active {
  transform: scale(1.05);
}

/* Botón Pause */
.pause-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.pause-btn:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

.pause-btn:active {
  transform: scale(1.05);
}

/* Botón Stop */
.stop-btn {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.stop-btn:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

.stop-btn:active {
  transform: scale(1.05);
}

/* Botones Skip */
.skip-btn {
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  color: white;
  font-size: 18px;
  box-shadow: 0 3px 10px rgba(139, 92, 246, 0.3);
}

.skip-btn:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  transform: scale(1.1);
  box-shadow: 0 5px 14px rgba(139, 92, 246, 0.4);
}

.skip-btn:active {
  transform: scale(1.05);
}

/* Botón Loop */
.loop-btn {
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
  color: white;
  font-size: 18px;
  box-shadow: 0 3px 10px rgba(100, 116, 139, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.loop-btn:hover {
  background: linear-gradient(135deg, #475569 0%, #334155 100%);
  transform: scale(1.1);
  box-shadow: 0 5px 14px rgba(100, 116, 139, 0.4);
}

.loop-btn:active {
  transform: scale(1.05);
}

/* Botón Loop activo */
.loop-btn.active {
  background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.5);
  animation: pulse-loop 2s infinite;
}

.loop-btn.active:hover {
  background: linear-gradient(135deg, #db2777 0%, #be185d 100%);
}

@keyframes pulse-loop {
  0%, 100% {
    box-shadow: 0 4px 16px rgba(236, 72, 153, 0.5);
  }
  50% {
    box-shadow: 0 6px 24px rgba(236, 72, 153, 0.7);
  }
}

/* ==================== BARRA DE PROGRESO ==================== */
.progress-bar-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 999px;
  width: 0%;
  transition: width 0.3s ease;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.progress-text {
  min-width: 45px;
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
}

/* ==================== RESALTADO DE PALABRAS ==================== */
.reading-highlight {
  background-color: #fff59d !important;
  background-image: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
  
  padding: 4px 6px !important;
  border-radius: 6px !important;
  
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3) !important;
  
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  
  animation: highlightPulse 0.6s ease;
}

@keyframes highlightPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* Estilos para modo oscuro del highlight de lectura */
body.active .reading-highlight {
  background-color: #374151 !important;
  background-image: linear-gradient(135deg, #4b5563 0%, #374151 100%) !important;
  
  color: #fbbf24 !important;
  font-weight: 600 !important;
  
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4) !important;
  
  border: 1px solid rgba(251, 191, 36, 0.3) !important;
}

/* ==================== NOTIFICACIONES ==================== */
.page-reader-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10004;
  
  padding: 16px 20px;
  border-radius: 12px;
  
  font-size: 14px;
  font-weight: 600;
  
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-reader-notification.show {
  opacity: 1;
  transform: translateX(0);
}

.page-reader-notification.info {
  background: #3b82f6;
  color: white;
}

.page-reader-notification.error {
  background: #ef4444;
  color: white;
}

.page-reader-notification.success {
  background: #10b981;
  color: white;
}

/* ==================== MINI-PLAYER COMPACTO ==================== */
.page-reader-mini-controls {
  display: none; /* Oculto por defecto */
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}

.page-reader-panel.compact .page-reader-header {
  margin-bottom: 12px;
  padding-bottom: 12px;
}

.page-reader-panel.compact {
  padding: 16px 20px;
}

.mini-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  min-width: 120px;
}

.mini-info i {
  font-size: 18px;
  color: #3b82f6;
  animation: music-note 2s ease-in-out infinite;
}

@keyframes music-note {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

.mini-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}

.mini-btn {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(59, 130, 246, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mini-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  transform: scale(1.1);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.mini-btn:active {
  transform: scale(1.05);
}

.mini-btn i {
  pointer-events: none; /* Asegurar que clicks pasen al botón */
}

.mini-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 200px;
}

.mini-progress-bar {
  flex: 1;
  height: 6px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.mini-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 999px;
  width: 0%;
  transition: width 0.3s ease;
}

.mini-progress span {
  min-width: 40px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
}


/* ==================== INTEGRACIÓN VISUAL ==================== */
/* Variables CSS para integración con el tema */
:root {
  --page-reader-primary: #3b82f6;
  --page-reader-secondary: #1d4ed8;
  --page-reader-accent: #fdc21c;
  --page-reader-bg: #ffffff;
  --page-reader-text: #1f2937;
}

/* Aplicar colores del tema al reproductor */
.page-reader-toggle-btn {
  background: linear-gradient(135deg, var(--page-reader-primary) 0%, var(--page-reader-secondary) 100%);
}

.page-reader-toggle-btn:hover {
  background: linear-gradient(135deg, var(--page-reader-secondary) 0%, var(--page-reader-primary) 100%);
}

.page-reader-title i {
  color: var(--page-reader-primary);
}

.voice-select:focus {
  border-color: var(--page-reader-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.speed-control input[type="range"]::-webkit-slider-thumb {
  background: linear-gradient(135deg, var(--page-reader-primary) 0%, var(--page-reader-secondary) 100%);
}

.speed-control input[type="range"]::-moz-range-thumb {
  background: linear-gradient(135deg, var(--page-reader-primary) 0%, var(--page-reader-secondary) 100%);
}

.speed-value {
  color: var(--page-reader-primary);
}

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

.progress-fill {
  background: linear-gradient(90deg, var(--page-reader-primary) 0%, var(--page-reader-secondary) 100%);
}

/* Resaltado más sutil */
.reading-highlight {
  background-color: rgba(59, 130, 246, 0.15) !important;
  background-image: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.2) 100%) !important;
  
  padding: 2px 4px !important;
  border-radius: 4px !important;
  
  box-shadow: 0 1px 3px rgba(59, 130, 246, 0.2) !important;
  
  transition: all 0.2s ease !important;
  
  animation: subtleHighlight 0.4s ease;
}

@keyframes subtleHighlight {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.02);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.9;
  }
}

/* Modo oscuro para resaltado sutil */
body.active .reading-highlight {
  background-color: rgba(253, 194, 28, 0.15) !important;
  background-image: linear-gradient(135deg, rgba(253, 194, 28, 0.1) 0%, rgba(253, 194, 28, 0.2) 100%) !important;
  
  color: var(--page-reader-accent, #fdc21c) !important;
  font-weight: 500 !important;
  
  box-shadow: 0 1px 3px rgba(253, 194, 28, 0.3) !important;
  
  border: 1px solid rgba(253, 194, 28, 0.2) !important;
}

/* ==================== MODO OSCURO ==================== */
body.active .page-reader-panel {
  background: #1f2937;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5);
}


body.active .page-reader-header {
  border-bottom-color: #374151;
}

body.active .page-reader-title {
  color: #f9fafb;
}

body.active .page-reader-title i {
  color: #fdc21c;
}

body.active .page-reader-close-btn {
  background: #374151;
  color: #9ca3af;
}

body.active .page-reader-close-btn:hover {
  background: #4b5563;
  color: #e5e7eb;
}

body.active .voice-selector-group label {
  color: #e5e7eb;
}

body.active .voice-select {
  background: #374151;
  border-color: #4b5563;
  color: #f9fafb;
}

body.active .voice-select:hover {
  border-color: #fdc21c;
  background: #4b5563;
}

body.active .voice-select:focus {
  border-color: #fdc21c;
  box-shadow: 0 0 0 3px rgba(253, 194, 28, 0.1);
}

body.active .progress-bar {
  background: #374151;
}

body.active .progress-fill {
  background: linear-gradient(90deg, #fdc21c 0%, #f59e0b 100%);
}

body.active .progress-text {
  color: #9ca3af;
}

body.active .page-reader-toggle-btn {
  background: linear-gradient(135deg, #fdc21c 0%, #f59e0b 100%);
  color: #1f2937;
}

body.active .page-reader-toggle-btn:hover {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

body.active .page-reader-icon-btn {
  background: #374151;
  color: #9ca3af;
}

body.active .page-reader-icon-btn:hover {
  background: #4b5563;
  color: #e5e7eb;
}

body.active .mini-info {
  color: #e5e7eb;
}

body.active .mini-info i {
  color: #fdc21c;
}

body.active .mini-btn {
  background: linear-gradient(135deg, #fdc21c 0%, #f59e0b 100%);
  color: #1f2937;
}

body.active .mini-btn:hover {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

body.active .mini-progress-bar {
  background: #374151;
}

body.active .mini-progress-fill {
  background: linear-gradient(90deg, #fdc21c 0%, #f59e0b 100%);
}

body.active .mini-progress span {
  color: #9ca3af;
}

/* ==================== RESPONSIVE - ESCRITORIO ==================== */
@media (min-width: 768px) {
  /* En escritorio, usar botón flotante también pero con diseño mejorado */
  .page-reader-toggle-btn {
    bottom: 30px;
    right: 30px;
    padding: 14px 20px;
    font-size: 15px;
  }
  
  .page-reader-panel {
    position: fixed;
    bottom: -500px;
    top: auto;
    right: 30px; /* Posicionado en la esquina derecha */
    left: auto;
    transform: translateY(0); /* Animación simple como móvil */
    opacity: 0;
    
    max-width: 420px; /* Un poco más ancho para mejor usabilidad */
    width: auto;
    min-width: 380px; /* Ancho mínimo cómodo */
    
    padding: 18px; /* Un poco más de padding para mejor respiración */
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .page-reader-panel.active {
    bottom: 30px; /* Aparece justo arriba del botón */
    transform: translateY(0); /* Animación simple como móvil */
    opacity: 1;
  }
  
  .page-reader-header {
    margin-bottom: 16px; /* Reducido de 20px */
    padding-bottom: 12px; /* Reducido de 15px */
  }
  
  .page-reader-title {
    font-size: 16px; /* Reducido de 18px */
  }
  
  .page-reader-title i {
    font-size: 18px; /* Reducido de 22px */
  }
  
  .page-reader-controls {
    display: flex;
    flex-direction: column; /* Mantener columna para esquina */
    align-items: stretch;
    gap: 12px;
  }
  
  /* Contenedor horizontal para acento y velocidad */
  .page-reader-controls-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
  }
  
  /* En pantallas muy pequeñas, volver a columna */
  @media (max-width: 400px) {
    .page-reader-controls-row {
      flex-direction: column;
      gap: 8px;
      align-items: stretch;
    }
    
    .voice-selector-group,
    .speed-control {
      flex-direction: row;
    }
  }
  
  .voice-selector-group {
    flex-direction: row; /* Cambio a horizontal */
    align-items: center;
    gap: 8px;
    flex: 1;
  }
  
  .voice-selector-group label {
    margin: 0;
    font-size: 12px;
    white-space: nowrap;
    min-width: 50px;
  }
  
  .voice-select {
    flex: 1; /* Ocupa el espacio restante */
    padding: 8px 10px;
    font-size: 13px;
  }

  .speed-control {
    flex-direction: row; /* Cambio a horizontal */
    align-items: center;
    gap: 8px;
    flex: 1;
  }
  
  .speed-control label {
    font-size: 12px;
    white-space: nowrap;
    min-width: 60px;
  }
  
  .speed-control input[type="range"] {
    flex: 1; /* Ocupa el espacio restante */
    min-width: 80px;
  }
  
  .speed-value {
    font-size: 12px;
    min-width: 35px;
    text-align: center;
  }
  
  .playback-controls {
    justify-content: center; /* Centrar botones */
    gap: 8px;
  }
  
  /* Botones más pequeños en escritorio */
  .control-btn {
    width: 50px; /* Consistente con móvil */
    height: 50px;
    font-size: 20px;
  }
  
  .stop-btn {
    width: 42px; /* Reducido de 50px */
    height: 42px; /* Reducido de 50px */
    font-size: 16px; /* Reducido de 20px */
  }
  
  .skip-btn {
    width: 40px; /* Reducido de 45px */
    height: 40px; /* Reducido de 45px */
    font-size: 16px; /* Reducido de 18px */
  }
  
  .loop-btn {
    width: 40px; /* Reducido de 45px */
    height: 40px; /* Reducido de 45px */
    font-size: 16px; /* Reducido de 18px */
  }
  
  .progress-bar-container {
    display: flex;
    flex-direction: column; /* Cambio a columna para esquina */
    align-items: stretch;
    gap: 6px;
  }
  
  .progress-bar {
    width: 100%; /* Ocupa todo el ancho */
    height: 6px;
  }
  
  .progress-text {
    text-align: center; /* Centrado */
    font-size: 12px;
    margin-top: 2px;
  }

  /* Mini-player en desktop */
  .page-reader-mini-controls {
    flex-direction: row;
    gap: 16px; /* Reducido de 20px */
  }

  .mini-info {
    min-width: 120px; /* Reducido de 140px */
    font-size: 13px; /* Reducido de 14px */
  }

  .mini-progress {
    max-width: 200px; /* Reducido de 250px */
  }
}

/* ==================== ESCRITORIO GRANDE - OPTIMIZADO ==================== */
@media (min-width: 1024px) {
  .page-reader-panel {
    max-width: 400px; /* Tamaño óptimo para pantallas grandes */
    width: auto;
    min-width: 360px;
    padding: 16px;
    right: 25px;
  }
  
  /* Ajustar gap para pantallas grandes */
  .page-reader-controls-row {
    gap: 10px;
  }
  
  .voice-selector-group label {
    min-width: 45px;
    font-size: 11px;
  }
  
  .speed-control label {
    min-width: 55px;
    font-size: 11px;
  }
  
  .page-reader-header {
    margin-bottom: 12px; /* Más compacto */
    padding-bottom: 10px;
  }
  
  .page-reader-title {
    font-size: 15px; /* Más pequeño */
  }
  
  .page-reader-controls {
    gap: 10px; /* Más compacto */
  }
  
  .voice-selector-group {
    gap: 6px;
  }
  
  .voice-selector-group label {
    font-size: 12px; /* Más pequeño */
  }
  
  .voice-select {
    width: 120px; /* Más pequeño */
    padding: 8px 10px; /* Más compacto */
    font-size: 13px;
  }
  
  .speed-control {
    gap: 4px;
  }
  
  .speed-control label {
    font-size: 12px; /* Más pequeño */
  }
  
  .speed-control input[type="range"] {
    width: 80px; /* Más pequeño */
  }
  
  .speed-value {
    font-size: 12px;
    min-width: 30px;
  }
  
  .playback-controls {
    gap: 8px; /* Más compacto */
  }
  
  /* Botones aún más pequeños en desktop grande */
  .control-btn {
    width: 50px; /* Consistente */
    height: 50px;
    font-size: 20px;
  }
  
  .stop-btn {
    width: 38px; /* Más pequeño */
    height: 38px;
    font-size: 14px;
  }
  
  .skip-btn {
    width: 36px; /* Más pequeño */
    height: 36px;
    font-size: 14px;
  }
  
  .loop-btn {
    width: 36px; /* Más pequeño */
    height: 36px;
    font-size: 14px;
  }
  
  .progress-bar-container {
    gap: 8px;
    width: 160px; /* Más pequeño */
  }
  
  .progress-bar {
    height: 5px; /* Más delgado */
  }
  
  .progress-text {
    width: 35px;
    font-size: 12px;
  }
}

/* ==================== ESCRITORIO EXTRA GRANDE - OPTIMIZADO ==================== */
@media (min-width: 1440px) {
  .page-reader-panel {
    max-width: 450px; /* Más ancho para pantallas extra grandes */
    width: auto;
    min-width: 400px;
    padding: 20px; /* Más padding para mejor respiración */
    right: 20px;
  }
  
  /* Ajustar gap para pantallas extra grandes */
  .page-reader-controls-row {
    gap: 12px; /* Más espacio entre elementos */
  }
  
  .voice-selector-group label {
    min-width: 50px; /* Aumentado de 40px */
    font-size: 13px; /* Aumentado de 10px */
  }
  
  .speed-control label {
    min-width: 60px; /* Aumentado de 50px */
    font-size: 13px; /* Aumentado de 10px */
  }
  
  .page-reader-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
  }
  
  .page-reader-title {
    font-size: 14px;
  }
  
  .page-reader-controls {
    gap: 8px;
  }
  
  .voice-selector-group label {
    font-size: 11px;
  }
  
  .voice-select {
    width: 100px;
    padding: 6px 8px;
    font-size: 12px;
  }
  
  .speed-control label {
    font-size: 11px;
  }
  
  .speed-control input[type="range"] {
    width: 70px;
  }
  
  .speed-value {
    font-size: 11px;
    min-width: 25px;
  }
  
  .playback-controls {
    gap: 6px;
  }
  
  /* Botones más grandes para pantallas extra grandes */
  .control-btn {
    width: 50px; /* Consistente */
    height: 50px;
    font-size: 20px;
  }
  
  .stop-btn {
    width: 48px; /* Aumentado de 34px */
    height: 48px;
    font-size: 16px; /* Aumentado de 12px */
  }
  
  .skip-btn {
    width: 45px; /* Aumentado de 32px */
    height: 45px;
    font-size: 16px; /* Aumentado de 12px */
  }
  
  .loop-btn {
    width: 45px; /* Aumentado de 32px */
    height: 45px;
    font-size: 16px; /* Aumentado de 12px */
  }
  
  .progress-bar-container {
    gap: 6px;
    width: 140px;
  }
  
  .progress-bar {
    height: 4px;
  }
  
  .progress-text {
    width: 30px;
    font-size: 11px;
  }
}

/* ==================== PANTALLAS ULTRA GRANDES - MÁXIMA COMODIDAD ==================== */
@media (min-width: 1920px) {
  .page-reader-panel {
    max-width: 500px; /* Aún más ancho para pantallas ultra grandes */
    min-width: 450px;
    padding: 24px; /* Más padding para pantallas muy grandes */
    right: 30px;
  }
  
  .page-reader-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
  }
  
  .page-reader-title {
    font-size: 18px; /* Título más grande */
  }
  
  .page-reader-controls {
    gap: 16px; /* Más espacio entre secciones */
  }
  
  .page-reader-controls-row {
    gap: 16px;
  }
  
  .voice-selector-group label,
  .speed-control label {
    font-size: 14px; /* Labels más grandes */
    min-width: 60px;
  }
  
  .voice-select,
  .speed-control input[type="range"] {
    font-size: 14px;
    padding: 12px 16px;
  }
  
  .speed-value {
    font-size: 14px;
  }
  
  /* Botones más grandes para pantallas ultra grandes */
  .control-btn {
    width: 50px; /* Consistente */
    height: 50px;
    font-size: 20px;
  }
  
  .stop-btn {
    width: 55px;
    height: 55px;
    font-size: 20px;
  }
  
  .skip-btn,
  .loop-btn {
    width: 50px;
    height: 50px;
    font-size: 18px;
  }
  
  .progress-bar-container {
    gap: 12px;
    width: 200px;
  }
  
  .progress-bar {
    height: 8px; /* Barra más gruesa */
  }
  
  .progress-text {
    font-size: 14px;
    width: 50px;
  }
}

/* ==================== RESPONSIVE - MÓVIL MEDIANO ==================== */
@media (min-width: 481px) and (max-width: 767px) {
  .page-reader-panel {
    padding: 18px;
  }
  
  /* Selector de voz más compacto */
  .voice-selector-group {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }
  
  .voice-selector-group label {
    font-size: 14px;
    white-space: nowrap;
    min-width: 55px;
  }
  
  .voice-select {
    flex: 1;
    padding: 11px 14px;
    font-size: 15px;
  }
  
  /* Control de velocidad más compacto */
  .speed-control {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }
  
  .speed-control label {
    font-size: 14px;
    white-space: nowrap;
    min-width: 65px;
  }
  
  .speed-control input[type="range"] {
    flex: 1;
    min-width: 100px;
  }
  
  .speed-value {
    font-size: 14px;
    min-width: 40px;
  }
}

/* ==================== RESPONSIVE - TABLETS ==================== */
@media (min-width: 768px) and (max-width: 1024px) {
  .page-reader-panel {
    padding: 16px;
  }
  
  .control-btn {
    width: 50px; /* Consistente */
    height: 50px;
    font-size: 20px;
  }
  
  .stop-btn {
    width: 45px;
    height: 45px;
    font-size: 18px;
  }
}

/* ==================== RESPONSIVE - MÓVIL PEQUEÑO ==================== */
@media (max-width: 480px) {
  .page-reader-toggle-btn {
    bottom: 15px;
    right: 15px;
    padding: 12px 16px;
    font-size: 14px;
  }
  
  .page-reader-toggle-btn span {
    display: none; /* Ocultar texto en móviles pequeños */
  }
  
  .page-reader-toggle-btn i {
    font-size: 24px;
  }
  
  .page-reader-panel {
    padding: 16px;
    max-width: 95vw; /* Usar casi todo el ancho en móviles pequeños */
    min-width: 320px;
  }
  
  .page-reader-title {
    font-size: 16px;
  }
  
  /* Botones más grandes para mejor usabilidad táctil */
  .control-btn {
    width: 50px; /* Consistente */
    height: 50px;
    font-size: 20px;
  }
  
  .stop-btn {
    width: 50px; /* Aumentado de 45px */
    height: 50px;
    font-size: 20px; /* Aumentado de 18px */
  }
  
  .playback-controls {
    gap: 12px;
  }
  
  /* Selector de voz más compacto */
  .voice-selector-group {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  
  .voice-selector-group label {
    font-size: 13px;
    white-space: nowrap;
    min-width: 50px;
  }
  
  .voice-select {
    flex: 1;
    padding: 10px 12px;
    font-size: 14px;
  }
  
  /* Control de velocidad más compacto */
  .speed-control {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  
  .speed-control label {
    font-size: 13px;
    white-space: nowrap;
    min-width: 60px;
  }
  
  .speed-control input[type="range"] {
    flex: 1;
    min-width: 80px;
  }
  
  .speed-value {
    font-size: 13px;
    min-width: 35px;
  }

  /* Skip buttons más grandes para mejor usabilidad */
  .skip-btn {
    width: 50px; /* Aumentado de 40px */
    height: 50px;
    font-size: 18px; /* Aumentado de 16px */
  }

  .loop-btn {
    width: 50px; /* Aumentado de 40px */
    height: 50px;
    font-size: 18px; /* Aumentado de 16px */
  }

  /* Mini-player en móvil */
  .page-reader-mini-controls {
    flex-wrap: wrap;
    gap: 12px;
  }

  .mini-info {
    min-width: 100px;
    font-size: 13px;
  }

  .mini-btn {
    width: 38px;
    height: 38px;
    font-size: 14px;
  }

  .mini-progress {
    flex: 1;
    min-width: 100%;
    order: 3;
  }
}

/* ==================== ANIMACIONES ADICIONALES ==================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-reader-panel.active {
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== ACCESIBILIDAD ==================== */
.control-btn:focus,
.page-reader-toggle-btn:focus,
.page-reader-close-btn:focus,
.voice-select:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

body.active .control-btn:focus,
body.active .page-reader-toggle-btn:focus,
body.active .page-reader-close-btn:focus,
body.active .voice-select:focus {
  outline-color: #fdc21c;
}

/* Reducir movimiento para usuarios que lo prefieren */
@media (prefers-reduced-motion: reduce) {
  .page-reader-panel,
  .page-reader-toggle-btn,
  .control-btn,
  .reading-highlight,
  .progress-fill {
    transition: none;
    animation: none;
  }
}

