/* ==========================================================================
   EduPath Design System — Digital SAT Adaptive Diagnostic Platform
   Colors: Obsidian / Slate Navy, Cobalt Accent, Emerald Mastery
   ========================================================================== */

:root {
  --bg-app: #080c14;
  --bg-surface: #0f172a;
  --bg-surface-elevated: #162036;
  --bg-surface-card: #131c31;
  --bg-input: #0a0f1d;
  
  --border-subtle: #1e293b;
  --border-default: #2a3852;
  --border-hover: #3d5073;
  --border-focus: #3b82f6;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-dim: #475569;

  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-light: #3b82f6;
  --accent-subtle: rgba(37, 99, 235, 0.15);

  --status-success: #10b981;
  --status-success-bg: rgba(16, 185, 129, 0.12);
  --status-warning: #f59e0b;
  --status-warning-bg: rgba(245, 158, 11, 0.12);
  --status-danger: #ef4444;
  --status-danger-bg: rgba(239, 68, 68, 0.12);
  --status-info: #0284c7;

  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-passage: 'Newsreader', Georgia, serif;
  --font-mono: 'JetBrains Mono', monospace;

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

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: var(--font-ui);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Header Navigation
   ========================================================================== */

.main-header {
  height: 64px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-container {
  max-width: 1320px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-primary), #1e40af);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: block;
}

.brand-subtitle {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
}

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

.nav-item {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.nav-item.active {
  color: #fff;
  background-color: var(--accent-primary);
}

.user-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-input);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
}

.user-role-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: var(--accent-subtle);
  color: var(--accent-light);
  letter-spacing: 0.04em;
}

.user-role-tag.admin {
  background-color: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.user-email-text {
  color: var(--text-primary);
  font-weight: 500;
}

/* ==========================================================================
   Buttons & Inputs
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  outline: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn:focus-visible {
  box-shadow: 0 0 0 2px var(--bg-app), 0 0 0 4px var(--accent-light);
}

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

.btn-secondary {
  background-color: var(--bg-surface-elevated);
  border-color: var(--border-default);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background-color: var(--border-subtle);
  border-color: var(--border-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-elevated);
}

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

.btn-lg {
  padding: 13px 26px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease;
}

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

/* ==========================================================================
   Viewport Container
   ========================================================================== */

.app-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.dashboard-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 24px 64px;
  width: 100%;
}

/* Hero Section */
.hero-card {
  background: linear-gradient(180deg, #16223b 0%, #0f172a 100%);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 40px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-light);
  background-color: var(--accent-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 16px;
}

.hero-title {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  color: #fff;
}

.hero-lead {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 720px;
  margin-bottom: 28px;
  line-height: 1.6;
}

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

/* Launch Cards Grid */
.section-heading {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 36px;
}

.card {
  background-color: var(--bg-surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

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

.card-badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background-color: var(--bg-surface-elevated);
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 14px;
}

.card-badge.primary {
  background-color: var(--accent-subtle);
  color: var(--accent-light);
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
  flex: 1;
}

.card-meta-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.card-meta-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Domains Progress Table */
.domain-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

.domain-stat-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
}

.domain-stat-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.domain-stat-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.progress-track {
  height: 6px;
  background-color: var(--bg-surface-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--accent-primary);
  border-radius: var(--radius-full);
}

.progress-fill.success {
  background-color: var(--status-success);
}
.progress-fill.warning {
  background-color: var(--status-warning);
}

/* ==========================================================================
   Digital SAT Test Runner Mode (Bluebook Exam Interface)
   ========================================================================== */

.test-runner-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: #0b0f19;
  color: var(--text-primary);
  overflow: hidden;
}

.test-top-bar {
  height: 56px;
  background-color: #0d1322;
  border-bottom: 1px solid #1f2a3f;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.test-title-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.test-section-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.test-module-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background-color: #1e2d4d;
  color: #60a5fa;
  border: 1px solid #2b406e;
}

.test-module-badge.adaptive-hard {
  background-color: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
  border-color: rgba(139, 92, 246, 0.4);
}

.test-timer-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.test-timer-display {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  background-color: #080c14;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #1e293b;
  min-width: 72px;
  text-align: center;
}

.test-timer-toggle-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
}

.test-nav-drawer-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: #162036;
  border: 1px solid #2a3b5c;
  color: #f1f5f9;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* Two-Column SAT Split View */
.test-body-split {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.test-pane-left {
  flex: 1;
  border-right: 1px solid #1f2a3f;
  padding: 36px 40px;
  overflow-y: auto;
  background-color: #090e1a;
}

.test-pane-right {
  flex: 1;
  padding: 36px 40px;
  overflow-y: auto;
  background-color: #0c1220;
  display: flex;
  flex-direction: column;
}

.stimulus-box {
  font-family: var(--font-passage);
  font-size: 18px;
  line-height: 1.7;
  color: #e2e8f0;
  white-space: pre-line;
}

.stimulus-box p {
  margin-bottom: 18px;
}

.question-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #1e293b;
}

.question-number-tag {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
}

.question-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tool-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.question-stem {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  line-height: 1.5;
  margin-bottom: 24px;
}

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

.option-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background-color: #121a2c;
  border: 1px solid #22304d;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.option-row:hover {
  background-color: #162239;
  border-color: #3b527d;
}

.option-row.selected {
  background-color: rgba(37, 99, 235, 0.18);
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f6;
}

.option-row.eliminated {
  opacity: 0.45;
  text-decoration: line-through;
  background-color: #0b0f19;
  border-color: #192336;
}

.option-letter {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: 1px solid #334466;
  background-color: #0d1424;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.option-row.selected .option-letter {
  background-color: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

.option-text {
  font-size: 15px;
  color: #e2e8f0;
  line-height: 1.5;
  flex: 1;
  padding-top: 2px;
}

.option-strikethrough-btn {
  background: none;
  border: none;
  color: #64748b;
  font-size: 12px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.option-strikethrough-btn:hover {
  color: #94a3b8;
  background-color: #1e293b;
}

/* Bottom Controls */
.test-bottom-bar {
  height: 64px;
  background-color: #0d1322;
  border-top: 1px solid #1f2a3f;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Question Matrix Modal / Dropdown */
.navigator-modal {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.navigator-card {
  background-color: #131c31;
  border: 1px solid #2b3b5c;
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 90%;
  max-width: 540px;
}

.navigator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 10px;
  margin: 20px 0;
}

.nav-grid-chip {
  height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background-color: #0b101c;
  border: 1px solid #23314f;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  position: relative;
}

.nav-grid-chip.answered {
  background-color: #1e3a8a;
  border-color: #3b82f6;
  color: #fff;
}

.nav-grid-chip.flagged::after {
  content: '★';
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 9px;
  color: #f59e0b;
}

.nav-grid-chip.current {
  outline: 2px solid #60a5fa;
  outline-offset: 1px;
}

/* ==========================================================================
   Diagnostic Report View
   ========================================================================== */

.report-container {
  max-width: 1000px;
  margin: 32px auto 64px;
  padding: 0 24px;
}

.report-header-card {
  background: linear-gradient(180deg, #182642 0%, #10192e 100%);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 36px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
}

.score-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #0b1120;
  border: 2px solid #2563eb;
  border-radius: var(--radius-lg);
  padding: 24px 36px;
  text-align: center;
}

.score-value {
  font-size: 48px;
  font-weight: 800;
  color: #60a5fa;
  line-height: 1;
  margin-bottom: 4px;
  font-family: var(--font-ui);
}

.score-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.adaptive-path-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 28px;
}

.adaptive-step-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.adaptive-step-row:last-child {
  border-bottom: none;
}

/* Mistake Journal */
.mistake-card {
  background-color: var(--bg-surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.mistake-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.distractor-rationale-box {
  background-color: rgba(239, 68, 68, 0.08);
  border-left: 3px solid #ef4444;
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 12px 0;
  font-size: 14px;
  color: #fca5a5;
}

.explanation-box {
  background-color: rgba(16, 185, 129, 0.08);
  border-left: 3px solid #10b981;
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px;
  color: #a7f3d0;
}

/* Modal Dialog */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-dialog {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

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

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.modal-body {
  padding: 24px;
}

.quick-access-box {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 20px;
}

.quick-access-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}

.quick-access-btns {
  display: flex;
  gap: 8px;
}

.modal-footer-toggle {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent-light);
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0 4px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background-color: #1e293b;
  border: 1px solid var(--border-default);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  font-weight: 500;
  animation: slideIn 0.2s ease-out;
}

.toast.success {
  border-left: 4px solid var(--status-success);
}
.toast.error {
  border-left: 4px solid var(--status-danger);
}
.toast.info {
  border-left: 4px solid var(--accent-light);
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 860px) {
  .test-body-split {
    flex-direction: column;
  }
  .test-pane-left {
    border-right: none;
    border-bottom: 1px solid #1f2a3f;
    max-height: 45vh;
  }
}
