/* ==========================================================================
   DSC SA BIOLOGY MCQ TEST SERIES — CORE STYLESHEET
   Clean, Professional Educational Design System (Navy Blue & Light Theme)
   ========================================================================== */

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

:root {
  --primary-navy: #0f2b5c;
  --primary-navy-dark: #0a1c3d;
  --primary-navy-light: #1e3a8a;
  --primary-navy-surface: #eff6ff;

  --accent-blue: #2563eb;
  --accent-teal: #0d9488;
  --accent-amber: #d97706;
  --accent-green: #16a34a;
  --accent-red: #dc2626;

  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;

  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-focus: #3b82f6;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-on-navy: #ffffff;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-navy: 0 4px 14px 0 rgba(15, 43, 92, 0.2);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, 'Noto Sans Telugu', 'Gautami', 'Nirmala UI', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

button, input, select, textarea {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Layout & Container
   -------------------------------------------------------------------------- */
.container {
  max-width: 1400px;
  width: 94%;
  margin: 0 auto;
  padding: 24px 0;
}

/* --------------------------------------------------------------------------
   Header & Top Navigation
   -------------------------------------------------------------------------- */
.portal-header {
  background: var(--primary-navy);
  color: var(--text-on-navy);
  border-bottom: 3px solid var(--accent-blue);
  box-shadow: var(--shadow-navy);
  position: sticky;
  top: 0;
  z-index: 100;
}

.portal-header-inner {
  max-width: 1400px;
  width: 94%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 16px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #60a5fa;
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
  line-height: 1.2;
}

.brand-text p {
  font-size: 0.8rem;
  color: #93c5fd;
  margin-top: 2px;
  font-weight: 500;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-link {
  color: #e2e8f0;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
}

.nav-link.admin-btn {
  background: #1e3a8a;
  border-color: #3b82f6;
  color: #f8fafc;
}

.nav-link.admin-btn:hover {
  background: #2563eb;
}

/* --------------------------------------------------------------------------
   Hero & Overview Section
   -------------------------------------------------------------------------- */
.hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.hero-info h2 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--primary-navy);
  margin-bottom: 6px;
}

.hero-info p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  max-width: 820px;
  line-height: 1.6;
}

.hero-stats-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.stat-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  text-align: center;
  min-width: 120px;
}

.stat-box .stat-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-navy);
  line-height: 1.1;
}

.stat-box .stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Tabs Navigation (Syllabus Categories)
   -------------------------------------------------------------------------- */
.category-tabs-wrap {
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-medium);
  background: var(--bg-card);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: 6px 12px 0;
}

.category-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 12px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab-btn:hover {
  color: var(--primary-navy);
  background: var(--bg-subtle);
}

.tab-btn.active {
  color: var(--primary-navy);
  border-bottom-color: var(--primary-navy);
  background: var(--primary-navy-surface);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Search & Filter Toolbar
   -------------------------------------------------------------------------- */
.filter-toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.search-input-wrap {
  flex: 1 1 280px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
}

.filter-select {
  padding: 10px 14px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--text-primary);
  background: var(--bg-card);
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* --------------------------------------------------------------------------
   Test Cards Grid
   -------------------------------------------------------------------------- */
.test-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.test-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.test-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #93c5fd;
}

.test-card-header {
  margin-bottom: 14px;
}

.card-badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.badge-category {
  background: var(--primary-navy-surface);
  color: var(--primary-navy);
  border: 1px solid #bfdbfe;
}

.badge-difficulty-easy {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.badge-difficulty-moderate {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-difficulty-hard {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.test-card h3 {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--primary-navy);
  line-height: 1.35;
  margin-bottom: 6px;
}

.test-card-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.test-card-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  margin: 14px 0;
}

.meta-item {
  text-align: center;
}

.meta-item .val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.meta-item .lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

.test-card-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

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

.btn-primary {
  background: var(--primary-navy);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-navy-light);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background: var(--bg-subtle);
  border-color: var(--border-medium);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

.btn-full {
  width: 100%;
}

/* --------------------------------------------------------------------------
   Examination Interface Layout
   -------------------------------------------------------------------------- */
.exam-screen {
  display: none;
}

.exam-screen.active {
  display: block;
}

.exam-sticky-bar {
  position: sticky;
  top: 0;
  z-index: 500;
  background: #ffffff;
  border-bottom: 2px solid #cbd5e1;
  box-shadow: var(--shadow-md);
  padding: 10px 0;
}

.exam-sticky-inner {
  max-width: 1400px;
  width: 94%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

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

.btn-exit {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-exit:hover {
  background: #fecaca;
}

.exam-active-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary-navy);
}

.timer-box {
  background: #0f172a;
  color: #f8fafc;
  padding: 6px 16px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.timer-box .timer-icon {
  font-size: 14px;
  color: #f59e0b;
}

.timer-val {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
  color: #38bdf8;
}

.timer-box.low-time {
  background: #991b1b;
}

.timer-box.low-time .timer-val {
  color: #fef08a;
  animation: timerBlink 1s infinite;
}

@keyframes timerBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.exam-progress-pill {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
}

/* Two-Column Exam Grid */
.exam-layout-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  max-width: 1400px;
  width: 94%;
  margin: 24px auto;
  align-items: start;
}

/* Question Area (Left Column) */
.question-stream {
  min-width: 0;
}

.exam-welcome-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.welcome-quote {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-style: italic;
  border-left: 3px solid var(--primary-navy);
  padding-left: 12px;
  margin-top: 8px;
}

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease;
}

.question-card.active-question {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.question-card.review-flagged {
  border-left: 5px solid var(--accent-amber);
}

.question-card.evaluated-correct {
  border-left: 5px solid var(--accent-green);
  background: #f0fdf4;
}

.question-card.evaluated-wrong {
  border-left: 5px solid var(--accent-red);
  background: #fef2f2;
}

.qhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.qnum-badge {
  font-size: 0.85rem;
  font-weight: 800;
  color: #ffffff;
  background: var(--primary-navy);
  padding: 4px 12px;
  border-radius: 14px;
}

.qactions-row {
  display: flex;
  gap: 8px;
}

.btn-flag {
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-flag.flagged {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.qtext {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.7;
  margin-bottom: 18px;
  white-space: pre-line;
}

.options-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.95rem;
  line-height: 1.5;
}

.option-item:hover {
  background: var(--bg-subtle);
  border-color: #94a3b8;
}

.option-item.selected {
  background: var(--primary-navy-surface);
  border-color: var(--primary-navy);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--primary-navy);
}

.option-item.reveal-correct {
  background: #dcfce7 !important;
  border-color: #16a34a !important;
  color: #14532d;
  font-weight: 700;
}

.option-item.reveal-wrong {
  background: #fee2e2 !important;
  border-color: #dc2626 !important;
  color: #7f1d1d;
}

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--primary-navy);
  flex-shrink: 0;
}

.explanation-card {
  margin-top: 14px;
  padding: 14px 18px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.6;
  display: none;
}

.explanation-card.show {
  display: block;
}

.explanation-card .exp-title {
  font-weight: 700;
  color: var(--primary-navy);
  margin-bottom: 4px;
}

/* Palette / Navigator Sidebar (Right Column) */
.navigator-sidebar {
  position: sticky;
  top: 76px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.palette-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary-navy);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.palette-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

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

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-dot.answered { background: var(--primary-navy); }
.legend-dot.unanswered { background: #e2e8f0; border: 1px solid #94a3b8; }
.legend-dot.flagged { background: var(--accent-amber); }
.legend-dot.current { background: #38bdf8; }

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

.nav-bubble {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-bubble:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.nav-bubble.answered {
  background: var(--primary-navy);
  color: #ffffff;
  border-color: var(--primary-navy-dark);
}

.nav-bubble.flagged {
  background: var(--accent-amber);
  color: #ffffff;
  border-color: #b45309;
}

.nav-bubble.current {
  box-shadow: 0 0 0 2px #38bdf8;
}

.nav-bubble.correct {
  background: #16a34a !important;
  color: #fff !important;
  border-color: #15803d !important;
}

.nav-bubble.wrong {
  background: #dc2626 !important;
  color: #fff !important;
  border-color: #b91c1c !important;
}

/* Exam Controls & Submission Overlay */
.exam-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 28px 0;
  padding: 18px 0;
  border-top: 1px solid var(--border-medium);
}

.score-result-overlay {
  display: none;
  background: var(--bg-card);
  border: 2px solid var(--primary-navy);
  border-radius: var(--radius-xl);
  padding: 28px;
  margin: 24px 0;
  box-shadow: var(--shadow-lg);
}

.score-result-overlay.show {
  display: block;
}

.score-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 20px;
}

.score-big-box {
  display: flex;
  align-items: center;
  gap: 20px;
}

.score-percentage {
  font-size: 3.2rem;
  font-weight: 900;
  color: var(--primary-navy);
  line-height: 1;
}

.score-status-badge {
  font-size: 1.1rem;
  font-weight: 800;
  padding: 6px 16px;
  border-radius: 20px;
  text-transform: uppercase;
}

.status-excellent { background: #dcfce7; color: #166534; }
.status-good { background: #eff6ff; color: #1e40af; }
.status-fair { background: #fef3c7; color: #92400e; }
.status-needs-revision { background: #fee2e2; color: #991b1b; }

.score-grid-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
}

.metric-card .val {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary-navy);
}

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

/* Post-Submit Review Filter Chips */
.review-filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 18px 0;
}

.chip-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-btn:hover {
  background: var(--bg-subtle);
  border-color: #94a3b8;
}

.chip-btn.active {
  background: var(--primary-navy);
  color: #ffffff;
  border-color: var(--primary-navy);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.portal-footer {
  background: var(--primary-navy-dark);
  color: #cbd5e1;
  padding: 30px 0 20px;
  margin-top: 60px;
  border-top: 1px solid #1e293b;
  font-size: 0.85rem;
}

.footer-inner {
  max-width: 1400px;
  width: 94%;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

/* Responsive adjustments */
@media (max-width: 992px) {
  .exam-layout-grid {
    grid-template-columns: 1fr;
  }
  .navigator-sidebar {
    position: static;
    margin-top: 20px;
  }
}

@media (max-width: 640px) {
  .hero-card {
    padding: 18px;
  }
  .test-grid {
    grid-template-columns: 1fr;
  }
  .palette-grid {
    grid-template-columns: repeat(8, 1fr);
  }
}
