/* Layout de página completa con Flexbox */
html {
    height: 100%;
}

body {
    min-height: 100%;
    min-height: 100vh;
    font-family: 'Nunito', sans-serif;
    background-color: #dbebfa; 
    color: #333;
}

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

/* Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 15px 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* Sombra más pronunciada */
}
.logo {
  font-size: 24px;
  font-weight: bold;
}

/* Estilos para el logo en el encabezado */
.logo img {
  height: 50px; /* Altura inicial del logo */
  vertical-align: middle;
  margin-right: 10px;
}

.logo .verde {
  color: #64dd17;
}
.usuario-opciones .icono {
  font-size: 20px;
  margin-left: 20px;
  cursor: pointer;
}

/* Button Group for Home Page */
.button-group {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 20px auto; /* Center the group and add vertical spacing */
  padding: 0 20px;
  flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

/* Common Button Style */
.btn-common-style {
  padding: 10px 20px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  text-decoration: none; /* For the <a> tag */
  display: inline-flex; /* To align content vertically if needed */
  align-items: center;
  justify-content: center;
  color: #333; /* Default text color */
  background-color: #fff; /* Default background color */
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.btn-common-style:hover {
  background-color: #f0f0f0;
  border-color: #999;
}

/* Dark Mode for Common Button Style */
body.dark-mode .btn-common-style {
  background-color: #333; /* Dark mode background */
  color: #f0f0f0; /* Dark mode text color */
  border-color: #555;
  box-shadow: 0 2px 5px rgba(255,255,255,0.1);
}

body.dark-mode .btn-common-style:hover {
  background-color: #555;
  border-color: #777;
}

/* Contenido principal */
.contenido {
  flex: 1 0 auto; /* Hace que el contenido principal crezca y se encoja segun sea necesario */
  width: 100%; /* Ocupa el ancho disponible */
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 20px;
  text-align: center;
}
.contenido h1 {
  font-size: 28px;
  margin-bottom: 10px;
}
.nivel-actual {
  font-size: 18px;
  color: #666;
  margin-bottom: 20px;
}

/* Progreso */
.progreso {
  margin: 20px auto;
  width: 60%;
}
.barra {
  width: 100%;
  background-color: #ddd;
  border-radius: 10px;
  overflow: hidden;
  height: 12px;
  margin-bottom: 5px;
}
.relleno {
  height: 100%;
  background: linear-gradient(145deg, #8bc34a, #64dd17);
}

/* Títulos */
.contenido h2 {
  font-size: 22px;
  margin: 40px 0 20px;
}

/* Tarjetas de niveles */
.tarjetas-niveles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}
.tarjeta {
  background: white;
  border-radius: 16px;
  padding: 25px 20px;
  width: 200px;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s, border 0.3s;
}
.tarjeta:hover {
  transform: translateY(-5px);
}
.tarjeta.activo {
  border: 2px solid #64dd17;
}
.icono-nivel {
  font-size: 40px;
  margin-bottom: 10px;
}
.tarjeta h3 {
  font-size: 18px;
  margin-bottom: 5px;
}
.tarjeta p {
  font-size: 14px;
  color: #777;
  margin-bottom: 15px;
}
.btn-seleccionar {
  background: linear-gradient(145deg, #8bc34a, #64dd17);
  color: white;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 20px;
  display: inline-block;
  font-weight: bold;
}
.btn-seleccionar:hover {
  background: linear-gradient(145deg, #64dd17, #4caf50);
}
.btn-bloqueado {
  display: inline-block;
  background: #ccc;
  color: #666;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
  .tarjetas-niveles {
    flex-direction: column;
    align-items: center;
  }
  .progreso {
    width: 90%;
  }
}

/* Por defecto oculto en móviles si quieres */
#contenido-principal {
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Cuando tiene la clase .mostrar */
#contenido-principal.mostrar {
  display: block;
  opacity: 1;
}

/* nivel */
.form-container {
  max-width: 600px;
  margin: 30px auto;
  padding: 20px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  text-align: center;
}

.form-container h2 {
  margin-bottom: 20px;
  font-size: 1.8rem;
  color: #333;
}

/* Botón Resetear Nivel */
.btn-reset {
  display: inline-block;
  padding: 10px 16px;
  background-color: #e74c3c;
  color: #fff;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 20px;
  transition: background-color 0.3s ease;
}

.btn-reset:hover {
  background-color: #c0392b;
}

/* Contenedor de los temas */
.niveles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  margin-bottom: 25px;
}

.nivel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px 25px;
  border-radius: 12px;
  font-size: 1.1rem;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  border: 1px solid #dee2e6;
}

/* Tema desbloqueado */
.nivel.desbloqueado {
  background: linear-gradient(145deg, #3498db, #2980b9);
  color: white;
}

.nivel.desbloqueado:hover {
  background: linear-gradient(145deg, #2980b9, #3498db);
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

/* Tema bloqueado */
.nivel.bloqueado {
  background-color: #e9ecef;
  color: #adb5bd;
  cursor: not-allowed;
  box-shadow: none;
  border: 1px solid #dee2e6;
}

/* Menú de Teoría */
.menu-teoria {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 20px;
  align-items: center;
}

.btn-teoria {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  color: white;
  background: linear-gradient(145deg, #8bc34a, #64dd17);
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-teoria:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  background: linear-gradient(145deg, #64dd17, #4caf50);
}

.btn-teoria.bloqueado {
  background: #e9ecef;
  color: #adb5bd;
  cursor: not-allowed;
  box-shadow: none;
  border: 1px solid #dee2e6;
}

/* Enlace de volver */
.form-container p a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 10px 18px;
  color: #555;
  text-decoration: none;
  border-radius: 8px;
  background-color: #f1f1f1;
  font-weight: 500;
  transition: all 0.3s ease;
  border: 1px solid #ddd;
}

.form-container p a:hover {
  background-color: #e7e7e7;
  border-color: #ccc;
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

/* Responsive */
@media (max-width: 480px) {
  .form-container {
    padding: 15px;
  }
  .nivel {
    flex: 1 1 100%;
    text-align: center;
  }
}





/*teoría */

.teoria-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.card-palabra {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.2s ease-in-out;
}

.card-palabra:hover {
    transform: translateY(-5px);
}

.card-palabra img {
    max-width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.palabra-en, .palabra-es {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.palabra-es {
    color: #28a745;
}

.palabra-en {
    color: #007bff;
}

.pron {
    font-size: 14px;
    color: #555;
}

.btn-audio {
    background: #ffc107;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    transition: background 0.3s;
}

.btn-audio:hover {
    background: #e0a800;
}

.btn-volver {
    display: inline-block;
    margin-top: 20px;
    padding: 8px 12px;
    background: #007bff;
    color: white;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.3s;
}

.btn-volver:hover {
    background: #0056b3;
}









/* ===== MODO OSCURO ===== */
body.dark-mode {
  background-color: #1e1e1e;
  color: #f0f0f0;
}

/* Topbar */
body.dark-mode .topbar {
  background: #2a2a2a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}
body.dark-mode .logo .verde {
  color: #8bc34a;
}
body.dark-mode .usuario-opciones .icono {
  color: #f0f0f0;
}

/* Contenido principal */
body.dark-mode .nivel-actual {
  color: #bbb;
}

/* Progreso */
body.dark-mode .barra {
  background-color: #444;
}
body.dark-mode .relleno {
  background: linear-gradient(145deg, #8bc34a, #689f38);
}

/* Tarjetas de niveles */
body.dark-mode .tarjeta {
  background: #2a2a2a;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7);
}
body.dark-mode .tarjeta p {
  color: #ccc;
}
body.dark-mode .tarjeta.activo {
  border: 2px solid #8bc34a;
}
body.dark-mode .btn-seleccionar {
  background: linear-gradient(145deg, #8bc34a, #689f38);
}
body.dark-mode .btn-seleccionar:hover {
  background: linear-gradient(145deg, #689f38, #558b2f);
}
body.dark-mode .btn-bloqueado {
  background: #555;
  color: #aaa;
}

/* Formulario nivel */
body.dark-mode .form-container {
  background: #2a2a2a;
  box-shadow: 0 4px 12px rgba(0,0,0,0.7);
}
body.dark-mode .form-container h2 {
  color: #f0f0f0;
}
body.dark-mode .btn-reset {
  background-color: #e74c3c;
}
body.dark-mode .btn-reset:hover {
  background-color: #c0392b;
}
body.dark-mode .nivel.desbloqueado {
  background: linear-gradient(145deg, #3498db, #2980b9);
}
body.dark-mode .nivel.desbloqueado:hover {
  background: linear-gradient(145deg, #2980b9, #3498db);
}
body.dark-mode .nivel.bloqueado {
  background-color: #343a40;
  color: #6c757d;
  border: 1px solid #495057;
}

/* Dark Mode for Menú de Teoría */
body.dark-mode .btn-teoria {
  background: linear-gradient(145deg, #8bc34a, #689f38);
}

body.dark-mode .btn-teoria:hover {
  background: linear-gradient(145deg, #689f38, #558b2f);
}

body.dark-mode .btn-teoria.bloqueado {
  background-color: #343a40;
  color: #6c757d;
  border: 1px solid #495057;
}

/* Dark Mode for Volver link */
body.dark-mode .form-container p a {
  background-color: #3e3e3e;
  color: #f0f0f0;
  border-color: #555;
}

body.dark-mode .form-container p a:hover {
  background-color: #4a4a4a;
  border-color: #666;
  box-shadow: 0 4px 6px rgba(255,255,255,0.05);
}

/* Botón de cambio Modo Oscuro*/
.toggle-dark {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #64dd17;
  color: white;
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: bold;
  z-index: 999;
}
.toggle-dark:hover {
  background: #4caf50;
}
body.dark-mode .toggle-dark {
  background: #555;
}
body.dark-mode .toggle-dark:hover {
  background: #777;
}



/*Teoría*/

/* 🎯 MODO OSCURO */
body.dark-mode .card-palabra {
    background: #1e1e1e;
    box-shadow: 0 44px 8px rgba(255,255,255,0.05);
}

body.dark-mode .palabra-es {
    color: #7bed9f;
}

body.dark-mode .palabra-en {
    color: #74b9ff;
}

body.dark-mode .pron {
    color: #aaa;
}

body.dark-mode .btn-audio {
    background: #ffb347;
}

body.dark-mode .btn-audio:hover {
    background: #ff9800;
}

body.dark-mode .btn-volver {
    background: #74b9ff;
    color: #000;
}

body.dark-mode .btn-volver:hover {
    background: #0984e3;
    color: #fff;
}





/* ===== Página Felicitaciones ===== */
.contenedor {
  max-width: 900px;
  margin: 40px auto;
  padding: 20px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  text-align: center;
}

.contenedor h1 {
  font-size: 2rem;
  color: #64dd17;
  margin-bottom: 10px;
}

.contenedor p {
  font-size: 1.1rem;
  margin-bottom: 20px;
}

/* ===== Tabla de historial ===== */
.tabla-historial {
  width: 100%;
  border-collapse: collapse;
  margin: 20px auto;
  border-radius: 12px;
  overflow: hidden;
}

.tabla-historial thead {
  background: linear-gradient(145deg, #8bc34a, #64dd17);
  color: rgb(0, 0, 0);
}

.tabla-historial th, .tabla-historial td {
  padding: 12px 15px;
  text-align: left;
  border: 1px solid #ddd;
}

.tabla-historial tr:nth-child(even) {
  background-color: #f9f9f9;
}

.tabla-historial tr:hover {
  background-color: #f1f8e9;
}

/* Colores de estado */
.correcto {
  color: #2e7d32;
  font-weight: bold;
}
.incorrecto {
  color: #c62828;
  font-weight: bold;
}

/* ===== Botones de acción ===== */
.contenedor a {
  display: inline-block;
  margin: 10px 8px;
  padding: 10px 18px;
  background: linear-gradient(145deg, #8bc34a, #64dd17);
  color: white;
  border-radius: 25px;
  text-decoration: none;
  font-weight: bold;
  transition: background 0.3s ease, transform 0.2s ease;
}

.contenedor a:hover {
  background: linear-gradient(145deg, #64dd17, #4caf50);
  transform: translateY(-2px);
}

/* ===== Responsive tabla ===== */
@media (max-width: 768px) {
  .tabla-historial thead {
    display: none;
  }
    .tabla-historial tr {
    display: block;
    margin-bottom: 15px;
    
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden;
  }
  .tabla-historial td {
    display: block;
    text-align: right;
    padding: 10px;
    font-size: 0.9rem;
  }
  .tabla-historial td::before {
    content: attr(data-label);
    float: left;
    font-weight: bold;
    color: #555;
  }
}

/* ===== Modo Oscuro ===== */
body.dark-mode .contenedor {
  background: #2a2a2a;
  color: #f0f0f0;
}
body.dark-mode .tabla-historial thead {
  background: linear-gradient(145deg, #8bc34a, #689f38);
}
body.dark-mode .tabla-historial tr:nth-child(even) {
  background-color: #333;
}
body.dark-mode .tabla-historial tr:hover {
  background-color: #3a3a3a;
}

body.dark-mode .tabla-historial th,
body.dark-mode .tabla-historial td {
    border-color: #444;
}
body.dark-mode .correcto {
  color: #8bc34a;
}
body.dark-mode .incorrecto {
  color: #ff6b6b;
}
body.dark-mode .contenedor a {
  background: linear-gradient(145deg, #8bc34a, #689f38);
}
body.dark-mode .contenedor a:hover {
  background: linear-gradient(145deg, #689f38, #558b2f);
}

/* Estilos para la caja de confirmación de reinicio */
.confirmacion-box {
  display: none; /* Oculto por defecto */
  margin-top: 20px;
  text-align: center;
  padding: 15px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background-color: #f9f9f9;
}

.confirmacion-box p {
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.btn-confirm-si {
  margin-right: 10px;
  background: linear-gradient(145deg, #8bc34a, #64dd17); /* Verde */
  color: white;
}

.btn-confirm-si:hover {
  background: linear-gradient(145deg, #64dd17, #4caf50);
}

.btn-confirm-no {
  background-color: #f44336; /* Rojo */
  color: white;
}

.btn-confirm-no:hover {
  background-color: #da190b;
}

/* Modo oscuro para la caja de confirmación */
body.dark-mode .confirmacion-box {
  background-color: #2a2a2a;
  border-color: #555;
  color: #f0f0f0;
}

body.dark-mode .btn-confirm-si {
  background: linear-gradient(145deg, #8bc34a, #689f38); /* Verde oscuro */
}

body.dark-mode .btn-confirm-si:hover {
  background: linear-gradient(145deg, #689f38, #558b2f);
}

body.dark-mode .btn-confirm-no {
  background-color: #c0392b; /* Rojo oscuro */
}

body.dark-mode .btn-confirm-no:hover {
  background-color: #a93226;
}

.zona-frase {
  min-height: 150px; /* Altura mínima para que sea visible */
  border: 2px dashed #ccc; /* Borde para delimitar la zona */
  padding: 15px; /* Espaciado interno */
  display: flex; /* Para centrar el texto "Arrastra aquí las palabras" */
  align-items: center;
  justify-content: center;
  margin-top: 20px; /* Espacio superior */
  border-radius: 8px; /* Bordes redondeados */
  background-color: #f9f9f9; /* Fondo claro */
  color: #777; /* Color de texto */
  font-size: 1.1rem; /* Tamaño de fuente */
  flex-wrap: wrap; /* Permite que las palabras se envuelvan */
  gap: 10px; /* Espacio entre palabras arrastradas */
}

/* Estilos para el modo oscuro */
body.dark-mode .zona-frase {
  background-color: #333;
  border-color: #555;
  color: #bbb;
}


/*Detalles de progreso */


        .tabla-progreso {
            width: 100%;
            border-collapse: collapse;
            margin-top: 1.5rem;
            font-size: 0.9rem;
        }
        .tabla-progreso th, .tabla-progreso td {
            border: 1px solid #ddd;
            padding: 10px;
            text-align: left;
        }
        .tabla-progreso th {
            background-color: #f2f2f2;
            font-weight: 700;
        }
        .tabla-progreso tr:nth-child(even) {
            background-color: #f9f9f9;
        }
        .tabla-progreso tr:hover {
            background-color: #f1f1f1;
        }
        .resultado-correcto {
            color: #4CAF50;
            font-weight: bold;
        }
        .resultado-incorrecto {
            color: #F44336;
            font-weight: bold;
        }

/* --- Modo Oscuro para Detalles de Progreso --- */
body.dark-mode .tabla-progreso th,
body.dark-mode .tabla-progreso td {
    border-color: #444;
}

body.dark-mode .tabla-progreso th {
    background-color: #2c2c2c;
}

body.dark-mode .tabla-progreso tr:nth-child(even) {
    background-color: #2a2a2a;
}

body.dark-mode .tabla-progreso tr:hover {
    background-color: #3a3a3a;
}

body.dark-mode .resultado-correcto {
    color: #8bc34a;
}

body.dark-mode .resultado-incorrecto {
    color: #ff6b6b;
}

/* Para la vista responsiva */
@media screen and (max-width: 768px) {
    .tabla-progreso thead {
        display: none;
    }
    .tabla-progreso tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #ddd;
        border-radius: 8px;
        overflow: hidden;
    }
    .tabla-progreso td {
        display: block;
        text-align: right;
        padding-left: 50%;
        position: relative;
    }
    .tabla-progreso td::before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        width: calc(50% - 20px);
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
    }

    body.dark-mode .tabla-progreso tr {
        border-color: #444;
    }
}

body.dark-mode .tabla-progreso td::before {
    color: #bbb;
}

/* ===== Estilos Responsivos para el Encabezado ===== */

@media (max-width: 768px) {
  /* --- Ajustes para tabletas --- */
  .topbar {
    padding: 10px 15px;
  }

  .logo {
    font-size: 20px;
  }

  .logo img {
    height: 40px;
  }

  .usuario-opciones .icono {
    font-size: 18px;
    margin-left: 15px;
  }
}

@media (max-width: 480px) {
  /* --- Ajustes para móviles --- */
  .topbar {
    padding: 5px 5px;
  }
  .logo {
    font-size: 16px;
  }

  .logo img {
    height: 30px;
  }

  .usuario-opciones .icono {
    font-size: 16px;
    margin-left: 10px;
  }
}