/* quiz.css -- Estilos del sistema de quizzes diagnostico/final */

/* --- Launcher de botones en la cabecera del capítulo --- */
.quiz-launcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
  align-items: center;
}
.quiz-launcher .quiz-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1.5px solid #2563eb;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border-radius: 9999px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}
.quiz-launcher .quiz-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}
.quiz-launcher .quiz-btn[data-kind="final"] {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  border-color: #b91c1c;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}
.quiz-launcher .quiz-btn[data-kind="final"]:hover {
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}

/* --- Overlay y modal --- */
body.quiz-open { overflow: hidden; }
.quiz-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  z-index: 9990;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2.5vh 1rem;
  overflow-y: auto;
  animation: quiz-fade 0.18s ease-out;
}
@keyframes quiz-fade { from { opacity: 0; } to { opacity: 1; } }
.quiz-modal {
  position: relative;
  background: #ffffff;
  width: min(720px, 100%);
  max-width: 100%;
  border-radius: 14px;
  padding: 1.25rem 1.4rem 1.6rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  font-family: inherit;
  color: #1f2937;
  animation: quiz-pop 0.22s ease-out;
}
@keyframes quiz-pop { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* --- Header del modal --- */
.quiz-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0.85rem;
}
.quiz-title {
  flex: 1;
  font-weight: 700;
  font-size: 1.05rem;
  color: #0f172a;
}
.quiz-timer-wrap {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  background: #f1f5f9;
  padding: 0.35rem 0.7rem;
  border-radius: 9999px;
  font-variant-numeric: tabular-nums;
}
.quiz-timer-label { font-size: 0.75rem; color: #475569; text-transform: uppercase; letter-spacing: 0.05em; }
.quiz-timer { font-size: 1.15rem; font-weight: 700; color: #0f172a; }
.quiz-timer-low { color: #dc2626; animation: quiz-pulse 1s ease-in-out infinite; }
@keyframes quiz-pulse { 50% { opacity: 0.55; } }
.quiz-close {
  background: transparent;
  border: 0;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
  padding: 0.1rem 0.5rem;
  border-radius: 8px;
}
.quiz-close:hover { background: #f1f5f9; color: #0f172a; }

/* --- Progreso --- */
.quiz-progress { margin-bottom: 1rem; }
.quiz-progress-text {
  font-size: 0.85rem;
  color: #475569;
  margin-bottom: 0.4rem;
  font-weight: 500;
}
.quiz-progress-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  transition: width 0.25s ease;
}

/* --- Enunciado y opciones --- */
.quiz-stem {
  font-size: 1.02rem;
  line-height: 1.55;
  margin-bottom: 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #2563eb;
  border-radius: 6px;
  padding: 0.85rem 1rem;
}
.quiz-opts {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.quiz-opt-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.85rem;
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: #1f2937;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.quiz-opt-btn:hover { border-color: #94a3b8; background: #f8fafc; }
.quiz-opt.is-selected .quiz-opt-btn {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: inset 0 0 0 1px #2563eb;
}
.quiz-opt-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: #e2e8f0;
  font-weight: 700;
  color: #334155;
  flex-shrink: 0;
  text-transform: lowercase;
}
.quiz-opt.is-selected .quiz-opt-letter { background: #2563eb; color: #fff; }
.quiz-opt-val { flex: 1; }

/* --- Navegación inferior --- */
.quiz-nav {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  border-top: 1px solid #e5e7eb;
  padding-top: 0.85rem;
}
.quiz-nav button {
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  color: #1f2937;
  transition: background 0.15s, border-color 0.15s;
}
.quiz-nav button:hover:not(:disabled) { background: #f1f5f9; border-color: #94a3b8; }
.quiz-nav button:disabled { opacity: 0.4; cursor: not-allowed; }
.quiz-btn-submit {
  background: linear-gradient(135deg, #16a34a, #15803d) !important;
  color: #fff !important;
  border-color: #15803d !important;
}
.quiz-btn-submit:hover { filter: brightness(1.05); }
.quiz-jumps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  flex: 1;
  justify-content: center;
}
.quiz-jump {
  width: 2rem; height: 2rem;
  padding: 0 !important;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 50% !important;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  color: #475569;
}
.quiz-jump.is-answered { background: #dbeafe; border-color: #93c5fd; color: #1e40af; }
.quiz-jump.is-current { background: #2563eb; color: #fff; border-color: #2563eb; }

/* --- Resultado --- */
.quiz-summary {
  text-align: center;
  padding: 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  border: 2px solid #e5e7eb;
  background: #f8fafc;
}
.quiz-summary.is-great { background: #ecfdf5; border-color: #34d399; }
.quiz-summary.is-ok    { background: #fffbeb; border-color: #fbbf24; }
.quiz-summary.is-low   { background: #fef2f2; border-color: #f87171; }
.quiz-summary-pct {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
  line-height: 1;
  margin-bottom: 0.3rem;
}
.quiz-summary.is-great .quiz-summary-pct { color: #047857; }
.quiz-summary.is-ok    .quiz-summary-pct { color: #b45309; }
.quiz-summary.is-low   .quiz-summary-pct { color: #b91c1c; }
.quiz-summary-text { color: #475569; font-weight: 500; font-size: 0.95rem; }

.quiz-review {
  display: flex; flex-direction: column; gap: 0.85rem;
  margin-bottom: 1rem;
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 4px;
}
.quiz-review-card {
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  background: #fff;
}
.quiz-review-card.is-correct { border-color: #34d399; background: #f0fdf4; }
.quiz-review-card.is-wrong   { border-color: #f87171; background: #fef2f2; }
.quiz-review-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.quiz-review-num {
  width: 1.7rem; height: 1.7rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: #1e293b; color: #fff; border-radius: 50%;
  font-weight: 700; font-size: 0.85rem;
}
.quiz-review-tag { font-weight: 700; font-size: 0.85rem; }
.quiz-review-card.is-correct .quiz-review-tag { color: #047857; }
.quiz-review-card.is-wrong   .quiz-review-tag { color: #b91c1c; }
.quiz-review-q { font-size: 0.97rem; line-height: 1.5; margin-bottom: 0.55rem; }
.quiz-review-opts {
  list-style: none; padding: 0; margin: 0 0 0.55rem;
  display: flex; flex-direction: column; gap: 0.25rem;
}
.quiz-review-opt {
  display: flex; gap: 0.5rem; padding: 0.4rem 0.6rem;
  border: 1px solid #e5e7eb; border-radius: 6px; background: #fff;
  font-size: 0.92rem;
}
.quiz-review-opt.is-answer    { background: #ecfdf5; border-color: #34d399; font-weight: 600; }
.quiz-review-opt.is-userright { background: #d1fae5; border-color: #10b981; }
.quiz-review-opt.is-userwrong { background: #fee2e2; border-color: #ef4444; }
.quiz-review-letter {
  width: 1.5rem; height: 1.5rem; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: #e2e8f0; font-weight: 700; font-size: 0.78rem;
  text-transform: lowercase;
}
.quiz-review-opt.is-answer    .quiz-review-letter { background: #10b981; color: #fff; }
.quiz-review-opt.is-userwrong .quiz-review-letter { background: #ef4444; color: #fff; }
.quiz-review-expl {
  font-size: 0.9rem; line-height: 1.5; color: #334155;
  background: #fff; border: 1px dashed #cbd5e1; padding: 0.55rem 0.7rem;
  border-radius: 6px;
}

/* --- Acciones finales --- */
.quiz-actions {
  display: flex; gap: 0.6rem; flex-wrap: wrap;
  border-top: 1px solid #e5e7eb; padding-top: 0.85rem; align-items: center;
}
.quiz-actions button, .quiz-actions a {
  padding: 0.6rem 1.1rem;
  border-radius: 9999px;
  font: inherit; font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  color: #1f2937;
  display: inline-flex; align-items: center; gap: 0.3rem;
}
.quiz-actions button:hover, .quiz-actions a:hover { background: #f1f5f9; }
.quiz-btn-retry {
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
  color: #fff !important; border-color: #2563eb !important;
}
.quiz-btn-next-chap {
  background: linear-gradient(135deg, #16a34a, #15803d) !important;
  color: #fff !important; border-color: #15803d !important;
  margin-left: auto;
}

/* --- Responsive --- */
@media (max-width: 560px) {
  .quiz-modal { padding: 1rem; border-radius: 12px; }
  .quiz-title { font-size: 0.95rem; }
  .quiz-timer { font-size: 1rem; }
  .quiz-jump { width: 1.7rem; height: 1.7rem; font-size: 0.75rem; }
  .quiz-launcher .quiz-btn { font-size: 0.85rem; padding: 0.5rem 0.85rem; }
  .quiz-summary-pct { font-size: 2rem; }
  .quiz-stem { font-size: 0.95rem; }
}
