/* ==================================== */
/* CSS Variables & Base        */
/* ==================================== */

:root {
  --bg: #f6f7f9;
  --text: #222;
  --card: #fff;
  --muted: #666;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --brand: #4caf50;
  --accent: #007bff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --text: #e9eef5;
    --card: #171a21;
    --muted: #aab3c2;
    --border: #222733;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans';
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

/* ==================================== */
/* Header & Nav            */
/* ==================================== */

.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 16px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 700;
}

.top-nav {
    display: flex;
    justify-content: flex-start; /* Alinea los elementos al inicio */
    align-items: center; /* Centra los elementos verticalmente */
    width: 100%;
    max-width: 100%;
}

.top-nav a {
  text-decoration: none;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.2s;
}

.top-nav a.active,
.top-nav a:hover {
  background: var(--border);
  margin-left: auto;
}

/* ==================================== */
/* Language Selector       */
/* ==================================== */

.lang-selector-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  
}

.lang-selector-container label {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

#lang-select {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--card);
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

#lang-select:hover,
#lang-select:focus {
  border-color: var(--brand);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  outline: none;
}

@media (prefers-color-scheme: dark) {
  #lang-select {
    background-color: var(--card);
    border: 1px solid var(--border);
  }
}

.lang-selector-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 200px);
}

.lang-selector-center h2 {
  margin-bottom: 20px;
}

/* ==================================== */
/* Dashboard & Progress    */
/* ==================================== */

.dashboard {
  padding-bottom: 2rem;
  text-align: center;
}

.progress-bar {
  width: 100%;
  max-width: 400px;
  height: 10px;
  background-color: var(--border);
  border-radius: 5px;
  margin: 0.5rem auto 0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--brand);
  transition: width 0.5s ease-in-out;
}

.dashboard p {
  font-size: 1rem;
  color: var(--muted);
}

.completed-title {
  font-size: 1.5rem;
  font-weight: 700;
}

#completedSection {
  padding-top: 1rem;
  text-align: center;
}

/* ==================================== */
/* Grid & Cards            */
/* ==================================== */

.modules-grid,
.flashcards-grid,
.quiz-options-container {
  display: grid;
  gap: 16px;
}

.modules-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.flashcards-grid {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.5rem;
  padding: 1rem 0;
}

.module-card,
.audio-item,
.question-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.3s ease;
}

.module-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.module-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 12px 12px 0 0;
  transition: transform 0.3s ease;
}

.module-card:hover img {
  transform: scale(1.05);
}

.module-card .module-details {
  font-size: 0.9rem;
  color: var(--muted);
}

.module-card.completed {
  background: #2c2c2c;
  border-color: #555;
  color: #ccc;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.module-card.completed h3 { color: #fff; }
.module-card.completed .module-details { color: #bbb; }

.module-card {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  padding: 0;
}

.module-thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.module-card:hover .module-thumb {
  transform: scale(1.05);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

.module-card .overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 10px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.module-card .module-name {
  font-size: 1rem;
  font-weight: 700;
  padding: 10px 14px 0;
}

.module-card .module-meta {
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 0 14px;
}

.module-card .module-actions {
  display: flex;
  justify-content: flex-end;
  padding: 10px 14px 14px;
}

.module-card .btn-complete {
  background: none;
  border: 1px solid var(--brand);
  color: var(--brand);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 50px;
  text-decoration: none;
  transition: all 0.3s ease;
}

.module-card .btn-complete:hover {
  background: var(--brand);
  color: white;
  transform: translateY(-2px);
}

.audio-item p {
  margin: 0;
  font-weight: 600;
}

.audio-item audio {
  width: 100%;
  outline: none;
}

/* ==================================== */
/* Flashcards              */
/* ==================================== */

.flashcard {
  background-color: var(--card);
  color: var(--text);
  border-radius: 12px;
  padding: 1rem;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-weight: bold;
  border: 1px solid var(--border);
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  position: relative;
  overflow: hidden;
}

.flashcard:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.flashcard .icon {
  max-width: 120px;
  max-height: 120px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  transition: transform 0.3s ease;
}

.flashcard:hover .icon {
  transform: scale(1.15) rotate(5deg);
}

.flashcard .flashcard-word,
.flashcard .pronunciation {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  margin-top: 0.5rem;
}

/* ==================================== */
/* Quiz                */
/* ==================================== */

.quiz-container {
  padding: 20px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.quiz-question {
  border: none;
  padding: 0;
  margin: 0;
}

.quiz-question legend {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.4;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
}

.option-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  padding: 16px;
  text-align: center;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.option-item:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.option-item input[type="radio"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}

.option-item label {
  font-size: 1.1rem;
  color: var(--muted);
  transition: color 0.2s ease;
}

.option-item input[type="radio"]:checked ~ label {
  color: var(--brand);
  font-weight: 700;
}

.option-item input[type="radio"]:checked {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.2);
  background: #e8f5e9;
}

.quiz-result {
  font-size: 1.5rem;
  text-align: center;
  margin-top: 20px;
  font-weight: 700;
}

.quiz-feedback {
  margin-top: 15px;
  padding: 15px;
  border: 1px solid #ff4d4f;
  border-radius: 8px;
  background-color: rgba(255, 77, 79, 0.1);
  color: #c62828;
  font-weight: 500;
}

.option-item.correct,
.option-item.was-correct {
  background-color: rgba(76, 175, 80, 0.2);
  border-color: #4caf50;
}

.option-item.correct label,
.option-item.was-correct label {
  color: #4caf50;
  font-weight: bold;
}

.option-item.incorrect {
  background-color: rgba(255, 77, 79, 0.2);
  border-color: #f44336;
}

.option-item.incorrect label {
  color: #f44336;
  font-weight: bold;
}

/* ==================================== */
/* Drag and Drop Design        */
/* ==================================== */

.dd-container {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.dd-item,
.dd-target {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 120px;
  text-align: center;
  background-color: var(--card);
  color: var(--muted);
  transition: background-color 0.2s, border-color 0.2s;
  user-select: none;
}

.dd-item {
  cursor: grab;
  font-size: 1.2rem;
}

.dd-item:hover {
  border-color: var(--accent);
}

.dd-item.dragging {
  opacity: 0.6;
}

.dd-target {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.05);
  border-style: dashed;
  font-size: 2.5rem;
}

.dd-target.correct {
  background-color: rgba(40, 167, 69, 0.3);
  border: 5px solid #034112;
}

.dd-target.incorrect {
  background-color: rgba(220, 53, 69, 0.3);
  border-color: #ff4d4f;
}

.dd-target img {
  max-width: 100px;
  max-height: 100px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.feedback-correct,
.feedback-incorrect {
  font-weight: bold;
  animation: fade-in-out 1.5s forwards;
}

.feedback-correct {
  color: #28a745;
}

.feedback-incorrect {
  color: red;
}

@keyframes fade-in-out {
  0% { opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* ==================================== */
/* Admin Panel Styles          */
/* ==================================== */

.admin-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 30px;
}

.admin-form label {
  font-weight: 600;
  margin-bottom: 4px;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: var(--bg);
  color: var(--text);
}

.admin-form textarea {
  min-height: 100px;
}

.admin-form select:disabled {
  background-color: rgba(220, 220, 220, 0.5);
  cursor: not-allowed;
  color: #777;
  border-color: #ccc;
}

.button-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.module-actions {
  margin-top: 8px;
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  align-items: center;
}

/* Buttons */
.btn-save,
.btn-delete,
.btn-cancel,
.btn-edit,
.btn-new,
.btn-complete,
#toggleModuleBtn {
  font-weight: 700;
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

.btn-complete,
#toggleModuleBtn {
  background: var(--brand);
  color: white;
  border-radius: 50px;
  padding: 10px 24px;
}

.btn-complete:hover,
#toggleModuleBtn:hover {
  filter: brightness(0.9);
  transform: translateY(-2px);
}

.btn-complete:active,
#toggleModuleBtn:active {
  transform: translateY(0);
}

.btn-save {
  background: var(--brand);
  color: white;
}
.btn-save:hover { background: #43a047; }

.btn-delete {
  background: #e53935;
  color: white;
}
.btn-delete:hover { background: #d32f2f; }

.btn-cancel {
  background: #6c757d;
  color: white;
}
.btn-cancel:hover { background: #5a6268; }

.btn-edit,
.btn-new {
  background: var(--accent);
  color: white;
}
.btn-edit:hover,
.btn-new:hover { background: #0056b3; }

.btn-reset {
  border: 2px solid var(--brand);
  background: #e8f5e9;
  color: #2e7d32;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}
.btn-reset:hover {
  background: #c8e6c9;
  color: #1b5e20;
  transform: scale(1.05);
}

.btn-remove-item {
  background: transparent;
  color: var(--muted);
  border: none;
  cursor: pointer;
  padding: 4px;
  font-size: 1.2rem;
}
.btn-remove-item:hover { color: #e53935; }

.btn-correct-option {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 1.4rem;
  transition: all 0.2s ease;
  opacity: 0.7;
}

.btn-correct-option:hover {
  transform: scale(1.2);
  color: #4caf50;
  opacity: 1;
}

/* ==================================== */
/* Admin Form Specifics        */
/* ==================================== */

.flashcard-item {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  background-color: var(--card);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.flashcard-item input {
  width: 100%;
}

.flashcard-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  grid-column: 1 / -1;
}

.flashcard-item-header h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
}

.flashcard-item-header .btn-remove-item {
  margin-left: auto;
}

.flashcard-placeholder {
  background-color: transparent;
  border: 1px dashed var(--muted);
  opacity: 0.7;
}

.quiz-question-item {
  background-color: var(--card);
  border: none;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 25px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease-in-out;
}

.quiz-question-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.quiz-question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.quiz-question-item h4 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
}

.quiz-options-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 15px;
}

.quiz-option-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px 15px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--bg);
  transition: all 0.2s ease;
}

.quiz-option-item:hover {
  background-color: rgba(var(--brand-rgb, 76, 175, 80), 0.1);
}

.quiz-option-item.correct {
  background-color: rgba(76, 175, 80, 0.15);
  border-color: #4caf50;
}

.quiz-option-item.correct input {
  color: #4caf50;
  font-weight: 500;
}

.quiz-option-item.correct label,
.quiz-option-item.was-correct label {
  color: #4caf50;
  font-weight: bold;
}

.quiz-option-item.incorrect {
  background-color: rgba(255, 77, 79, 0.2);
  border-color: #f44336;
}

.quiz-option-item.incorrect label {
  color: #f44336;
  font-weight: bold;
}

.quiz-placeholder {
  background-color: transparent;
  border-style: dashed;
  border-color: var(--muted);
  opacity: 0.6;
  margin-top: 15px;
}

.quiz-placeholder input {
  font-style: italic;
  font-weight: 400;
}

.quiz-option-item input[type="text"] {
  border: none;
  background: transparent;
  font-size: 1rem;
  color: var(--text);
}

.quiz-option-item input[type="text"]:focus {
  outline: none;
}

/* ==================================== */
/* Footer & General            */
/* ==================================== */

.site-footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  text-align: center;
  font-size: 1.75rem;
  line-height: 0.6;
  color: var(--muted);
}

.footer-text {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 500;
  transition: color 0.2s ease;
  text-decoration: none;
}

.github-link:hover {
  color: var(--accent);
}

.github-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
  opacity: 0.8;
  transform: translateY(1px);
}

/* Estado deshabilitado de la cuadrícula de módulos */
.modules-grid.grid-disabled {
  pointer-events: none;
  opacity: 0.5;
  cursor: not-allowed;
}
/* ==================================== */
/* Cloze Module                      */
/* ==================================== */
.cloze-module {
    padding: 20px;
    background: var(--card);
    border-radius: 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cloze-grid {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-top: 20px;
}

.cloze-sentence {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text);
}

.cloze-sentence span {
    white-space: pre-wrap; /* Mantiene los espacios en blanco dentro de los spans */
}

.cloze-input {
    flex: none; /* Evita que el input crezca más de lo necesario */
    min-width: 120px; /* Ancho mínimo para los inputs */
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text);
    background-color: var(--bg);
    transition: all 0.2s ease-in-out;
}

.cloze-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.cloze-input.correct {
    border-color: #4caf50;
    background-color: rgba(76, 175, 80, 0.1);
}

.cloze-input.incorrect {
    border-color: #f44336;
    background-color: rgba(244, 67, 54, 0.1);
}

.cloze-input:disabled {
    background-color: var(--border);
    cursor: not-allowed;
    color: var(--muted);
}

.cloze-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

.feedback-message {
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
}

.feedback-message.success {
    background-color: rgba(76, 175, 80, 0.2);
    color: #4caf50;
    border: 1px solid #4caf50;
}

.feedback-message.error {
    background-color: rgba(244, 67, 54, 0.2);
    color: #f44336;
    border: 1px solid #f44336;
}
/* ==================================== */
/* Header & Nav con Logo               */
/* ==================================== */
.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 10px 16px; /* Ajuste el padding para un header más compacto */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    display: flex; /* Usar flexbox para alinear logo, título y navegación */
    flex-direction: column; /* Por defecto en columna para móviles */
    align-items: center; /* Centrar elementos horizontalmente */
    gap: 10px; /* Espacio entre elementos */
}

.header-content {
    display: flex;
    align-items: center;
    gap: 15px; /* Espacio entre el logo y el título */
    width: 100%; /* Ocupa todo el ancho disponible */
    justify-content: center; /* Centrar logo y título */
}

.site-logo {
    height: 60px; /* Tamaño del logo */
    width: auto;
}

.site-header h1 {
    margin: 0;
    font-size: clamp(1.6rem, 4vw, 2rem);
    font-weight: 700;
    color: var(--text);
}

.top-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 8px; /* Pequeño margen superior para separar de logo/título */
    flex-wrap: wrap; /* Permitir que los elementos se envuelvan en pantallas pequeñas */
}

.top-nav a {
    text-decoration: none;
    color: var(--text);
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.2s;
    font-weight: 500;
}

.top-nav a.active,
.top-nav a:hover {
    background: var(--border);
}

.lang-selector-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 15px; /* Ajuste el margen */
}

@media (min-width: 768px) {
    .site-header {
        flex-direction: row; /* En fila para pantallas más grandes */
        justify-content: space-between; /* Espacio entre logo/título y nav */
        padding: 10px 30px;
    }
    .header-content {
        justify-content: flex-start; /* Alinear a la izquierda */
        width: auto;
    }
    .top-nav {
        margin-top: 0; /* Eliminar margen superior en desktop */
    }
}
.site-title-hidden {
    display: none; /* Oculta el título hasta que se cargue con JS */
}

/* Estilo para el título del sitio */
#siteTitle {
    font-size: 1.5rem;
    color: var(--text);
    margin: 0;
    transition: opacity 0.3s ease-in-out;
}
/* Estilos para tablas en módulos Markdown */
.wrap table {
  width: 100%;
  margin: 1.5em 0;
  border-collapse: collapse;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); /* Sombra más pronunciada */
  border-radius: 10px; /* Bordes más redondeados */
  overflow: hidden; /* Asegura que los bordes redondeados se apliquen al contenido */
  background-color: #ffffff; /* Fondo blanco para toda la tabla */
}

.wrap th, 
.wrap td {
  padding: 14px 18px; /* Más padding para mejor espaciado */
  text-align: left;
  border: 1px solid #e0e0e0; /* Bordes claros para celdas */
  color: #333333; /* Color de texto oscuro para legibilidad */
}

.wrap th {
  background-color: #007bff; /* Azul vibrante para el encabezado */
  color: #ffffff; /* Texto blanco en el encabezado para contraste */
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.07em; /* Espaciado de letras para encabezados */
  border-color: #0060cc; /* Borde más oscuro para el encabezado */
}

.wrap tr:nth-child(even) {
  background-color: #f2f7fc; /* Fondo ligeramente azulado para filas pares */
}

.wrap tr:hover {
  background-color: #e6f0fa; /* Fondo azul más intenso al pasar el ratón */
  transition: background-color 0.3s ease-in-out; /* Transición suave */
}

/* Redondeo de esquinas */
.wrap table th:first-child {
    border-top-left-radius: 9px;
}

.wrap table th:last-child {
    border-top-right-radius: 9px;
}

.wrap table tr:last-child td:first-child {
    border-bottom-left-radius: 9px;
}

.wrap table tr:last-child td:last-child {
    border-bottom-right-radius: 9px;
}

/* ==================================== */
/* Ajustes para móviles */
@media (max-width: 600px) {
  .wrap {
    overflow-x: auto; /* Scroll horizontal en móviles */
    -webkit-overflow-scrolling: touch; /* Suaviza el scroll en iOS */
  }

  .wrap table {
    width: auto;     /* Evita que se estire demasiado */
    min-width: 100%; /* Mantiene tamaño mínimo */
  }

  .wrap th,
  .wrap td {
    padding: 10px 12px; /* Reduce padding en móviles, sin tocar colores */
  }
}

/* ==================================== */
/* Navegación de Módulos - Estilo Moderno */
/* ==================================== */

.module-navigation {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 24px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.nav-link {
    flex: 0 0 calc(50% - 12px); /* ✅ siempre mitad del ancho */
    min-width: 260px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    border-radius: 16px;
    text-decoration: none;
    background: linear-gradient(135deg, var(--card), var(--background));
    border: 1px solid var(--border);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.4s ease;
}

.nav-link.previous {
    margin-right: auto; /* queda pegado a la izquierda */
}

.nav-link.next {
    margin-left: auto;  /* queda pegado a la derecha */
}

@media (max-width: 767px) {
    .nav-link {
        flex: 0 0 calc(50% - 12px); /* mitad del ancho como en desktop */
        max-width: 50%;
        margin: 0; /* sin centrado, para que queden lado a lado */
    }
    .module-navigation {
        flex-wrap: nowrap; /* evita que se apilen */
    }
}


.nav-link:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.18);
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

.nav-link-icon {
    font-size: 26px;
    color: var(--primary);
    margin-bottom: 12px;
    transition: color 0.3s ease;
}

.nav-link:hover .nav-link-icon {
    color: #fff;
}

.nav-link-image {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 14px;
}

.nav-meta h4 {
    margin: 0 0 6px 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    transition: color 0.3s ease;
}

.nav-meta span {
    font-size: 0.9rem;
    color: var(--muted);
    transition: color 0.3s ease;
}

.nav-link:hover h4,
.nav-link:hover span {
    color: #fff;
}

/* --- Adaptación en pantallas grandes --- */
@media (min-width: 768px) {
    .nav-link {
        flex-direction: row;
        align-items: center;
        gap: 20px;
        padding: 24px;
    }

    .nav-link-image {
        width: 220px;
        height: 127px;
        margin: 0;
    }

    .nav-meta {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .nav-link.next {
        flex-direction: row-reverse;
        text-align: right;
    }
}
@media (max-width: 767px) {
    .module-navigation {
        flex-direction: column; /* Apila los elementos verticalmente */
        align-items: center;    /* Centra los elementos */
        gap: 16px;              /* Reduce el espacio entre ellos para mejor ajuste */
    }
    .nav-link {
        flex: 1 1 100%;          /* Ocupa el 100% del ancho */
        max-width: 100%;
        margin: 0;
    }
    .nav-link.previous,
    .nav-link.next {
      margin: 0; /* Elimina los márgenes automáticos para que se centren */
    }
}


/* ==================================== */
/* Sidebar Navigation */
/* ==================================== */

.module-sidebar {
    position: fixed;
    top: 0;
    right: -300px; /* Oculta el sidebar por defecto */
    width: 280px;
    height: 100%;
    background-color: var(--card);
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease-in-out; /* Transición suave para la apertura/cierre */
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 20px;
    border-left: 1px solid var(--border);
}

.module-sidebar.active {
    right: 0; /* Muestra el sidebar cuando tiene la clase 'active' */
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.close-sidebar-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-sidebar-btn:hover {
    color: var(--brand);
}

.module-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto; /* Permite desplazamiento si la lista es larga */
    flex-grow: 1; /* Ocupa el espacio restante */
}

.module-list li {
    margin-bottom: 8px;
}

.module-list a {
    display: block;
    padding: 12px 16px;
    background-color: var(--bg);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    transition: all 0.2s ease;
}

.module-list a:hover {
    background-color: var(--border);
    transform: translateX(5px);
}

/* Sidebar toggle button */
.sidebar-toggle-btn {
    display: none; /* Se oculta por defecto y se muestra con JS */
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text);
    cursor: pointer;
    transition: color 0.2s ease;
}

.sidebar-toggle-btn:hover {
    color: var(--accent);
}

/* Sidebar Overlay */
#sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}
 .module-list {
    scrollbar-width: none;
}
/* Estilo para el módulo actual en el sidebar */
.module-list a.current {
    background-color: var(--brand); /* Color de fondo */
    color: white; /* Color de texto blanco */
    font-weight: 700; /* Texto en negrita para resaltar */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Sombra para darle profundidad */
    transform: none; /* Elimina la transformación de hover */
}

/* Evita que el hover sobreescriba el estilo de 'current' */
.module-list a.current:hover {
    background-color: var(--brand);
    transform: none;
} 
/* Estilo para el recuadro del tipo de módulo */
.module-list li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.module-type-tag {
    background-color: #f0f0f0;
    color: #333;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 10px;
    flex-shrink: 0;
}
/* =========================
   Componente de Audio
   ========================= */
.audio-list, #audioList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin: 1rem 0;
}

.audio-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 18px 14px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  transition: box-shadow 0.2s, transform 0.2s;
}

.audio-item:hover {
  box-shadow: 0 8px 20px rgba(0,0,0,0.13);
  transform: translateY(-3px);
}

.audio-item h4 {
  margin: 0 0 8px 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.audio-item audio {
  width: 100%;
  outline: none;
  margin-top: 6px;
  border-radius: 6px;
  background: var(--bg);
}

/* Botón de sonido tipo recuadro */
.syllable-tts-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f7fafc;
  color: #222;
  border: 1.5px solid #bcdffb;
  border-radius: 10px;
  padding: 7px 16px 7px 12px;
  font-size: 1.08rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,123,255,0.07);
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s;
  margin: 2px 0;
  outline: none;
}
.syllable-tts-btn:hover, .syllable-tts-btn:focus {
  background: #e3f2fd;
  border-color: #2196f3;
  color: #1976d2;
  box-shadow: 0 4px 16px rgba(33,150,243,0.13);
}
.syllable-tts-btn:active {
  background: #bbdefb;
  border-color: #1976d2;
}
.syllable-tts-btn .tts-icon {
  font-size: 1.2em;
  margin-left: 6px;
  color: #2196f3;
  transition: color 0.18s;
}
.syllable-tts-btn:hover .tts-icon {
  color: #1976d2;
}

