/* ==========================================================================
   WebLab STEM - Exam Practice & Mastery Hub Stylesheet
   Thiết kế chuẩn Cyber Glassmorphism, Micro-animations & Đầy đủ Dark/Light mode
   ========================================================================== */

.exam-hero-section {
  position: relative;
  padding: 5rem 1.5rem 3rem;
  background:
    radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.12), transparent 30%),
    radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.12), transparent 30%),
    linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border-bottom: 1px solid var(--border-glass);
  text-align: center;
}

.exam-hero-container {
  max-width: 1000px;
  margin: 0 auto;
}

.exam-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--physics-accent);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: var(--radius-full);
  margin-bottom: 1.25rem;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

.exam-hero-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.exam-hero-subtitle {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 800px;
  margin: 0 auto 2rem;
}

/* Stats Counter Bar */
.exam-stats-bar {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.exam-stat-item {
  background: var(--bg-glass-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 150px;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.2rem;
}

/* Control & Filter Area */
.exam-controls-wrapper {
  max-width: 1200px;
  margin: -1.5rem auto 2.5rem;
  padding: 0 1.5rem;
  position: relative;
  z-index: 10;
}

.exam-controls-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.exam-search-box {
  position: relative;
  width: 100%;
}

.exam-search-box i {
  position: absolute;
  left: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
}

.exam-search-input {
  width: 100%;
  padding: 0.9rem 1.2rem 0.9rem 3.2rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.exam-search-input:focus {
  outline: none;
  border-color: var(--physics-accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.exam-tabs-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.exam-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.exam-tab-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.05);
}

.exam-tab-btn.active {
  color: #fff;
  background: var(--tab-accent, var(--physics-accent));
  border-color: var(--tab-accent, var(--physics-accent));
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.35);
}

/* Topics Stream */
.exam-topics-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.exam-topic-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  position: relative;
  transition: border-color var(--transition-normal);
}

.exam-topic-card:hover {
  border-color: var(--subject-accent, rgba(56, 189, 248, 0.4));
}

.exam-topic-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-glass);
}

.exam-topic-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid;
  margin-bottom: 0.5rem;
}

.exam-topic-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  flex: 1 1 100%;
}

.exam-sim-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.exam-sim-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.4);
}

/* Sections Inside Card */
.exam-section {
  margin-bottom: 2rem;
}

.exam-section:last-child {
  margin-bottom: 0;
}

.exam-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.exam-section-title.trap-title {
  color: #fbbf24;
}

/* Theory Bullet List */
.exam-bullet-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.exam-bullet-list li {
  position: relative;
  padding-left: 1.5rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #e2e8f0;
}

.exam-bullet-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--subject-accent, var(--physics-accent));
  font-weight: bold;
}

/* Traps Container */
.exam-traps-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.exam-trap-item {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #fde68a;
}

.exam-trap-item i {
  color: #f59e0b;
  font-size: 1.15rem;
  margin-top: 0.15rem;
  flex-shrink: 0;
}

/* Worked Problem */
.exam-problem-box {
  background: var(--bg-tertiary);
  border-left: 4px solid var(--subject-accent, var(--physics-accent));
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.problem-label, .solution-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.problem-text {
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--text-primary);
  margin: 0;
}

.exam-solution-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.solution-steps {
  padding-left: 1.25rem;
  margin: 0 0 1rem;
  font-size: 0.94rem;
  line-height: 1.65;
  color: #cbd5e1;
}

.solution-steps li {
  margin-bottom: 0.4rem;
}

.solution-answer {
  padding: 0.75rem 1rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
  color: #a7f3d0;
  font-size: 0.95rem;
}

/* Interactive Quiz Arena */
.exam-quizzes-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.quiz-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: all var(--transition-fast);
}

.quiz-card.quiz-correct {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.quiz-card.quiz-incorrect {
  border-color: rgba(244, 63, 94, 0.5);
  box-shadow: 0 0 15px rgba(244, 63, 94, 0.15);
}

.quiz-question {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 1.2rem;
}

.quiz-qnum {
  color: var(--subject-accent, var(--physics-accent));
  font-weight: 700;
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.quiz-option-btn {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.85rem 1.1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  font-size: 0.92rem;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quiz-option-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-hover);
  color: #fff;
  transform: translateY(-1px);
}

.opt-letter {
  font-weight: 700;
  color: var(--text-muted);
}

.quiz-option-btn.option-is-correct {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: #10b981 !important;
  color: #ecfdf5 !important;
  font-weight: 600;
}

.quiz-option-btn.option-is-correct .opt-letter {
  color: #10b981;
}

.quiz-option-btn.option-is-wrong {
  background: rgba(244, 63, 94, 0.2) !important;
  border-color: #f43f5e !important;
  color: #ffe4e6 !important;
}

.quiz-option-btn.option-is-wrong .opt-letter {
  color: #f43f5e;
}

/* Feedback Bar */
.quiz-feedback-bar {
  margin-top: 1.25rem;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.quiz-feedback-bar.fb-correct {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.quiz-feedback-bar.fb-wrong {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.fb-message {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  font-size: 0.92rem;
}

.toggle-explanation-btn {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle-explanation-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.quiz-explanation-drawer {
  display: none;
  margin-top: 0.75rem;
  padding: 1rem 1.25rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  line-height: 1.6;
  color: #e2e8f0;
}

.quiz-explanation-drawer.visible {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

.drawer-header {
  font-weight: 700;
  color: #facc15;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Empty State */
.exam-empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  background: var(--bg-secondary);
  border: 1px dashed var(--border-glass);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}

.exam-empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
}

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

@media (max-width: 768px) {
  .exam-topic-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .quiz-options-grid {
    grid-template-columns: 1fr;
  }
  .exam-stats-bar {
    gap: 1rem;
  }
  .exam-stat-item {
    min-width: 120px;
    padding: 0.65rem 1rem;
  }
}

/* ==========================================================================
   Scientific & Mathematical Formula Typography
   ========================================================================== */
.math-formula,
.katex {
  font-feature-settings: "kern" 1, "liga" 1;
}

.math-formula i,
.math-var {
  font-style: italic;
  font-family: 'KaTeX_Math', 'Cambria Math', 'Times New Roman', serif;
}

.math-sup,
sup {
  font-size: 0.76em;
  font-weight: 600;
  vertical-align: baseline;
  position: relative;
  top: -0.42em;
  line-height: 0;
  color: inherit;
  font-family: inherit;
}

.math-sub,
sub {
  font-size: 0.74em;
  font-weight: 500;
  vertical-align: baseline;
  position: relative;
  bottom: -0.22em;
  line-height: 0;
  color: inherit;
  font-family: inherit;
}

.math-display-formula {
  display: block;
  margin: 0.85rem 0;
  padding: 0.9rem 1.4rem;
  background: rgba(10, 15, 29, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  font-family: 'KaTeX_Math', 'Cambria Math', 'Times New Roman', serif;
  font-size: 1.15rem;
  color: #38bdf8;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

.math-display-formula .katex-display {
  margin: 0;
}

/* KaTeX typography enhancements & Radical Vinculum bar styling */
.katex {
  font-size: 1.05em;
  text-rendering: auto;
}

.katex .katex-html {
  white-space: normal;
}

.math-radical {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
  vertical-align: baseline;
}

.radical-symbol {
  font-family: 'KaTeX_Math', 'Cambria Math', serif;
  font-size: 1.15em;
  line-height: 1;
  margin-right: -0.05em;
}

.radical-radicand {
  border-top: 1.5px solid currentColor;
  padding: 0 0.15em;
  display: inline-block;
  line-height: 1.15;
}

