/* ===== VARIABLES Y BASE ===== */
:root {
  --transition: 0.18s ease;
  --radius: 1rem;
  --shadow-card: 0 2px 8px rgba(0,0,0,0.08), 0 0 1px rgba(0,0,0,0.06);
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

body {
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

/* ===== SUBJECT CARDS ===== */
.subject-card {
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.subject-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--shadow-hover);
}
.subject-card:active {
  transform: translateY(-1px);
}

/* ===== UNIT CARDS ===== */
.unit-card {
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-card);
}
.unit-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* ===== CONTENT AREA ===== */
.content-body h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: #1e293b;
}
.content-body h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: #334155;
}
.content-body p {
  margin-bottom: 1rem;
  line-height: 1.75;
  color: #475569;
  font-size: 1rem;
}
.content-body ul, .content-body ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  color: #475569;
  line-height: 1.75;
}
.content-body li {
  margin-bottom: 0.3rem;
}
.content-body .formula-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
  text-align: center;
  font-size: 1.1rem;
}
.content-body .example-box {
  background: #eff6ff;
  border-left: 4px solid #2563eb;
  border-radius: 0 0.75rem 0.75rem 0;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
}
.content-body .example-box.green { background: #f0fdf4; border-color: #16a34a; }
.content-body .example-box.purple { background: #faf5ff; border-color: #7c3aed; }
.content-body .example-box.orange { background: #fffbeb; border-color: #d97706; }
.content-body .tip-box {
  background: #fefce8;
  border: 1px solid #fde047;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.content-body .definition-box {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
}

/* ===== QUIZ ENGINE ===== */
.quiz-option {
  border: 2px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 0.875rem 1.25rem;
  cursor: pointer;
  transition: all var(--transition);
  background: white;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
}
.quiz-option:hover:not([disabled]) {
  border-color: #93c5fd;
  background: #eff6ff;
}
.quiz-option.selected {
  border-color: #2563eb;
  background: #eff6ff;
}
.quiz-option.correct {
  border-color: #16a34a;
  background: #f0fdf4;
  color: #15803d;
}
.quiz-option.wrong {
  border-color: #dc2626;
  background: #fef2f2;
  color: #b91c1c;
}
.quiz-option.missed {
  border-color: #16a34a;
  background: #f0fdf4;
  opacity: 0.7;
}
.quiz-option:disabled {
  cursor: default;
}

.option-letter {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #64748b;
  transition: all var(--transition);
}
.quiz-option.selected .option-letter { background: #2563eb; color: white; }
.quiz-option.correct .option-letter { background: #16a34a; color: white; }
.quiz-option.wrong .option-letter { background: #dc2626; color: white; }

/* ===== PROGRESS BAR ===== */
.progress-bar-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* ===== SOLUTION STEP ===== */
.solution-step {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: flex-start;
}
.step-number {
  width: 32px;
  height: 32px;
  min-width: 32px;
  background: #2563eb;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}
.step-content {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 0.875rem 1rem;
  flex: 1;
  font-size: 0.95rem;
  color: #374151;
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ===== SCORE CIRCLE ===== */
.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 6px solid;
  margin: 0 auto;
}

/* ===== TABS ===== */
.tab-btn {
  padding: 0.625rem 1.25rem;
  border-radius: 0.625rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: transparent;
  color: #64748b;
}
.tab-btn:hover { background: #f1f5f9; color: #374151; }
.tab-btn.active { background: white; color: #1e293b; box-shadow: 0 1px 4px rgba(0,0,0,0.1); }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.25s ease; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.slide-up { animation: slideUp 0.3s ease; }

/* ===== KATEX OVERRIDES ===== */
.katex { font-size: 1.1em; }
.katex-display { margin: 0.5em 0; }

/* ===== EXERCISE CARD ===== */
.exercise-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: box-shadow var(--transition);
}
.exercise-card:hover { box-shadow: var(--shadow-hover); }

/* ===== MOBILE ===== */
@media (max-width: 640px) {
  .content-body h2 { font-size: 1.2rem; }
  .content-body p { font-size: 0.95rem; }
  .quiz-option { padding: 0.75rem 1rem; }
}
