/* ============================================================
   🧬 BIOMASTER A/L - MODERN BIOLOGY LEARNING PLATFORM
   Design System: Medical Emerald, Deep Slate, Electric Cyan
   ============================================================ */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Primary Palette */
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-light: rgba(16, 185, 129, 0.12);
  --primary-border: rgba(16, 185, 129, 0.28);
  
  --secondary: #06b6d4;
  --secondary-light: rgba(6, 182, 212, 0.12);
  
  --accent: #f59e0b;
  --accent-light: rgba(245, 158, 11, 0.12);
  
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.12);
  
  --purple: #8b5cf6;
  --purple-light: rgba(139, 92, 246, 0.12);

  /* Dark Theme Surfaces (Default) */
  --bg-app: #090d16;
  --bg-card: #111827;
  --bg-card-hover: #172236;
  --bg-sidebar: #0d131f;
  --bg-input: #1e293b;
  --bg-modal: #111827;
  
  --border-subtle: #1f2937;
  --border-focus: #10b981;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.25);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

/* Light Mode Overrides */
[data-theme="light"] {
  --bg-app: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-input: #e2e8f0;
  --bg-modal: #ffffff;
  
  --border-subtle: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: -0.02em;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--secondary);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

/* ============================================================
   HEADER & NAVBAR
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 19, 31, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 1.5rem;
}

[data-theme="light"] .site-header {
  background: rgba(255, 255, 255, 0.85);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

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

.brand-logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: var(--shadow-glow);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(90deg, #10b981, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Navigation Links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.2s;
}

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

.nav-item.active {
  color: var(--primary);
  background: var(--primary-light);
  border-color: var(--primary-border);
}

.nav-item .badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--primary);
  color: #064e3b;
  font-weight: 700;
}

.nav-item.teacher-nav {
  color: var(--accent);
  border-color: rgba(245, 158, 11, 0.25);
  background: var(--accent-light);
}

/* Header User Controls */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.user-role-pill {
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.user-role-pill.teacher {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.user-role-pill.student {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-header-action {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-login-trigger {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

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

.btn-logout-trigger {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.btn-logout-trigger:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.theme-toggle-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

/* ============================================================
   APP CONTAINER & VIEWS
   ============================================================ */
.main-content {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
}

.portal-view {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

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

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

/* ============================================================
   VIEW: DASHBOARD / OVERVIEW
   ============================================================ */
.dashboard-hero {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(6, 182, 212, 0.08)), var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.dashboard-hero::after {
  content: '🧬';
  position: absolute;
  right: 2rem;
  bottom: -1rem;
  font-size: 10rem;
  opacity: 0.08;
  pointer-events: none;
}

.hero-tagline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.hero-title {
  font-size: 2.2rem;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 780px;
  margin-bottom: 1.75rem;
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.btn-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

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

/* Quick Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: transform 0.2s, border-color 0.2s;
}

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

.metric-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

.metric-data h3 {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.1;
}

.metric-data p {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Progress Section */
.progress-banner-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.progress-bar-track {
  height: 12px;
  background: var(--bg-input);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #06b6d4);
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   VIEW: TOPIC-BY-TOPIC STUDY HUB
   ============================================================ */
.study-hub-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 960px) {
  .study-hub-layout {
    grid-template-columns: 1fr;
  }
}

/* Units & Subtopics Sidebar */
.units-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: sticky;
  top: 5rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
}

.sidebar-heading {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.unit-accordion-item {
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
}

.unit-header-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text-main);
  padding: 0.6rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
}

.unit-header-btn:hover {
  background: var(--bg-card-hover);
}

.unit-header-btn.active {
  color: var(--primary);
  background: var(--primary-light);
}

.topic-list {
  list-style: none;
  padding-left: 0.75rem;
  margin-top: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.topic-nav-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text-muted);
  padding: 0.45rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.topic-nav-btn.active {
  color: var(--primary);
  font-weight: 700;
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
}

/* Lesson Reader Pane */
.lesson-reader-pane {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.25rem;
  min-height: 600px;
}

.lesson-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.lesson-unit-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.3rem;
}

.lesson-title {
  font-size: 1.85rem;
  line-height: 1.25;
}

.btn-view-resource-book {
  background: var(--secondary-light);
  color: var(--secondary);
  border: 1px solid var(--secondary);
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.btn-view-resource-book:hover {
  background: var(--secondary);
  color: #083344;
}

/* NIE Keywords Banner */
.keywords-banner {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 2rem;
}

.keywords-header {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.keywords-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.keyword-pill {
  background: var(--bg-card);
  border: 1px solid var(--primary-border);
  color: var(--text-main);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Theory Markdown Prose */
.theory-body {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-main);
  margin-bottom: 2.5rem;
}

.theory-body h2, .theory-body h3 {
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
  color: var(--secondary);
}

.theory-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

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

.theory-body th {
  background: var(--bg-input);
  color: var(--primary);
  font-weight: 700;
}

.theory-body ul, .theory-body ol {
  padding-left: 1.5rem;
  margin: 1rem 0;
}

/* Examiner Alerts */
.examiner-box {
  background: rgba(245, 158, 11, 0.09);
  border-left: 4px solid var(--accent);
  padding: 1.25rem 1.5rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 2rem 0;
}

.examiner-box h4 {
  color: var(--accent);
  font-size: 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.examiner-box p {
  color: var(--text-main);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Checkpoint Quiz */
.checkpoint-quiz-box {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-top: 2.5rem;
}

.checkpoint-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.checkpoint-q-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.checkpoint-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.quiz-option-btn {
  text-align: left;
  padding: 0.65rem 1rem;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.quiz-option-btn:hover {
  border-color: var(--secondary);
}

.quiz-option-btn.correct {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

.quiz-option-btn.wrong {
  background: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger);
  font-weight: 700;
}

.quiz-explanation {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-app);
  border-left: 3px solid var(--secondary);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ============================================================
   VIEW: RESOURCE BOOKS VAULT
   ============================================================ */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.book-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s, border-color 0.2s;
}

.book-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
}

.book-cover-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.book-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.book-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.book-actions-row {
  display: flex;
  gap: 0.75rem;
}

/* ============================================================
   VIEW: 42 PRACTICALS LAB HUB
   ============================================================ */
.practicals-accordion-group {
  margin-bottom: 1.5rem;
}

.practical-cat-title {
  font-size: 1.25rem;
  color: var(--secondary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.practical-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

.practical-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: background 0.15s, border-color 0.15s;
}

.practical-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--secondary);
}

/* ============================================================
   VIEW: TIMED 50-MCQ EXAM TRAINER
   ============================================================ */
.exam-arena-header {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.exam-timer {
  font-family: monospace;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  background: rgba(245, 158, 11, 0.12);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.exam-body-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2rem;
}

.exam-q-text {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* ============================================================
   VIEW: TEACHER GRADING & MARKING SUITE
   ============================================================ */
.teacher-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(16, 185, 129, 0.08)), var(--bg-card);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.teacher-banner h2 {
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.submissions-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.submissions-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

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

.submissions-table th {
  background: var(--bg-input);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.status-tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-tag.pending {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-tag.graded {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.btn-grade-action {
  background: var(--primary);
  color: #064e3b;
  font-weight: 700;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}

.btn-grade-action:hover {
  filter: brightness(1.1);
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.modal-container {
  background: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 580px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalScale 0.2s ease-out;
}

.modal-container.large {
  max-width: 900px;
}

.modal-container.pdf-viewer-modal {
  max-width: 1100px;
  height: 90vh;
  display: flex;
  flex-direction: column;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.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.25rem;
}

.modal-close-btn {
  background: transparent;
  color: var(--text-muted);
  font-size: 1.5rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.modal-close-btn:hover {
  background: var(--bg-input);
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
  max-height: calc(85vh - 120px);
  overflow-y: auto;
}

.modal-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  flex: 1;
}

/* Forms in Modal */
.form-group {
  margin-bottom: 1.25rem;
}

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

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--primary);
  outline: none;
}

textarea.form-input {
  resize: vertical;
  min-height: 100px;
}

/* Toast Alerts */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  animation: toastIn 0.25s ease-out;
}

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

@keyframes toastIn {
  from { transform: translateX(50px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   SEARCH BAR & AUTOCOMPLETE
   ============================================================ */
.header-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: 0.5rem;
}

.search-input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.45rem 1rem 0.45rem 2.25rem;
  border-radius: var(--radius-xl);
  font-size: 0.85rem;
  width: 220px;
  transition: all 0.2s ease;
}

.search-input:focus {
  width: 300px;
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 12px var(--primary-light);
}

.search-icon-pos {
  position: absolute;
  left: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  pointer-events: none;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 360px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1500;
  display: none;
}

.search-dropdown.active {
  display: block;
}

.search-result-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.15s ease;
}

.search-result-item:hover {
  background: var(--bg-card-hover);
}

.search-result-item .item-type {
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.2rem;
}

.search-result-item .item-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.search-result-item .item-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================================
   GAMIFICATION CHIPS (STREAK, XP, LEVEL)
   ============================================================ */
.gamification-chips {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chip-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-xl);
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.chip-streak {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
}

.chip-xp {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.3);
}

.chip-level {
  background: rgba(6, 182, 212, 0.15);
  color: #06b6d4;
  border-color: rgba(6, 182, 212, 0.3);
}

/* ============================================================
   INTERACTIVE COMPONENT: HOTSPOT DIAGRAM
   ============================================================ */
.hotspot-viewer-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 2rem 0;
  box-shadow: var(--shadow-sm);
}

.hotspot-stage {
  position: relative;
  width: 100%;
  max-width: 750px;
  margin: 0 auto;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #060b13;
  border: 1px solid var(--border-subtle);
}

.hotspot-svg-diagram {
  width: 100%;
  height: auto;
  display: block;
}

.hotspot-pin {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 10;
}

.hotspot-pin:hover, .hotspot-pin.active {
  transform: translate(-50%, -50%) scale(1.25);
  background: var(--secondary);
  box-shadow: 0 0 0 8px rgba(6, 182, 212, 0.45);
}

.hotspot-details-card {
  margin-top: 1rem;
  background: var(--bg-input);
  border-left: 4px solid var(--secondary);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  animation: fadeIn 0.2s ease;
}

.hotspot-details-card h4 {
  color: var(--secondary);
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.hotspot-details-card p {
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.5;
}

/* ============================================================
   INTERACTIVE COMPONENT: PROCESS ANIMATOR (STEPPER)
   ============================================================ */
.process-animator-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 2rem 0;
}

.stepper-progress-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  position: relative;
}

.stepper-dot-node {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 2px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 2;
}

.stepper-dot-node.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 12px var(--primary);
}

.stepper-dot-node.completed {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--primary);
  color: var(--primary);
}

.process-stage-viewport {
  background: #040810;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.process-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.25rem;
}

/* ============================================================
   INTERACTIVE COMPONENT: COMPARE RECALL ACTIVITY
   ============================================================ */
.compare-interactive-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 2rem 0;
}

.blinded-cell {
  background: var(--bg-input) !important;
  color: transparent !important;
  user-select: none;
  cursor: pointer;
  position: relative;
  border: 1px dashed var(--secondary) !important;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease;
}

.blinded-cell::after {
  content: '❓ Click to Reveal';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--secondary);
  font-size: 0.75rem;
  font-weight: 700;
}

.blinded-cell.revealed {
  background: transparent !important;
  color: var(--text-main) !important;
  border-style: solid !important;
}

.blinded-cell.revealed::after {
  display: none;
}

/* ============================================================
   INTERACTIVE COMPONENT: PREDICTION ACTIVITY
   ============================================================ */
.prediction-box {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.08) 0%, rgba(16, 185, 129, 0.08) 100%);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 2rem 0;
}

.prediction-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  margin: 1rem 0;
}

.prediction-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  text-align: left;
  color: var(--text-main);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.prediction-btn:hover {
  border-color: var(--secondary);
  background: var(--bg-card-hover);
}

.prediction-btn.selected {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.15);
  font-weight: 700;
}

/* ============================================================
   INTERACTIVE COMPONENT: FLIP CARDS
   ============================================================ */
.flashcards-tray {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.flip-card {
  perspective: 1000px;
  height: 180px;
  cursor: pointer;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.5s;
  transform-style: preserve-3d;
  border-radius: var(--radius-md);
}

.flip-card.flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
}

.flip-card-front {
  background: var(--bg-card);
  color: var(--text-main);
}

.flip-card-back {
  background: var(--bg-input);
  color: var(--text-main);
  transform: rotateY(180deg);
  border-color: var(--primary);
}

/* ============================================================
   VIRTUAL PRACTICAL SIMULATION LAB
   ============================================================ */
.sim-suite-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.sim-tabs-header {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.sim-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.sim-tab-btn.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.sim-lab-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .sim-lab-grid {
    grid-template-columns: 1fr;
  }
}

.sim-controls-pane {
  background: var(--bg-input);
  padding: 1.25rem;
  border-radius: var(--radius-md);
}

.sim-slider-row {
  margin-bottom: 1.25rem;
}

.sim-slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.sim-range-input {
  width: 100%;
  accent-color: var(--primary);
}

.sim-visual-pane {
  background: #050912;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  position: relative;
}

.tube-stand {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2rem;
  height: 180px;
}

.glass-tube {
  width: 44px;
  height: 150px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top: none;
  border-radius: 0 0 22px 22px;
  position: relative;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.tube-liquid {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: #3b82f6;
  transition: all 0.5s ease;
  border-radius: 0 0 20px 20px;
}

.tube-bubble {
  position: absolute;
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  animation: bubbleRise 1.2s infinite ease-in;
}

@keyframes bubbleRise {
  0% { bottom: 0; opacity: 0; transform: translateX(0); }
  50% { opacity: 1; transform: translateX(4px); }
  100% { bottom: 100%; opacity: 0; transform: translateX(-4px); }
}

/* ============================================================
   MISTAKE BANK CARDS
   ============================================================ */
.mistake-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  transition: border-color 0.2s ease;
}

.mistake-card:hover {
  border-color: rgba(239, 68, 68, 0.4);
}

.mistake-status-badge {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-xl);
}

.status-needs-review {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-improving {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-mastered {
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Responsive Rules */
@media (max-width: 768px) {
  .site-header { padding: 0.6rem 1rem; }
  .nav-links { overflow-x: auto; max-width: 100%; }
  .dashboard-hero { padding: 1.5rem; }
  .hero-title { font-size: 1.6rem; }
  .lesson-reader-pane { padding: 1.25rem; }
  .lesson-top-bar { flex-direction: column; }
  .header-search-wrap { display: none; }
}

