/* ===== VARIABLES POR DEFECTO (modo claro) ===== */
body {
  --bg-body: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%);
  --bg-navbar: #031529;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-navbar: #ffffff;
  --box-shadow: 0 10px 25px rgba(15, 23, 42, 0.1);
  --box-shadow-hover: 0 20px 40px rgba(15, 23, 42, 0.15);
  --bg-image-overlay: rgba(248, 250, 252, 0.7);
  --border-color: rgba(148, 163, 184, 0.3);
  --primary-blue: #3b82f6;
  --primary-blue-dark: #2563eb;

  margin: 0;
  font-family: 'Roboto', sans-serif;
  background: var(--bg-body);
  background-attachment: fixed;
  color: var(--text-main);
  transition: background 0.5s ease, color 0.5s ease;
  position: relative;
}

/* ===== MODO OSCURO ===== */
body.dark-mode {
  --bg-body: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
  --bg-navbar: #1e1e1e;
  --bg-card: rgba(30, 41, 59, 0.9);
  --bg-card-hover: rgba(51, 65, 85, 0.95);
  --text-main: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-navbar: #ffffff;
  --box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  --box-shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.6);
  --bg-image-overlay: rgba(15, 23, 42, 0.75);
  --border-color: rgba(71, 85, 105, 0.3);

  background-color: var(--bg-body);
  color: var(--text-main);
}

/* ===== FONDOS DE PANTALLA ===== */
body:not(.dark-mode)::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('imagenes/imaM6.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  opacity: 0.90;
  z-index: -2;
  pointer-events: none;
}

body:not(.dark-mode)::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-image-overlay);
  z-index: -1;
  pointer-events: none;
}

body.dark-mode::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('imagenes/imaM6.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  opacity: 0.35;
  z-index: -2;
  pointer-events: none;
}

body.dark-mode::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-image-overlay);
  z-index: -1;
  pointer-events: none;
}

/* ======= Reset General ======= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ======= Encabezado ======= */
.header {
  background-color: #1e1e1e;
  color: #ffffff;
  padding: 0.5rem 2.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: bold;
  flex: 1 1 100%;
}

.header h2 {
  font-size: 20px;
  padding: 0.2rem;
  color: #99ec2d;
}

.user-session {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: 0.5rem;
  gap: 1rem;
}

.usuario-label {
  font-size: 12px;
  padding: 0.4rem 0.2rem;
}

/* ======= Línea decorativa ======= */
.materiasl {
  width: 100%;
  height: 5px;
  background-color: #d3d3d3;
  margin: 10px 0 2px;
  border-radius: 3px;
}

/* ======= Botones del Header ======= */
.btn.azul {
  background-color: #007adf;
}

.btn.azul:hover {
  background-color: #045ba8;
}

.btn.rojo {
  background-color: #e00000;
}
.btn.rojo:hover {
  background-color: #a80000;
}

.btn.cerrar {
  background-color: #ef5350;
  font-size: 1rem;
  width: 250px;
  height: 32px;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: white;
}
.btn.cerrar:hover {
  background-color: #c62828;
}

/* ======= Colores de fondo adicionales ======= */
.green { background-color: #66bb6a; }
.red { background-color: #ef5350 !important; }
.azul { background-color: #007adf; }

/* ======= Contenedores ======= */
.contenedor {
  padding: 1.5rem 1rem; /* ✅ MÁRGENES REDUCIDOS */
  max-width: 1200px; /* ✅ MÁS ANCHO */
  margin: auto;
  position: relative;
  z-index: 1;
}

/* ======= CONTENEDOR GENERAL MODERNIZADO ======= */
.contenedor-general {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 20px;
  font-family: Arial, sans-serif;
  background: var(--bg-card);
  backdrop-filter: blur(15px);
  border: 1px solid var(--border-color);
  padding: 20px 20px;
  border-radius: 10px;
  box-shadow: var(--box-shadow);
  transition: all 0.3s ease;
  max-width: 1400px; /* ✅ MÁS ANCHO */
  width: 98%; /* ✅ MÁRGENES REDUCIDOS */
  margin-left: auto;
  margin-right: auto;
}

.contenedor-general:hover {
  box-shadow: var(--box-shadow-hover);
}

/* ======= Selector Materia Modernizado ======= */
.barra-superior {
  width: 100%;
}

.barra-superior select {
  display: flex;
  width: 100%;
  max-width: 100%;
  padding: 8px 12px;
  font-size: 1rem;
  border-radius: 8px;
  border: 2px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  align-items: center;
  transition: all 0.3s ease;
  cursor: pointer;
  font-weight: 500;
}

.barra-superior select:hover {
  border-color: var(--primary-blue);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.barra-superior select:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ======= Pregunta Actual Modernizada ======= */
#pregunta-actual {
  width: 100%;
  margin: 0;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.05));
  border-left: 4px solid var(--primary-blue);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--text-main);
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
  text-align: justify; /* ✅ JUSTIFICADO */
}

body.dark-mode #pregunta-actual {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.1));
  border-color: #60a5fa;
  box-shadow: 0 2px 8px rgba(96, 165, 250, 0.2);
}

.progreso-con-etiqueta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  margin: 0;
}

.etiqueta-progreso {
  font-weight: 700;
  font-size: 14px;
  margin: 0;
  color: var(--text-main);
}

/* ======= Audio Container ======= */
.audio-container {
  background-color: var(--bg-card);
  color: var(--text-main);
  padding: 30px 20px;
  border-radius: 10px;
  box-shadow: var(--box-shadow);
  margin-top: 30px;
  transition: transform 0.2s ease, background-color 0.3s ease, color 0.3s ease;
}
.audio-container:hover {
  transform: translateY(-5px);
}

.audio-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

/* ======= Barra de Progreso Modernizada ======= */
.barra-progreso {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
}

.barra-progreso input[type="range"] {
  flex: 1;
  height: 8px;
  appearance: none;
  background: linear-gradient(to right, var(--primary-blue) 0%, #e2e8f0 0%);
  border-radius: 10px;
  outline: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

body.dark-mode .barra-progreso input[type="range"] {
  background: linear-gradient(to right, var(--primary-blue) 0%, #334155 0%);
}

.barra-progreso input[type="range"]:hover {
  transform: scaleY(1.2);
}

.barra-progreso input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary-blue);
  border-radius: 50%;
  border: 3px solid white;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
  transition: all 0.2s ease;
}

.barra-progreso input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.6);
}

.barra-progreso input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--primary-blue);
  border-radius: 50%;
  border: 3px solid white;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
  transition: all 0.2s ease;
}

#progreso-texto {
  font-weight: 700;
  font-size: 14px;
  min-width: 70px;
  text-align: right;
  color: var(--text-main);
}

/* ======= TARJETAS MODERNIZADAS ======= */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
  max-width: 1200px; /* ✅ MÁS ANCHO */
  margin: 0 auto;
  width: 98%; /* ✅ MÁRGENES REDUCIDOS */
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(15px);
  color: var(--text-main);
  padding: 30px 20px;
  border-radius: 15px;
  position: relative;
  box-shadow: var(--box-shadow);
  border: 1px solid var(--border-color);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* ✅ CORRECCIÓN CRÍTICA: Pseudo-elementos NO deben bloquear clicks */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, transparent 0%, var(--card-bg-color) 100%);
  opacity: 0.08;
  z-index: 0;
  transition: opacity 0.3s ease;
  pointer-events: none; /* ✅ CRÍTICO */
}

.card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--card-accent), transparent);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 0; /* ✅ DEBE ESTAR DETRÁS */
  pointer-events: none; /* ✅ CRÍTICO */
}

.card:hover {
  transform: translateY(-8px) scale(1.02);
  background: var(--bg-card-hover);
  box-shadow: var(--box-shadow-hover);
}

.card:hover::before {
  opacity: 0.15;
}

.card:hover::after {
  transform: translateX(0);
}

.card img {
  width: 60px;
  height: 60px;
  margin-bottom: 15px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
  position: relative;
  z-index: 2; /* ✅ Por encima de pseudo-elementos */
}

.card:hover img {
  transform: scale(1.1) rotate(5deg);
}

.card-text {
  position: relative;
  z-index: 2; /* ✅ Por encima de pseudo-elementos */
  flex: 1;
}

.card h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 10px 0;
  color: var(--text-main);
}

.card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 15px;
  line-height: 1.5;
}

/* ✅ CONTENEDOR DEL BOTÓN - MUY IMPORTANTE */
.audio-btn {
  position: relative;
  z-index: 10; /* ✅ PRIORIDAD MÁXIMA */
  pointer-events: auto; /* ✅ ASEGURAR CLICKS */
}

.read-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: none;
  color: white;
  border-radius: 5px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 10; /* ✅ Por encima de todo */
  overflow: hidden;
  pointer-events: auto; /* ✅ ASEGURAR CLICKS */
}

.read-more:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.read-more:active {
  transform: translateY(0);
}

/* Colores de tarjetas */
.card.blue {
  --card-accent: #3b82f6;
  --card-bg-color: #3b82f6;
}
.card.blue .read-more {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}
.card.blue .read-more:hover {
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.card.green {
  --card-accent: #10b981;
  --card-bg-color: #10b981;
}
.card.green .read-more {
  background: linear-gradient(135deg, #10b981, #059669);
}
.card.green .read-more:hover {
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.card.orange {
  --card-accent: #f97316;
  --card-bg-color: #f97316;
}
.card.orange .read-more {
  background: linear-gradient(135deg, #f97316, #ea580c);
}
.card.orange .read-more:hover {
  box-shadow: 0 8px 25px rgba(249, 115, 22, 0.4);
}

.card.purple {
  --card-accent: #8b5cf6;
  --card-bg-color: #8b5cf6;
}
.card.purple .read-more {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}
.card.purple .read-more:hover {
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
}

.btn.cerrar {
  width: 250px !important;
  max-width: 250px !important;
  flex-shrink: 0 !important;
}

.user-session .btn.cerrar {
  width: 250px !important;
  flex-shrink: 0 !important;
}

/* ✅ BOTONES AZUL Y ROJO - CORRECCIÓN COMPLETA */
.btn.azul {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px; /* ✅ IGUAL QUE read-more */
  border: none;
  color: white;
  border-radius: 5px;
  font-weight: 600; /* ✅ IGUAL QUE read-more */
  font-size: 0.95rem; /* ✅ IGUAL QUE read-more */
  cursor: pointer !important;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* ✅ IGUAL QUE read-more */
  width: auto; /* ✅ ANCHO AUTOMÁTICO */
  min-width: 85px;
  height: auto; /* ✅ ALTURA AUTOMÁTICA */
  position: relative;
  z-index: 10;
  pointer-events: auto !important;
  background: linear-gradient(135deg, #007adf, #045ba8); /* ✅ DEGRADADO */
}

.btn.azul:hover {
  background: linear-gradient(135deg, #045ba8, #034a8f); /* ✅ DEGRADADO HOVER */
  transform: translateY(-2px); /* ✅ EFECTO IGUAL */
  box-shadow: 0 8px 25px rgba(0, 122, 223, 0.4); /* ✅ SOMBRA IGUAL */
  cursor: pointer !important;
}

.btn.azul:active {
  transform: translateY(0); /* ✅ EFECTO CLICK */
}

.btn.rojo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px; /* ✅ IGUAL QUE read-more */
  border: none;
  color: white;
  border-radius: 5px;
  font-weight: 600; /* ✅ IGUAL QUE read-more */
  font-size: 0.95rem; /* ✅ IGUAL QUE read-more */
  cursor: pointer !important;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* ✅ IGUAL QUE read-more */
  width: auto; /* ✅ ANCHO AUTOMÁTICO */
  min-width: 85px;
  height: auto; /* ✅ ALTURA AUTOMÁTICA */
  position: relative;
  z-index: 10;
  pointer-events: auto !important;
  background: linear-gradient(135deg, #e00000, #a80000); /* ✅ DEGRADADO */
}

.btn.rojo:hover {
  background: linear-gradient(135deg, #a80000, #8f0000); /* ✅ DEGRADADO HOVER */
  transform: translateY(-2px); /* ✅ EFECTO IGUAL */
  box-shadow: 0 8px 25px rgba(224, 0, 0, 0.4); /* ✅ SOMBRA IGUAL */
  cursor: pointer !important;
}

.btn.rojo:active {
  transform: translateY(0); /* ✅ EFECTO CLICK */
}








/* ===================================
   ESTILOS PARA PREGUNTA Y RESPUESTA SEPARADAS
   =================================== */

/* ✅ Contenedor principal de pregunta */
#pregunta-actual {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ✅ Número de pregunta destacado */
.numero-pregunta {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-blue);
  margin-bottom: 8px;
}

body.dark-mode .numero-pregunta {
  color: #60a5fa;
}

/* ✅ Texto de pregunta */
.texto-pregunta {
  font-size: 0.95rem;
  line-height: 1.2;
  color: var(--text-main);
  margin-bottom: 5px;
}

/* ✅ Contenedor de respuesta */
#respuesta-actual {
  background: linear-gradient(135deg, rgba(16, 185, 53, 0.15), rgba(6, 133, 17, 0.1));
  padding: 15px 20px;
  border-left: 4px solid #09b409;
  border-radius: 5px;
  margin-top: 5px;
  font-size: 0.95rem;
  color: var(--text-main);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(16, 185, 30, 0.2);
  transition: all 0.3s ease;
}

#respuesta-actual strong {
  color: #09b409;
  font-weight: 700;
}

body.dark-mode #respuesta-actual {
  background: linear-gradient(135deg, rgba(16, 61, 185, 0.2), rgba(5, 85, 150, 0.15));
  border-color: #53ff53;
  box-shadow: 0 2px 8px rgba(52, 126, 211, 0.25);
}

body.dark-mode #respuesta-actual strong {
  color: #53ff53;
}

/* ===================================
   ESTILOS PARA IMÁGENES EN MODO AUDIO
   =================================== */

/* ✅ Contenedor de imagen */
.pregunta-imagen-audio {
  margin: 10px 0;
  text-align: center;
  background: var(--bg-card);
  padding: 15px;
  border-radius: 5px;
  border: 2px solid var(--border-color);
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.dark-mode .pregunta-imagen-audio {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(71, 85, 105, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ✅ Imagen dentro del contenedor */
.img-pregunta-audio {
  max-width: 100%;
  height: auto;
  max-height: 400px;
  border-radius: 6px;
  object-fit: contain;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.pregunta-imagen-audio:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

body.dark-mode .pregunta-imagen-audio:hover {
  box-shadow: 0 6px 16px rgba(96, 165, 250, 0.4);
}










/* ======= Responsive ======= */
@media (max-width: 768px) {
  .header {
    padding: 0.5rem 1rem;
    flex-direction: column;
    align-items: stretch;
  }

  .header h1 {
    text-align: center;
    font-size: 1.6rem;
  }

  .header h2 {
    font-size: 18px;
    text-align: center;
  }

  .usuario-label {
    font-size: 10px;
    padding: 0.1rem 0.2rem;
  }

  .user-session {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .contenedor {
    padding: 0.6rem 0.5rem; /* ✅ MÁRGENES REDUCIDOS EN MÓVIL */
  }

  .contenedor-general {
    padding: 20px 15px;
  }

  .btn.azul {
    padding: 8px 14px; /* ✅ MANTENER IGUAL QUE DESKTOP */
    min-width: 68px;
    font-size: 12px;
    text-align: center;
  }

  .btn.rojo {
    padding: 8px 14px; /* ✅ MANTENER IGUAL QUE DESKTOP */
    min-width: 68px;
    font-size: 12px;
    text-align: center;
  }

  .cards {
    grid-template-columns: 1fr;
    gap: 15px;
    width: 98%; /* ✅ MÁRGENES REDUCIDOS EN MÓVIL */
  }

  .card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    flex-direction: row;
    gap: 15px;
  }

  .card img {
    width: 50px;
    height: 50px;
    margin: 0;
    flex-shrink: 0;
  }

  .card-text {
    flex: 1;
    text-align: left;
    margin: 0 10px;
  }

  .card h3 {
    font-size: 14px;
    margin: 0 0 4px;
  }

  .card p {
    font-size: 12px;
    margin: 0;
  }

  .read-more {
    padding: 8px 14px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .btn.cerrar {
    width: 85px !important;
    max-width: 85px !important;
    padding: 0.3rem 0.4rem !important;
    font-size: 0.8rem !important;
    flex-shrink: 0 !important;
  }
  
  #pregunta-actual {
    font-size: 0.85rem;
    padding: 12px 16px;
  }






  .numero-pregunta {
    font-size: 0.9rem;
  }
  
  .texto-pregunta {
    font-size: 0.85rem;
  }
  
  #respuesta-actual {
    padding: 12px 16px;
    font-size: 0.85rem;
  }
  
  .pregunta-imagen-audio {
    padding: 10px;
    margin: 10px 0;
  }
  
  .img-pregunta-audio {
    max-height: 300px;
  }







}

@media (max-width: 480px) {
  .cards {
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
  }

  .card img {
    width: 40px;
    height: 40px;
  }






  .pregunta-imagen-audio {
    padding: 8px;
    margin: 8px 0;
  }
  
  .img-pregunta-audio {
    max-height: 250px;
  }








}