/* ==========================================================================
   SSC 2026 English Preparation Web App - Modern Design System
   Copyright © 2026 Tanvin Sadik Dhrubo. All Rights Reserved.
   See COPYRIGHT.md.
   ========================================================================== */

:root {
  /* Color Palette - Dark Mode (Default) */
  --bg-primary: #090d16;
  --bg-surface: #111827;
  --bg-surface-elevated: #1e293b;
  --bg-surface-glass: rgba(17, 24, 39, 0.75);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-accent: rgba(99, 102, 241, 0.4);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #090d16;

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-secondary: #06b6d4;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
  --accent-gradient-warm: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --success-border: rgba(16, 185, 129, 0.35);

  --danger: #f43f5e;
  --danger-bg: rgba(244, 63, 94, 0.12);
  --danger-border: rgba(244, 63, 94, 0.35);

  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --warning-border: rgba(245, 158, 11, 0.35);

  --font-en: 'Plus Jakarta Sans', 'Outfit', system-ui, -apple-system, sans-serif;
  --font-bn: 'Hind Siliguri', 'Segoe UI', Tahoma, sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.25);

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Variables */
body.light-theme {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-surface-glass: rgba(255, 255, 255, 0.85);

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);
  --border-accent: rgba(99, 102, 241, 0.3);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
}

/* Global Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-en), var(--font-bn);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* Typography Defaults */
h1, h2, h3, h4, h5 {
  font-family: var(--font-en), var(--font-bn);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

p {
  color: var(--text-secondary);
}

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

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  transition: var(--transition);
}

.nav-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  cursor: pointer;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #fff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.light-theme .brand-title {
  background: linear-gradient(90deg, #0f172a, #334155);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-links {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-surface-elevated);
  padding: 0.3rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
  white-space: nowrap;
}

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

.nav-btn.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.theme-toggle-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

body.dark-theme .sun-icon { display: block; }
body.dark-theme .moon-icon { display: none; }
body.light-theme .sun-icon { display: none; }
body.light-theme .moon-icon { display: block; }

.student-badge-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
}

.student-badge-btn:hover {
  border-color: var(--accent-primary);
}

/* ==========================================================================
   Main Wrapper & Tab Architecture
   ========================================================================== */
.main-wrapper {
  max-width: 1240px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-pane.active {
  display: block;
}

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

/* ==========================================================================
   Hero & Cards
   ========================================================================== */
.hero-card {
  background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent 70%), var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.25rem 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.hero-card h2 {
  font-size: 1.85rem;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.hero-card p {
  font-size: 1.05rem;
  max-width: 780px;
  margin-bottom: 1.25rem;
}

.quick-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.stat-pill {
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-surface-elevated);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.stat-pill .bullet {
  color: var(--accent-primary);
  font-size: 0.65rem;
}

.stat-pill.highlight {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}

.stat-pill.highlight .bullet {
  color: var(--success);
}

/* ==========================================================================
   Topic Grid
   ========================================================================== */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

.topic-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.topic-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.topic-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.topic-item-num {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  color: var(--accent-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid var(--border-subtle);
}

.topic-marks {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--success);
  background: var(--success-bg);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
}

.topic-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.topic-card .bengali-title {
  font-family: var(--font-bn);
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.topic-card .desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.topic-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.q-count-badge {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.start-btn-link {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* ==========================================================================
   Practice Workspace
   ========================================================================== */
.practice-area {
  animation: fadeIn 0.25s ease-out;
}

.practice-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.back-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.back-btn:hover {
  background: var(--bg-surface);
  border-color: var(--border-strong);
}

.topic-title-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topic-title-box .item-tag {
  background: var(--accent-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
}

.topic-title-box h3 {
  font-size: 1.4rem;
}

.topic-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.q-counter {
  font-size: 0.9rem;
  font-weight: 700;
  background: var(--bg-surface-elevated);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

/* Question Source Filter Tabs */
.filter-wrapper {
  margin-bottom: 1.25rem;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  background: var(--bg-surface);
  padding: 0.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.filter-pill {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.filter-pill:hover {
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
}

.filter-pill.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.pill-count {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.18);
  font-weight: 700;
}

.filter-pill:not(.active) .pill-count {
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

/* Badges for Question Cards */
.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.source-badge.board-badge {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.source-badge.school-badge {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

/* Model Test Version Selector */
.test-version-selector {
  margin: 1.5rem 0;
}

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

.version-card {
  background: var(--bg-surface);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.version-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.version-card.active {
  border-color: var(--accent-primary);
  background: var(--bg-surface-elevated);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.2);
}

.version-card .v-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.version-card .v-badge.school {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.version-card h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.version-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Tips Accordion */
.tips-accordion {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.tips-header {
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  color: var(--warning);
  background: var(--warning-bg);
  transition: var(--transition);
}

.tips-header:hover {
  filter: brightness(1.1);
}

.tips-header .arrow {
  transition: transform 0.2s ease;
}

.tips-header.open .arrow {
  transform: rotate(180deg);
}

.tips-body {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.tips-body ul {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Question Card */
.question-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.question-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.board-tag {
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-accent);
}

.question-instruction {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

/* Clue Box */
.clue-box {
  background: var(--bg-surface-elevated);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.clue-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  user-select: none;
}

/* Passage & Fill-in-the-blanks */
.passage-content {
  font-size: 1.15rem;
  line-height: 2.2;
  color: var(--text-primary);
  margin-bottom: 2rem;
}

.blank-slot {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin: 0 0.25rem;
}

.blank-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent-secondary);
  margin-right: 0.25rem;
}

.blank-input {
  background: var(--bg-surface-elevated);
  border: 1.5px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  width: 140px;
  outline: none;
  transition: var(--transition);
  text-align: center;
}

.blank-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  background: var(--bg-surface);
}

.blank-input.correct {
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--success);
}

.blank-input.incorrect {
  border-color: var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
}

/* Sentence List Items (for Changing sentences, Tag questions) */
.sentence-items-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.sentence-item-row {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: var(--transition);
}

.sentence-item-row:hover {
  border-color: var(--border-strong);
}

.sentence-label-text {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.sentence-label-text .q-letter {
  background: var(--accent-primary);
  color: #fff;
  font-size: 0.78rem;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.direction-tag {
  color: var(--warning);
  font-weight: 700;
  font-size: 0.85rem;
  margin-left: 0.4rem;
}

.sentence-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-strong);
  color: var(--text-primary);
  padding: 0.7rem 1rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 500;
  outline: none;
  transition: var(--transition);
}

.sentence-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Substitution Table View */
.sub-table-responsive {
  overflow-x: auto;
  margin-bottom: 2rem;
}

.substitution-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.substitution-table th,
.substitution-table td {
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-subtle);
  font-size: 0.95rem;
  vertical-align: top;
}

.substitution-table th {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-secondary);
  font-weight: 700;
  text-align: left;
}

.substitution-table td ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.sub-input-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

/* Action Buttons Bar */
.question-actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.btn-primary, .btn-secondary, .btn-outline {
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-surface);
  border-color: var(--accent-primary);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-outline:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Question Explanation Drawer */
.explanation-panel {
  margin-top: 1.5rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  animation: fadeIn 0.25s ease-out;
}

.explanation-panel h4 {
  color: var(--success);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.explanation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.exp-item {
  background: var(--bg-surface);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  font-size: 0.9rem;
}

.exp-item strong {
  color: var(--accent-secondary);
}

.answer-feedback-list {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

.answer-feedback-card {
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--warning);
  border-radius: 10px;
  padding: 1rem;
  background: var(--bg-surface-elevated);
}

.answer-feedback-card.feedback-correct { border-left-color: var(--success); }
.answer-feedback-card.feedback-wrong { border-left-color: var(--danger); }
.answer-feedback-card h5 { margin: 0 0 0.65rem; font-size: 1rem; }
.feedback-answer-row { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; margin-bottom: 0.65rem; }
.why-wrong, .why-correct { margin-top: 0.5rem; line-height: 1.6; }
.why-wrong { color: var(--danger); }
.why-correct { color: var(--text-primary); }

.question-jump-label { color: var(--text-secondary); font-size: 0.85rem; margin-right: 0.45rem; }
.question-jump-select {
  min-width: 220px;
  max-width: 360px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}
@media (max-width: 700px) {
  .question-jump-select { min-width: 160px; max-width: 100%; }
  .question-jump-label { display: block; margin-bottom: 0.35rem; }
}

/* ==========================================================================
   Model Test Screen
   ========================================================================== */
.exam-intro-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  max-width: 860px;
  margin: 0 auto;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.exam-badge {
  display: inline-block;
  background: var(--accent-gradient);
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-full);
  margin-bottom: 1.25rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.exam-intro-card h2 {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.exam-intro-card p {
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.exam-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.meta-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.meta-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.meta-val {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
}

.student-preview-card {
  background: var(--bg-surface-elevated);
  border: 1px dashed var(--border-accent);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  text-align: left;
}

.student-info-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.95rem;
}

.student-info-row .label {
  color: var(--text-muted);
  margin-right: 0.3rem;
}

.edit-link {
  background: transparent;
  border: none;
  color: var(--accent-secondary);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.start-exam-btn {
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  font-size: 1.2rem;
  font-weight: 800;
  padding: 1rem 2.5rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.start-exam-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(99, 102, 241, 0.4);
}

/* Live Exam Sticky Header */
.exam-sticky-header {
  position: sticky;
  top: 64px;
  z-index: 90;
  background: var(--bg-surface-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

.exam-title-part {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--danger);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.candidate-tag {
  background: var(--bg-surface-elevated);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.timer-box {
  background: var(--bg-surface-elevated);
  border: 1.5px solid var(--warning);
  color: var(--warning);
  font-weight: 800;
  font-size: 1.25rem;
  padding: 0.35rem 1rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-variant-numeric: tabular-nums;
}

.timer-box.urgent {
  border-color: var(--danger);
  color: var(--danger);
  animation: pulse 1s infinite;
}

.submit-exam-btn {
  background: var(--success);
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.submit-exam-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.submit-exam-btn.large {
  font-size: 1.15rem;
  padding: 1rem 2.5rem;
  border-radius: var(--radius-full);
}

.exam-questions-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.exam-item-block {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.exam-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.exam-item-header h3 {
  font-size: 1.3rem;
}

.exam-bottom-bar {
  text-align: center;
  padding: 3rem 0;
}

/* ==========================================================================
   Marksheet & Result Screen
   ========================================================================== */
.marksheet-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  max-width: 920px;
  margin: 0 auto;
  box-shadow: var(--shadow-lg);
}

.marksheet-header {
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
}

.stamp-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--accent-primary);
  border: 1.5px solid var(--accent-primary);
  padding: 0.25rem 0.85rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

.marksheet-header h2 {
  font-size: 2.2rem;
  letter-spacing: -0.02em;
}

.student-summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border-subtle);
  font-size: 0.95rem;
}

.student-summary-strip .item span {
  color: var(--text-muted);
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.2rem;
}

.score-display-box {
  background: radial-gradient(circle at center, rgba(99, 102, 241, 0.15), transparent 70%), var(--bg-surface-elevated);
  border: 2px solid var(--border-accent);
  border-radius: var(--radius-xl);
  padding: 2rem;
  text-align: center;
  margin-bottom: 2rem;
}

.main-score {
  font-size: 3.8rem;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  margin-bottom: 0.5rem;
}

body.light-theme .main-score {
  color: var(--text-primary);
}

.score-total {
  font-size: 1.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.grade-badge {
  display: inline-block;
  background: var(--success);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 900;
  padding: 0.25rem 1.75rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.5rem;
}

.percent-label {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.sync-status-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  margin-bottom: 2rem;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.sync-status-box.synced {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}

.marksheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2.5rem;
}

.detailed-review-section {
  border-top: 1.5px solid var(--border-subtle);
  padding-top: 2rem;
}

.detailed-review-section h3 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.review-item-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.review-item-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
}

.review-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.review-table th, .review-table td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-subtle);
  text-align: left;
}

.review-table th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
}

.review-ans.correct {
  color: var(--success);
  font-weight: 700;
}

.review-ans.incorrect {
  color: var(--danger);
  font-weight: 700;
}

/* ==========================================================================
   Admin / Teacher Dashboard
   ========================================================================== */
.admin-wrapper {
  animation: fadeIn 0.25s ease-out;
}

.admin-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-top-actions {
  display: flex;
  gap: 0.75rem;
}

.integration-banner {
  background: radial-gradient(circle at top left, rgba(6, 182, 212, 0.15), transparent 70%), var(--bg-surface);
  border: 1.5px solid var(--accent-secondary);
  border-radius: var(--radius-xl);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.banner-icon {
  font-size: 2.2rem;
}

.banner-info strong {
  font-size: 1.15rem;
  display: block;
  margin-bottom: 0.25rem;
}

.banner-info p {
  font-size: 0.95rem;
}

.setup-btn {
  background: var(--accent-secondary);
  color: #fff;
  border: none;
  font-weight: 700;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
}

.stats-counter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.counter-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.count-val {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--accent-primary);
  line-height: 1.2;
}

.count-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.table-toolbar input {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  width: 320px;
  font-size: 0.95rem;
  outline: none;
}

.table-toolbar input:focus {
  border-color: var(--accent-primary);
}

.clear-btn {
  background: transparent;
  border: 1px solid var(--danger-border);
  color: var(--danger);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}

.clear-btn:hover {
  background: var(--danger-bg);
}

.table-responsive {
  overflow-x: auto;
}

.submissions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.submissions-table th,
.submissions-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

.submissions-table th {
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  font-weight: 700;
}

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

.view-detail-btn {
  background: var(--accent-primary);
  color: #fff;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease-out;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-dialog.wide {
  max-width: 780px;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.3rem;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
}

.modal-note {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-group input {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 0.7rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.form-group input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.integration-guide-steps {
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.92rem;
}

.step-badge {
  display: inline-block;
  background: var(--accent-secondary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.test-connection-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.test-feedback {
  font-size: 0.9rem;
  font-weight: 600;
}

/* Toast Notifications */
.toast-notification {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 300;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  font-size: 0.95rem;
  animation: slideUp 0.3s ease-out;
}

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

.toast-notification.success {
  border-color: var(--success);
  color: var(--success);
}

.toast-notification.error {
  border-color: var(--danger);
  color: var(--danger);
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 900px) {
  .nav-container {
    flex-wrap: wrap;
  }
  .nav-links {
    order: 3;
    width: 100%;
    justify-content: center;
    overflow-x: auto;
  }
  .main-score {
    font-size: 3rem;
  }
}

@media (max-width: 640px) {
  .hero-card {
    padding: 1.5rem;
  }
  .hero-card h2 {
    font-size: 1.4rem;
  }
  .question-card {
    padding: 1.25rem;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .exam-sticky-header {
    top: 110px;
    padding: 0.6rem 1rem;
  }
  .timer-box {
    font-size: 1rem;
    padding: 0.25rem 0.75rem;
  }
  .blank-input {
    width: 110px;
    font-size: 0.9rem;
  }
}

/* Print Stylesheet for Marksheet */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .navbar, .marksheet-actions, .sync-status-box, #themeToggle, .nav-btn {
    display: none !important;
  }
  .marksheet-card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    padding: 0 !important;
  }
  .score-display-box {
    background: #f5f5f5 !important;
    border: 1px solid #ccc !important;
  }
}
/* Student and teacher account controls */
#studentProfileFields, #studentProfileFooter { display: none; }
.portal-form { display: grid; gap: 0.8rem; margin: 1rem 0; }
.portal-login-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 1rem; }
.portal-login-tabs button { padding: 0.8rem 0.5rem; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg-surface-elevated); color: var(--text-primary); font-weight: 700; cursor: pointer; }
.portal-login-tabs button.active { border-color: var(--accent-primary); background: var(--accent-primary); color: #fff; }
.portal-form details { padding: 0.7rem; border: 1px solid var(--border-subtle); border-radius: 8px; }
.portal-form details label { margin-top: 0.6rem; }
.portal-form label { display: grid; gap: 0.3rem; font-weight: 600; }
.portal-form input { width: 100%; padding: 0.7rem; border: 1px solid var(--border-color, #777); border-radius: 8px; background: var(--bg-surface, #fff); color: var(--text-primary, #111); }
#portalAuthMessage { color: var(--danger, #c00); min-height: 1.2em; }
#portalHistory { overflow-x: auto; }
#portalFeedback li { margin: 0.5rem 0; }
.portal-pages { display: flex; justify-content: center; align-items: center; gap: 0.8rem; margin: 1rem 0; }
.portal-pages button { padding: 0.5rem 0.8rem; border-radius: 8px; cursor: pointer; }
.portal-pages button:disabled { opacity: 0.5; cursor: default; }

.site-credit {
  padding: 1.5rem 1rem 2rem;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.7;
}
.site-credit strong { color: var(--text-primary); }
.site-credit a { color: var(--accent-primary); font-weight: 600; }
