/* ═════════════════════════════════════════════════════════════════
   GODHULI MEDICAL ADMISSION MODEL TEST & CHAPTER EVALUATION
   ═════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@400;500;600;700&family=Inter:wght@400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');

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

:root {
  --bg-dark: #0B0E14;
  --bg-card: #151A23;
  --bg-hover: #1E2532;
  --border-color: #232B3B;
  --primary: #7C3AED;
  --primary-hover: #6D28D9;
  --primary-glow: rgba(124, 58, 237, 0.35);
  --text-main: #F9FAFB;
  --text-muted: #9CA3AF;
  
  --med-red: #EF4444;
  --med-green: #10B981;
  --med-blue: #3B82F6;
  --med-amber: #F59E0B;
  --med-cyan: #06B6D4;
  --med-rose: #F43F5E;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.6);
  --shadow-primary: 0 8px 25px rgba(124, 58, 237, 0.25);
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-main: 'Hind Siliguri', 'Inter', system-ui, -apple-system, sans-serif;
}

body.light-theme {
  --bg-dark: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-hover: #F1F5F9;
  --border-color: #E2E8F0;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.08);
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  padding-bottom: 80px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

input {
  font-family: inherit;
  outline: none;
  border: none;
}

/* ═══════════════ NAVBAR ═══════════════ */
.med-nav {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(11, 14, 20, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 4%;
}

body.light-theme .med-nav {
  background: rgba(255, 255, 255, 0.92);
}

.med-nav-container {
  max-width: 1500px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.med-brand-area {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.med-brand-badge {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: white;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.med-brand-title {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.med-brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.med-brand-name span.highlight {
  color: #EF4444;
}

.med-brand-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 1px;
}

.med-nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.med-nav-btn {
  padding: 8px 16px;
  border-radius: 10px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  transition: var(--transition);
}

.med-nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.med-nav-btn.active {
  background: rgba(124, 58, 237, 0.15);
  color: #A78BFA;
  font-weight: 700;
}

.med-theme-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.med-theme-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ═══════════════ MAIN CONTAINER & VIEWS ═══════════════ */
.med-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 30px 4% 60px;
}

.med-view {
  display: none;
  animation: medFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.med-view.active {
  display: block;
}

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

/* ═══════════════ HERO BANNER (VIEW 1: HUB) ═══════════════ */
.med-hero {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, rgba(124, 58, 237, 0.12) 50%, rgba(21, 26, 35, 0.9) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 36px 40px;
  margin-bottom: 36px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

body.light-theme .med-hero {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(124, 58, 237, 0.08) 50%, rgba(255, 255, 255, 0.95) 100%);
}

.med-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #F87171;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 14px;
}

.med-hero h1 {
  font-size: 2.3rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 12px;
  color: var(--text-main);
}

.med-hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 720px;
  margin-bottom: 24px;
}

.med-stats-strip {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.med-stat-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.med-stat-pill i {
  font-size: 1.3rem;
  color: var(--primary);
}

.med-stat-pill .val {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.med-stat-pill .lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ═══════════════ MODE SELECTION CARDS ═══════════════ */
.med-modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 28px;
  margin-bottom: 48px;
}

.med-mode-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.med-mode-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
}

.med-mode-card.chapter-mode:hover {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 20px 40px rgba(16, 185, 129, 0.15);
}

.med-mode-card.model-mode:hover {
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 20px 40px rgba(239, 68, 68, 0.15);
}

.med-mode-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 20px;
}

.chapter-mode .med-mode-icon {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
}

.model-mode .med-mode-icon {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
}

.med-mode-card h2 {
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.med-mode-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
  line-height: 1.6;
}

.med-mode-features {
  list-style: none;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.med-mode-features li {
  font-size: 0.88rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.med-mode-features li i {
  font-size: 0.95rem;
  color: #10B981;
}

.med-mode-btn {
  margin-top: auto;
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: white;
  transition: var(--transition);
}

.chapter-mode .med-mode-btn {
  background: linear-gradient(135deg, #10B981, #059669);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

.model-mode .med-mode-btn {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

.med-mode-card:hover .med-mode-btn {
  transform: translateY(-2px);
}

/* ═══════════════ VIEW 2: CHAPTER-WISE YACHAI ═══════════════ */
.med-back-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.med-back-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.med-back-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--primary);
}

.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 24px;
}

.subject-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.subject-card:hover {
  transform: translateY(-5px);
  border-color: var(--card-color, var(--primary));
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.3);
}

.subject-card-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.subject-card-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: white;
}

.subject-card-info h3 {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.subject-card-info span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.chapter-accordion {
  margin-top: 14px;
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ch-item-btn {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.ch-item-btn:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: var(--primary);
  color: #A78BFA;
}

/* Topic Drill-down Modal / Drawer */
.topic-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 14, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.topic-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  max-width: 580px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  animation: medSlideUp 0.3s ease;
}

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

.topic-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.topic-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.topic-row-btn {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
}

.topic-row-btn:hover {
  background: rgba(124, 58, 237, 0.15);
  border-color: var(--primary);
  transform: translateX(4px);
}

.topic-row-info h4 {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.topic-row-info span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.topic-play-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

/* ═══════════════ VIEW 3: PREVIOUS YEAR ARCHIVE ═══════════════ */
.archive-controls-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.archive-search-box {
  flex: 1;
  min-width: 280px;
  position: relative;
}

.archive-search-box i {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.archive-search-box input {
  width: 100%;
  padding: 14px 18px 14px 48px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.95rem;
}

.archive-search-box input:focus {
  border-color: #EF4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.archive-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.archive-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.archive-table th {
  padding: 16px 20px;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
}

.archive-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.92rem;
  color: var(--text-main);
}

.archive-table tr:hover {
  background: var(--bg-hover);
}

.archive-start-btn {
  padding: 8px 18px;
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: white;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.archive-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

@media (min-width: 769px) {
  .archive-td-header .archive-badge-diff {
    display: none !important;
  }
}

/* ═══════════════ VIEW 4: LIVE EXAM ARENA ═══════════════ */
.exam-sticky-bar {
  position: sticky;
  top: 65px;
  z-index: 900;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
}

.exam-meta-info h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.exam-meta-info span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.exam-timer-box {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #EF4444;
  padding: 8px 18px;
  border-radius: 12px;
  font-family: 'Outfit', monospace;
  font-size: 1.3rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.exam-arena-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
}

.question-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}

.q-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.q-tag-pill {
  background: rgba(124, 58, 237, 0.12);
  color: #A78BFA;
  border: 1px solid rgba(124, 58, 237, 0.25);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}

.flag-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.flag-btn.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: #F59E0B;
  color: #F59E0B;
}

.question-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.6;
  margin-bottom: 28px;
}

.options-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.option-pill {
  background: var(--bg-dark);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: var(--transition);
}

body.light-theme .option-pill {
  background: #F8FAFC;
}

.option-pill:hover {
  border-color: var(--primary);
  background: var(--bg-hover);
}

.option-pill.selected {
  border-color: var(--primary);
  background: rgba(124, 58, 237, 0.12);
  box-shadow: 0 0 16px var(--primary-glow);
}

.option-omr-radio {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: var(--transition);
}

.option-pill.selected .option-omr-radio {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.option-label {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-main);
}

.arena-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
}

.arena-btn {
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
}

.arena-btn-prev {
  background: var(--bg-hover);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.arena-btn-next {
  background: var(--primary);
  color: white;
}

.palette-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px;
  position: sticky;
  top: 160px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.palette-num-btn {
  height: 38px;
  border-radius: 8px;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

body.light-theme .palette-num-btn {
  background: #F1F5F9;
}

.palette-num-btn.answered {
  background: #10B981;
  border-color: #10B981;
  color: white;
}

.palette-num-btn.flagged {
  background: #F59E0B;
  border-color: #F59E0B;
  color: white;
}

.palette-num-btn.current {
  border: 2px solid var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* ═══════════════ VIEW 5: RESULT & PERFORMANCE DASHBOARD ═══════════════ */
.result-hero-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(21, 26, 35, 0.9) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 36px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-md);
}

.score-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.metric-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.metric-pill i {
  font-size: 1.6rem;
}

.metric-pill.green i { color: #10B981; }
.metric-pill.red i { color: #EF4444; }
.metric-pill.blue i { color: #3B82F6; }
.metric-pill.amber i { color: #F59E0B; }

.metric-pill .num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.metric-pill .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Subject Breakdown & Weakness Matrix */
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 24px;
  margin-bottom: 36px;
}

.analysis-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px;
}

.analysis-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.subject-perf-row {
  margin-bottom: 14px;
}

.sub-perf-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  margin-bottom: 6px;
  font-weight: 600;
}

.sub-perf-bar {
  height: 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

body.light-theme .sub-perf-bar {
  background: rgba(0, 0, 0, 0.08);
}

.sub-perf-fill {
  height: 100%;
  border-radius: 20px;
  transition: width 0.8s ease;
}

/* Weakness Tags (🔴 🟡 🟢) */
.weakness-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.weakness-item {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.weakness-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.weakness-badge.weak {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.weakness-badge.average {
  background: rgba(245, 158, 11, 0.15);
  color: #F59E0B;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.weakness-badge.strong {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Question Solution Card with Direct Topic Practice CTA */
.review-q-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.review-q-card.is-wrong {
  border-left: 4px solid #EF4444;
}

.review-q-card.is-correct {
  border-left: 4px solid #10B981;
}

.review-q-card.is-skipped {
  border-left: 4px solid var(--text-muted);
}

.mapping-chip-box {
  background: var(--bg-hover);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.mapping-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.mapping-meta strong {
  color: var(--text-main);
}

.practice-topic-cta-btn {
  background: linear-gradient(135deg, #7C3AED, #6D28D9);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.practice-topic-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

/* ═══════════════ MOBILE RESPONSIVENESS & BOTTOM NAV ═══════════════ */
.med-mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(11, 14, 20, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  z-index: 9999;
  justify-content: space-around;
  align-items: center;
}

body.light-theme .med-mobile-nav {
  background: rgba(255, 255, 255, 0.95);
}

.med-mbn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  background: transparent;
  padding: 6px 12px;
  flex: 1;
}

.med-mbn-item i {
  font-size: 1.15rem;
}

.med-mbn-item.active {
  color: #EF4444;
}

/* ═══════════════ MODAL OVERLAY & DIALOG STYLES ═══════════════ */
.med-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 14, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 16px;
  overflow-y: auto;
  animation: medFadeIn 0.25s ease;
}

@keyframes medFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.med-modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 30px var(--primary-glow);
  animation: medSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  box-sizing: border-box;
}

body.light-theme .med-modal-box {
  background: #FFFFFF;
  box-shadow: 0 25px 60px rgba(124, 58, 237, 0.15), 0 0 20px rgba(0, 0, 0, 0.08);
}

/* ═══════════════ ENROLLED STATE STYLES ═══════════════ */
body.is-enrolled-student #enrollNowNavBtn,
body.is-enrolled-student #accessRequiredModal {
  display: none !important;
}

body.is-enrolled-student #enrollmentStatusBadge {
  display: flex !important;
}

/* ═══════════════ RESPONSIVE BREAKPOINTS ═══════════════ */

@media (max-width: 900px) {
  .exam-arena-grid {
    grid-template-columns: 1fr;
  }
  .palette-box {
    position: static;
    max-height: none;
    margin-top: 24px;
  }
  .analysis-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  body {
    padding-bottom: 90px !important;
  }
  .med-container {
    padding-bottom: 90px !important;
  }
  .med-nav-container {
    padding: 10px 16px;
  }
  .med-mobile-nav {
    display: flex;
  }
  .med-nav-links {
    display: none;
  }
  .med-brand-sub {
    display: none;
  }
  .med-hero {
    padding: 22px 16px;
    border-radius: 18px;
  }
  .med-hero h1 {
    font-size: 1.5rem;
    line-height: 1.35;
  }
  .med-modes-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .subjects-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .question-box {
    padding: 20px 16px;
    border-radius: 18px;
  }
  .question-text {
    font-size: 1.1rem;
    line-height: 1.55;
    margin-bottom: 20px;
  }
  /* Mobile Responsive Archive Cards */
  .archive-table-card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
  }
  .archive-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    border-collapse: separate !important;
  }
  .archive-table thead {
    display: none !important;
  }
  .archive-table tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    width: 100% !important;
  }
  .archive-table tr.archive-row,
  .archive-table tr {
    display: flex !important;
    flex-direction: column !important;
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 16px !important;
    padding: 16px !important;
    box-shadow: var(--shadow-sm) !important;
    cursor: pointer !important;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
    -webkit-tap-highlight-color: rgba(239, 68, 68, 0.12) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    position: relative !important;
  }
  .archive-table tr:hover,
  .archive-table tr:active {
    border-color: #EF4444 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.18) !important;
  }
  .archive-table td {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 4px 0 !important;
    border-bottom: none !important;
    font-size: 0.9rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .archive-table td.archive-td-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    border-bottom: 1px dashed var(--border-color) !important;
    padding-bottom: 10px !important;
    margin-bottom: 8px !important;
  }
  .archive-table td.archive-td-exam {
    display: block !important;
    padding: 4px 0 !important;
    text-align: left !important;
  }
  .archive-table td.archive-td-meta {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-top: 8px !important;
    padding: 8px 12px !important;
    background: var(--bg-hover) !important;
    border-radius: 10px !important;
    border: 1px solid var(--border-color) !important;
  }
  .archive-table td.archive-td-diff-desktop {
    display: none !important;
  }
  .archive-table td.archive-td-action {
    display: block !important;
    width: 100% !important;
    padding-top: 12px !important;
  }
  .archive-start-btn {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 12px 18px !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3) !important;
  }
}

@media (max-width: 640px) {
  .med-hero {
    padding: 18px 14px;
  }
  .med-hero h1 {
    font-size: 1.35rem;
  }
  .med-stats-strip {
    flex-direction: column;
    gap: 8px;
  }
  .med-stat-pill {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
  }
  .exam-sticky-bar {
    top: 55px;
    padding: 10px 12px;
    border-radius: 14px;
    margin-bottom: 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .exam-meta-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .exam-meta-info h3 {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
  }
  .exam-sticky-bar > div:last-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }
  .exam-timer-box {
    font-size: 1.1rem;
    padding: 6px 14px;
    border-radius: 10px;
  }
  .score-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .metric-pill {
    padding: 12px 10px;
    gap: 10px;
  }
  .metric-pill .num {
    font-size: 1.25rem;
  }
  .metric-pill .label {
    font-size: 0.72rem;
  }
  .q-palette-grid {
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
  }
  .palette-q-btn {
    height: 32px;
    font-size: 0.75rem;
    border-radius: 6px;
  }
  .option-pill {
    padding: 12px 14px;
    gap: 12px;
    border-radius: 12px;
    font-size: 0.9rem;
  }
  .option-omr-radio {
    width: 22px;
    height: 22px;
    font-size: 0.7rem;
  }
  .arena-controls {
    padding-top: 16px;
    gap: 8px;
  }
  .arena-btn {
    padding: 10px 16px;
    font-size: 0.88rem;
    border-radius: 10px;
  }
  .med-back-row {
    flex-direction: column;
    gap: 8px;
  }
  .med-back-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .med-container {
    padding: 14px 10px 95px 10px !important;
  }
  .med-brand-name {
    font-size: 1.05rem;
  }
  .med-brand-badge {
    width: 36px;
    height: 36px;
  }
  #enrollNowNavBtn span {
    display: none;
  }
  #enrollNowNavBtn {
    padding: 6px 10px;
  }
  #enrollmentStatusBadge span {
    font-size: 0.72rem;
  }
  .med-modal-overlay {
    padding: 10px;
  }
  .med-modal-box {
    padding: 24px 16px !important;
    border-radius: 18px !important;
    max-height: 92vh !important;
  }
  .topic-modal-card {
    padding: 20px 14px !important;
    border-radius: 18px !important;
    max-height: 88vh !important;
  }
  .q-header-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .practice-topic-cta-btn {
    width: 100%;
    justify-content: center;
  }
  .q-palette-grid {
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
  }
}

/* ═══════════════ ARCHIVE FILTER PILLS & STUDY MODAL ═══════════════ */
.archive-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 8px 0;
}

.archive-pill-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.archive-pill-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.archive-pill-btn.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(6, 182, 212, 0.15));
  border-color: #10B981;
  color: #10B981;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.archive-action-group {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.archive-study-btn {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.archive-study-btn:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10B981;
  color: #10B981;
}

/* Study Modal */
.study-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 14, 20, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.study-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  animation: medSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.study-q-card {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s;
}

.study-q-card:hover {
  border-color: rgba(16, 185, 129, 0.4);
}

.study-q-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.6;
}

.study-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 640px) {
  .study-options-grid {
    grid-template-columns: 1fr;
  }
}

.study-opt-pill {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.4;
}

.study-opt-pill.is-correct {
  background: rgba(16, 185, 129, 0.12);
  border-color: #10B981;
  color: #10B981;
  font-weight: 700;
}

.study-opt-letter {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  flex-shrink: 0;
}

.study-opt-pill.is-correct .study-opt-letter {
  background: #10B981;
  color: #fff;
}

.study-explanation-box {
  background: rgba(16, 185, 129, 0.08);
  border-left: 3px solid #10B981;
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.archive-pdf-btn {
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #F87171;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.archive-pdf-btn:hover {
  background: #EF4444;
  border-color: #DC2626;
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
  transform: translateY(-1px);
}

.study-pdf-btn {
  padding: 8px 14px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #F87171;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.study-pdf-btn:hover {
  background: #EF4444;
  color: #fff;
}

.med-mode-card.pdf-archive-mode {
  border-color: rgba(239, 68, 68, 0.3);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.04) 0%, rgba(245, 158, 11, 0.04) 100%);
}

.med-mode-card.pdf-archive-mode:hover {
  border-color: #EF4444;
  box-shadow: 0 12px 30px rgba(239, 68, 68, 0.15);
}

.med-mode-card.pdf-archive-mode .med-mode-icon {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.ch-q-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  transition: all 0.2s ease;
}

.ch-item-btn:hover .ch-q-badge {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #10B981;
}

.topic-study-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.topic-study-btn:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: #8B5CF6;
  color: #C4B5FD;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}

