/* ============================================
   VARIABLES Y RESET
   ============================================ */

:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --success-color: #10b981;
  --error-color: #ef4444;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --border-color: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --transition: all 0.2s ease;
}

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

/* ============================================
   TIPOGRAFÍA Y ESTILOS BASE
   ============================================ */

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans",
    "Droid Sans", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.6;
  padding: 20px;
}

h1,
h2,
h3,
h4 {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

h1 {
  font-size: 2.5rem;
  color: var(--bg-primary);
  text-align: center;
  margin-bottom: 2rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1rem;
}

p {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

/* ============================================
   CONTENEDOR PRINCIPAL
   ============================================ */

#temas-list,
#test-container {
  max-width: 800px;
  margin: 0 auto;
  background: var(--bg-primary);
  border-radius: 16px;
  padding: 3rem;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.4s ease-in;
}

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

/* ============================================
   LISTA DE TEMAS
   ============================================ */

#temas-list ul {
  list-style: none;
  display: grid;
  gap: 1rem;
}

#temas-list li {
  background: var(--bg-secondary);
  border-radius: 12px;
  transition: var(--transition);
  overflow: hidden;
  border: 2px solid transparent;
}

#temas-list li:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
}

#temas-list a {
  display: block;
  padding: 1.5rem;
  color: var(--text-primary);
}

.tema-tag {
  display: inline-block;
  background: var(--primary-color);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

#temas-list strong {
  font-size: 1rem;
  color: var(--text-primary);
  display: block;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

#temas-list small {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ============================================
   EXÁMENES ESPECIALES
   ============================================ */

.examenes-especiales {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border-color);
}

.examenes-especiales h2 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.examenes-especiales ul {
  list-style: none;
  display: grid;
  gap: 1rem;
}

.examenes-especiales li {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  transition: var(--transition);
  overflow: hidden;
  border: 2px solid transparent;
}

.examenes-especiales li:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-lg);
}

.examenes-especiales a {
  display: block;
  padding: 1.5rem;
  color: white;
}

.examenes-especiales strong {
  font-size: 1.25rem;
  color: white;
  display: block;
  margin-bottom: 0.5rem;
}

.examenes-especiales small {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
}

/* ============================================
   NAVEGACIÓN
   ============================================ */

#navegacion {
  /* background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 12px; */
}

#navegacion p {
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-primary);
}

#navegacion a {
  display: inline-block;
  margin-top: 1rem;
  color: var(--primary-color);
  font-weight: 500;
}

#navegacion a:hover {
  text-decoration: underline;
}

/* ============================================
   BOTONES
   ============================================ */

button {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  margin-right: 0.5rem;
  box-shadow: var(--shadow-sm);
  font-family: inherit;
}

button:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  background: var(--border-color);
  cursor: not-allowed;
  opacity: 0.5;
  color: black;
}

/* ============================================
   BOTONES DE RESPUESTAS
   ============================================ */

#respuestas {
  margin: 2rem 0;
}

#respuestas h4 {
  margin-bottom: 1rem;
}

#respuestas button {
  width: 100%;
  text-align: left;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.5;
  transition: var(--transition);
}

#respuestas button:hover:not(:disabled) {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateX(8px);
}

#respuestas button:disabled {
  opacity: 1;
}

/* Respuesta correcta */
#respuestas button[data-correcta="true"]:disabled,
#respuestas button.correcta {
  background: var(--success-color) !important;
  color: white !important;
  border-color: var(--success-color) !important;
}

/* Respuesta incorrecta seleccionada */
#respuestas button.incorrecta {
  background: var(--error-color) !important;
  color: white !important;
  border-color: var(--error-color) !important;
}

/* ============================================
   PREGUNTA
   ============================================ */

#pregunta {
  margin: 2rem 0;
  border-radius: 12px;
}

#pregunta h3 {
  color: var(--primary-color);
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

#pregunta p {
  font-size: 1.15rem;
  line-height: 1.4;
  color: var(--text-primary);
  margin-bottom: 0;
}

/* ============================================
   RESULTADO Y TIP
   ============================================ */

#resultado {
  margin-top: 2rem;
  animation: fadeIn 0.3s ease-in;
}

#mensaje-resultado p {
  padding: 1rem 1.5rem;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

#mensaje-resultado p[style*="green"] {
  background: #d1fae5;
  color: #065f46;
  border-left: 4px solid var(--success-color);
}

#mensaje-resultado p[style*="red"] {
  background: #fee2e2;
  color: #991b1b;
  border-left: 4px solid var(--error-color);
}

#tip-container {
  background: #fef3c7;
  padding: 1.5rem;
  border-radius: 8px;
  border-left: 4px solid #f59e0b;
  margin-top: 1rem;
}

#tip-container h4 {
  color: #92400e;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

#tip-container p {
  color: #78350f;
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 0;
}

/* ============================================
   TAG DE RESPUESTA PREVIA
   ============================================ */

.respuesta-previa {
  background-color: #f0f0f0;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  border-radius: 8px;
  animation: fadeIn 0.3s ease-in;
}

.respuesta-previa.correcta {
  background: #d1fae5;
  border-left: 4px solid var(--success-color);
}

.respuesta-previa.incorrecta {
  background: #fee2e2;
  border-left: 4px solid var(--error-color);
}

.respuesta-previa small {
  font-size: 0.95rem;
  line-height: 1.5;
}

.respuesta-previa strong {
  color: var(--text-primary);
}

/* ============================================
   SEPARADORES
   ============================================ */

hr {
  border: none;
  border-top: 2px solid var(--border-color);
  margin: 2rem 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  h1 {
    font-size: 1.5rem;
    text-align: center;
  }

  #temas-list,
  #test-container {
    padding: 1.5rem;
  }

  #navegacion button {
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
    margin-bottom: 0.5rem;
  }

  #respuestas button {
    padding: 1rem;
    font-size: 1rem;
  }

  #respuestas button:hover:not(:disabled) {
    transform: translateX(4px);
  }
}

/* ============================================
   LOADING STATE
   ============================================ */

.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.loading::after {
  content: "...";
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%,
  20% {
    content: ".";
  }
  40% {
    content: "..";
  }
  60%,
  100% {
    content: "...";
  }
}

/* ============================================
   CONFIGURACIÓN
   ============================================ */

#config-container {
  max-width: 800px;
  margin: 0 auto;
  background: var(--bg-primary);
  border-radius: 16px;
  padding: 3rem;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.4s ease-in;
}

.config-section {
  background: var(--bg-secondary);
  padding: 2rem;
  border-radius: 12px;
  margin-bottom: 2rem;
  border-left: 4px solid var(--primary-color);
}

.config-section.danger {
  border-left-color: var(--error-color);
  background: #fee2e2;
}

.config-section h3 {
  margin-bottom: 1rem;
  font-size: 1.35rem;
}

.config-section p {
  margin-bottom: 1rem;
  line-height: 1.6;
}

#file-input {
  display: block;
  margin: 1rem 0;
  padding: 0.5rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  width: 100%;
  font-family: inherit;
}

#import-message {
  margin-top: 1rem;
  font-weight: 600;
}
