/**
 * ============================================================================
 * CAT Platform Design System & Modern UI Stylesheet (cat_style.css)
 * Glassmorphic, High-Contrast Dark Theme with Dynamic Micro-Interactions
 * ============================================================================
 */

:root {
  --bg-main: #090d16;
  --bg-surface: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(51, 65, 85, 0.8);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(56, 189, 248, 0.3);
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-glow: rgba(37, 99, 235, 0.4);
  
  --accent-cyan: #38bdf8;
  --accent-purple: #8b5cf6;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --font-heading: 'Syne', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.15);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  width: 100%;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(37, 99, 235, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(139, 92, 246, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
}

img, svg, picture, video, canvas {
  max-width: 100%;
  height: auto;
}

input, select, textarea, button {
  font-family: inherit;
  font-size: 16px; /* Prevents mobile browser auto-zoom */
}

@media (min-width: 769px) {
  input, select, textarea {
    font-size: 0.92rem;
  }
}

/* ============================================================================
   NAVIGATION & HEADER
   ============================================================================ */
.cat-nav {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: rgba(9, 13, 22, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-icon {
  font-size: 1.6rem;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.4));
}

.brand-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff, var(--accent-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-pill {
  font-family: var(--font-mono);
  background: linear-gradient(135deg, var(--primary), var(--accent-purple));
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.2s ease;
  padding: 6px 12px;
  border-radius: 8px;
}

.nav-link:hover, .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

/* ============================================================================
   BUTTONS & CONTROLS
   ============================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: #fff;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover), var(--primary));
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent-purple), #6366f1);
  color: #fff;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-accent:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.45);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-warning {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--accent-amber);
}

.btn-warning:hover {
  background: var(--accent-amber);
  color: #000;
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.35);
  color: var(--accent-rose);
}

.btn-danger:hover {
  background: var(--accent-rose);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

/* ============================================================================
   CONTAINER & LAYOUT WRAPPERS
   ============================================================================ */
.cat-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 20px;
}

.hero-banner {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(139, 92, 246, 0.12));
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 48px 36px;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.hero-banner::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: var(--accent-cyan);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 14px;
  letter-spacing: -1px;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 700px;
  margin-bottom: 28px;
  line-height: 1.6;
}

/* ============================================================================
   GRID & CARDS
   ============================================================================ */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.cat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 24px;
  backdrop-filter: blur(12px);
  transition: all 0.25s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.cat-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.card-tag {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 14px;
}

.tag-diag {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.tag-mock {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-purple);
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.tag-sec {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.tag-subtopic {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 18px;
  flex-grow: 1;
}

.card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ============================================================================
   TEST RUNNER ENGINE STYLES (EXAM UI)
   ============================================================================ */
.exam-header {
  height: 60px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.exam-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.exam-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
}

.timer-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--accent-rose);
  padding: 6px 14px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
}

.timer-box.warning {
  animation: timerPulse 1s infinite alternate;
}

@keyframes timerPulse {
  0% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(244, 63, 94, 0.4)); }
  100% { transform: scale(1.04); filter: drop-shadow(0 0 10px rgba(244, 63, 94, 0.8)); }
}

/* Section Progress Flow Strip */
.exam-section-strip {
  display: flex;
  background: #090d16;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.sec-step {
  flex: 1;
  padding: 12px 18px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  background: rgba(255, 255, 255, 0.01);
}

.sec-step.active {
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent-cyan);
  border-bottom: 2px solid var(--accent-cyan);
}

.sec-step.completed {
  color: var(--accent-emerald);
}

.sec-step.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Exam Main Layout Grid */
.exam-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  height: calc(100vh - 108px);
  width: 100%;
}

.exam-main {
  padding: 22px 32px;
  overflow-y: auto;
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
}

.q-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  width: 100%;
}

.q-badge {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
}

.q-tag-group {
  display: flex;
  gap: 8px;
}

.q-pill {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text-secondary);
}

/* Wide, Highly Legible Auto-Adjusting Passage Container for RC & DILR Sets */
.passage-container {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0;
  box-sizing: border-box;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 14px;
  padding: 24px 28px;
  margin-bottom: 24px;
  font-size: 1.02rem;
  line-height: 1.8;
  color: #e2e8f0;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.35);
}

/* Universal High-Definition Scaled Diagrams, Charts, and Figures across all questions & passages */
.passage-container img,
.passage-body-text img,
.q-body img,
.q-text img,
.question-scroll-pane img,
.options-list img,
.opt-item img,
.q-review-card img,
.review-passage img,
#questionContentArea img,
#questionText img,
#passageContainer img {
  display: block !important;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: 600px !important;
  min-height: auto !important;
  margin: 18px auto !important;
  border-radius: 12px !important;
  background: rgba(15, 23, 42, 0.9) !important;
  border: 1.5px solid rgba(56, 189, 248, 0.35) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45) !important;
  object-fit: contain !important;
}

.passage-container pre, 
.passage-container table,
.q-body table,
.passage-body-text table,
#questionContentArea table,
#passageContainer table {
  margin: 18px 0;
  width: 100% !important;
  max-width: 100% !important;
  border-collapse: collapse;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.passage-container th, 
.passage-container td,
.q-body th,
.q-body td,
.passage-body-text th,
.passage-body-text td,
#questionContentArea th,
#questionContentArea td,
#passageContainer th,
#passageContainer td {
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 12px 16px;
  font-size: 0.92rem;
  line-height: 1.6;
}

.passage-container th,
.q-body th,
.passage-body-text th,
#questionContentArea th,
#passageContainer th {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  font-weight: 700;
}

.q-body {
  font-size: 1.04rem;
  line-height: 1.7;
  margin-bottom: 24px;
  color: #f1f5f9;
  height: auto;
  max-height: none;
  overflow: visible;
}

/* MCQ Options */
.options-list, .q-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.option-card, .opt-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 12px;
  color: #fff;
}

.option-card:hover, .opt-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

.option-card.selected, .opt-item.selected {
  background: rgba(37, 99, 235, 0.15);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.15);
}

.option-indicator, .opt-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
  transition: all 0.2s ease;
}

.option-card.selected .option-indicator, .opt-item.selected .opt-circle {
  border-color: var(--accent-cyan);
  background: var(--accent-cyan);
  color: #0f172a;
}

.option-text, .opt-text {
  font-size: 0.98rem;
  color: #e2e8f0;
  line-height: 1.6;
  flex: 1;
}

.q-palette-grid, .palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding: 4px;
}

/* TITA Input Box */
.tita-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 32px;
  max-width: 400px;
}

.tita-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 16px;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  outline: none;
  transition: border-color 0.2s;
}

.tita-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

/* Exam Controls Footer */
.exam-controls {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* Right Sidebar & Question Palette */
.exam-sidebar {
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 14px;
}

/* 5-State Palette Legend */
.pal-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.leg-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.leg-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.dot-not-visited { background: #1e293b; border: 1px solid #475569; }
.dot-not-ans { background: #ef4444; }
.dot-answered { background: #10b981; }
.dot-marked { background: #8b5cf6; }
.dot-marked-ans { background: #8b5cf6; border: 2px solid #10b981; }

/* Palette Grid */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.pal-btn {
  aspect-ratio: 1;
  border-radius: 8px;
  background: #1e293b;
  border: 1px solid #475569;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pal-btn:hover {
  transform: scale(1.08);
  border-color: #fff;
}

.pal-btn.current {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

.pal-btn.state-answered {
  background: #10b981;
  border-color: #10b981;
  color: #fff;
}

.pal-btn.state-not-answered {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

.pal-btn.state-marked {
  background: #8b5cf6;
  border-color: #8b5cf6;
  color: #fff;
}

.pal-btn.state-marked-answered {
  background: #8b5cf6;
  border: 2px solid #10b981;
  color: #fff;
  position: relative;
}

/* ============================================================================
   TOPIC DRILL / MODULAR TEST COMPONENTS
   ============================================================================ */
.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  width: 100%;
}

.q-meta-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.q-actions-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.question-content {
  flex: 1;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.question-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 10px;
}

.candidate-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  margin-bottom: 16px;
}

.legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-badge {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  color: #fff;
}

.legend-badge.answered, .pal-num-btn.answered { background: #10b981; color: #fff; }
.legend-badge.not-answered, .pal-num-btn.not-answered { background: #ef4444; color: #fff; }
.legend-badge.not-visited, .pal-num-btn.not-visited { background: #1e293b; border: 1px solid #475569; color: #94a3b8; }
.legend-badge.marked, .pal-num-btn.marked { background: #8b5cf6; color: #fff; }
.legend-badge.ans-marked, .pal-num-btn.ans-marked { background: #8b5cf6; border: 2px solid #10b981; color: #fff; }

.palette-container, .palette-nums, #examPaletteContainer, .palette-grid {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr) !important;
  gap: 8px !important;
  padding: 10px 4px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.palette-grid-scroll {
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.pal-num-btn {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.pal-num-btn:hover {
  transform: scale(1.08);
  filter: brightness(1.2);
}

.pal-num-btn.active-q {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

/* ============================================================================
   MODALS & OVERLAYS
   ============================================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: #131b2e;
  border: 1px solid var(--border-accent);
  border-radius: 20px;
  max-width: 550px;
  width: 100%;
  padding: 32px;
  box-shadow: var(--shadow-lg);
  animation: modalPop 0.25s ease;
}

@keyframes modalPop {
  0% { transform: scale(0.95); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.modal-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* Large Instructions Modal */
.modal-card-lg {
  max-width: 860px !important;
  max-height: 90vh !important;
  display: flex;
  flex-direction: column;
  padding: 28px 32px;
}

.modal-body-scroll {
  overflow-y: auto;
  padding-right: 10px;
  margin: 16px 0 20px 0;
  line-height: 1.65;
  flex: 1;
}

.modal-body-scroll::-webkit-scrollbar {
  width: 8px;
}
.modal-body-scroll::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}
.modal-body-scroll::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.35);
  border-radius: 4px;
}
.modal-body-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.6);
}

/* ============================================================================
   REPORT & ANALYTICS STYLING
   ============================================================================ */
.report-hero {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(139, 92, 246, 0.15));
  border: 1px solid var(--border-accent);
  border-radius: 20px;
  padding: 36px;
  margin-bottom: 32px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
}

.score-display-box {
  text-align: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
}

.score-num {
  font-family: var(--font-heading);
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--accent-cyan);
  line-height: 1;
}

.score-label {
  font-size: 0.82rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-top: 6px;
}

.stats-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
}

.stat-metric-val {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
}

.stat-metric-lbl {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Section Score Cards */
.section-cards-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.sec-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 24px;
}

.sec-card-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.sec-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
}

.sec-score-pill {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

/* Tables in Report & Admin Dashboard */
.cat-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 32px;
  width: 100%;
  max-width: 100%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.cat-table-wrap::-webkit-scrollbar {
  height: 8px;
}
.cat-table-wrap::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
}
.cat-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.35);
  border-radius: 4px;
}
.cat-table-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.6);
}

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

.cat-table th {
  background: rgba(255, 255, 255, 0.04);
  padding: 12px 16px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.cat-table td {
  padding: 12px 16px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border-subtle);
  color: #e2e8f0;
  vertical-align: middle;
}

.cat-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Question Review Accordion / Cards */
.q-review-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.q-review-card.correct { border-left: 4px solid var(--accent-emerald); }
.q-review-card.incorrect { border-left: 4px solid var(--accent-rose); }
.q-review-card.unattempted { border-left: 4px solid var(--text-muted); }

/* Review Card MCQ Options Styling */
.q-review-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0 20px 0;
}

.review-opt-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  font-size: 0.94rem;
  color: #cbd5e1;
  line-height: 1.5;
  transition: all 0.2s ease;
}

.review-opt-item.opt-correct {
  background: rgba(16, 185, 129, 0.12);
  border: 1.5px solid var(--accent-emerald);
  color: #ecfdf5;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.12);
}

.review-opt-item.opt-user-wrong {
  background: rgba(244, 63, 94, 0.12);
  border: 1.5px solid var(--accent-rose);
  color: #fff1f2;
  box-shadow: 0 0 16px rgba(244, 63, 94, 0.12);
}

.review-opt-item .opt-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.review-opt-item.opt-correct .opt-badge {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: #064e3b;
  font-weight: 900;
}

.review-opt-item.opt-user-wrong .opt-badge {
  background: var(--accent-rose);
  border-color: var(--accent-rose);
  color: #ffe4e6;
  font-weight: 900;
}

.review-opt-item .opt-status-tag {
  margin-left: auto;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.review-opt-item.opt-correct .opt-status-tag {
  background: rgba(16, 185, 129, 0.25);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.review-opt-item.opt-user-wrong .opt-status-tag {
  background: rgba(244, 63, 94, 0.25);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.4);
}

/* ============================================================================
   COMPREHENSIVE RESPONSIVENESS (MOBILE, TABLET & DESKTOP)
   ============================================================================ */

/* TABLETS & LAPTOPS (<= 1024px) */
@media (max-width: 1024px) {
  .cat-container {
    padding: 24px 16px;
  }
  
  .admin-layout {
    grid-template-columns: 240px 1fr;
  }
  
  .exam-layout {
    grid-template-columns: minmax(0, 1fr) 260px;
  }
  
  .cards-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
  }
  
  .stats-grid-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
  
  .section-cards-3 {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* MOBILE PHONES & PHABLETS (<= 768px) */
@media (max-width: 768px) {
  /* Navigation */
  .cat-nav {
    padding: 8px 16px;
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    gap: 10px;
    position: sticky;
  }
  
  .brand-wrap {
    gap: 8px;
  }
  
  .brand-title {
    font-size: 1.15rem;
  }
  
  .nav-links {
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-start;
  }

  .nav-link {
    font-size: 0.8rem;
    padding: 4px 8px;
  }
  
  /* Hero & Headings */
  .hero-section {
    padding: 24px 0 16px 0 !important;
    text-align: center;
  }
  
  .hero-title {
    font-size: 1.85rem;
    letter-spacing: -0.5px;
    line-height: 1.25;
  }
  
  .hero-subtitle, .hero-desc {
    font-size: 0.88rem;
    line-height: 1.6;
    margin-bottom: 20px;
  }
  
  .hero-banner {
    padding: 24px 18px;
    border-radius: 14px;
    margin-bottom: 24px;
  }
  
  /* Horizontal Scrollable Tabs & Filters */
  .filter-group {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 4px 2px 10px 2px !important;
    gap: 8px !important;
    justify-content: flex-start !important;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  
  .filter-group::-webkit-scrollbar {
    display: none;
  }
  
  .filter-group .btn, .filter-group button {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    font-size: 0.78rem !important;
    padding: 7px 12px !important;
  }
  
  .blueprint-meta-strip {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
    font-size: 0.8rem;
  }
  
  /* Cards & Layout */
  .cards-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  
  .cat-card {
    padding: 18px 16px;
    border-radius: 14px;
  }
  
  /* Admin Console Mobile */
  .admin-layout {
    display: block !important;
    width: 100%;
  }
  
  .admin-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    padding: 10px 14px;
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    scrollbar-width: none;
  }
  
  .admin-sidebar::-webkit-scrollbar {
    display: none;
  }
  
  .admin-tab-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 0.8rem;
    width: auto;
  }
  
  .admin-content {
    padding: 18px 14px;
  }
  
  .cat-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
    margin-bottom: 20px;
  }
  
  .cat-table th, .cat-table td {
    padding: 10px 12px;
    font-size: 0.8rem;
    white-space: nowrap;
  }
  
  /* Exam Console Mobile Mode */
  body.exam-mode, body:has(.exam-layout) {
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100vh;
  }
  
  .exam-header {
    padding: 8px 12px;
    height: auto;
    min-height: 52px;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .exam-name {
    font-size: 0.9rem;
  }
  
  .timer-box {
    font-size: 0.9rem;
    padding: 4px 10px;
  }
  
  .exam-section-strip {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  
  .exam-section-strip::-webkit-scrollbar {
    display: none;
  }
  
  .sec-step {
    flex: 0 0 auto;
    padding: 8px 12px;
    font-size: 0.75rem;
    min-width: 120px;
    white-space: nowrap;
  }
  
  .exam-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 110px);
  }
  
  .exam-main {
    padding: 14px 12px;
    overflow-y: visible;
    width: 100%;
  }
  
  .passage-container {
    padding: 16px 18px;
    font-size: 0.96rem;
    line-height: 1.7;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    border-radius: 10px;
    margin-bottom: 16px;
  }
  
  .q-body {
    font-size: 0.98rem;
    margin-bottom: 16px;
  }
  
  .opt-item {
    padding: 10px 14px;
    gap: 10px;
    border-radius: 8px;
  }
  
  .opt-text {
    font-size: 0.88rem;
  }
  
  .question-nav-bar, .exam-controls {
    position: sticky;
    bottom: 0;
    background: rgba(9, 13, 22, 0.96);
    backdrop-filter: blur(14px);
    padding: 12px;
    margin-top: 20px;
    z-index: 100;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.6);
  }
  
  .exam-sidebar {
    width: 100%;
    border-left: none;
    border-top: 2px solid var(--border-subtle);
    padding: 18px 14px;
  }
  
  .palette-container, .palette-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    padding: 8px 0;
    max-height: 220px;
  }
  
  .pal-num-btn, .pal-btn {
    font-size: 0.82rem;
  }
  
  /* Scorecard & Reports Mobile */
  .report-hero {
    grid-template-columns: 1fr;
    padding: 20px 16px;
    gap: 20px;
  }
  
  .score-display-box {
    padding: 16px 12px;
  }
  
  .score-num {
    font-size: 2.5rem;
  }
  
  .stats-grid-4 {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  
  .stat-metric-card {
    padding: 14px 10px;
  }
  
  .stat-metric-val {
    font-size: 1.35rem;
  }
  
  .modal-card, .grant-modal-card {
    max-width: 95vw;
    padding: 20px 16px;
  }
}

/* EXTRA SMALL SCREENS (<= 480px) */
@media (max-width: 480px) {
  .hero-title {
    font-size: 1.55rem;
  }
  
  .brand-pill {
    display: none;
  }
  
  .btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }
  
  .palette-container, .palette-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
  }
  
  .pal-num-btn, .pal-btn {
    font-size: 0.75rem;
  }
  
  .card-meta-row {
    font-size: 0.75rem;
    flex-wrap: wrap;
    gap: 6px;
  }
}

@media print {
  body { background: #fff !important; color: #000 !important; }
  .cat-nav, .exam-controls, .question-nav-bar, .btn, button { display: none !important; }
  .cat-card, .sec-card, .stat-metric-card, .q-review-card, .cat-table-wrap {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
  }
  .cat-table td, .cat-table th, .q-body, .score-num {
    color: #000 !important;
  }
}

/* ============================================================================
   TAXONOMY & SUBTOPIC DIRECTORY STYLES
   ============================================================================ */
.taxonomy-section {
  margin-bottom: 28px;
}
.taxonomy-category-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 18px;
  transition: all 0.3s;
}
.taxonomy-category-card:hover {
  border-color: var(--border-accent);
  background: rgba(30, 41, 59, 0.85);
}
.taxonomy-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.taxonomy-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}
.subtopic-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.subtopic-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.subtopic-chip:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--accent-cyan);
  color: #fff;
}
.blueprint-meta-strip {
  display: flex;
  gap: 16px;
  align-items: center;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  font-size: 0.88rem;
}

