/* Study Guide - Page-specific styles */
/* Extends shared.css design system */

/* Layout: sidebar + main content */
.study-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar TOC */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 280px;
  min-width: 280px;
  overflow-y: auto;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: var(--space-6) 0;
  z-index: 100;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  padding: 0 var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--space-4);
}

.sidebar-header a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: color var(--transition-fast);
}

.sidebar-header a:hover {
  color: var(--accent);
}

.sidebar-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 var(--space-6);
  margin-bottom: var(--space-3);
}

.sidebar nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar nav > ul > li {
  margin-bottom: var(--space-1);
}

.sidebar nav a {
  display: block;
  padding: var(--space-2) var(--space-6);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  line-height: 1.4;
  border-left: 3px solid transparent;
  transition: all var(--transition-fast);
}

.sidebar nav a:hover {
  color: var(--accent);
  background: var(--bg-primary);
  border-left-color: var(--accent);
}

.sidebar nav a.active {
  color: var(--accent);
  background: var(--bg-primary);
  border-left-color: var(--accent);
  font-weight: 600;
}

.toc-topic {
  font-weight: 600;
  color: var(--text-primary) !important;
  font-size: var(--text-sm) !important;
}

.toc-subtopic {
  padding-left: calc(var(--space-6) + var(--space-4)) !important;
  font-size: var(--text-xs) !important;
}

/* Mobile TOC toggle */
.toc-toggle {
  display: none;
  position: fixed;
  bottom: var(--space-6);
  left: var(--space-6);
  z-index: 200;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: var(--text-xl);
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  align-items: center;
  justify-content: center;
}

/* Main content */
.study-main {
  flex: 1;
  max-width: 52rem;
  margin: 0 auto;
  padding: var(--space-8) var(--space-8) var(--space-16);
}

/* Page header */
.study-header {
  text-align: center;
  margin-bottom: var(--space-12);
  padding-bottom: var(--space-8);
  border-bottom: 2px solid var(--border-color);
}

.study-header h1 {
  font-size: var(--text-4xl);
  color: var(--navy);
  margin-bottom: var(--space-4);
  line-height: 1.2;
}

[data-theme="dark"] .study-header h1 {
  color: var(--accent);
}

.study-header .subtitle {
  font-size: var(--text-lg);
  color: var(--text-muted);
  margin-bottom: var(--space-6);
}

.exam-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: center;
  margin-top: var(--space-6);
}

.exam-meta-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-5);
  text-align: center;
}

.exam-meta-item .label {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.exam-meta-item .value {
  display: block;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
}

/* Topic sections */
.topic-section {
  margin-bottom: var(--space-12);
}

.topic-header {
  background: var(--navy);
  color: var(--white);
  padding: var(--space-6) var(--space-8);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-8);
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .topic-header {
  background: var(--navy-light);
}

.topic-header h2 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-2);
  color: var(--white);
}

.topic-header .weight-badge {
  display: inline-block;
  background: var(--gold);
  color: var(--navy-dark);
  padding: var(--space-1) var(--space-3);
  border-radius: 9999px;
  font-size: var(--text-sm);
  font-weight: 700;
}

/* Subtopic sections */
.subtopic {
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border-color);
}

.subtopic:last-child {
  border-bottom: none;
}

.subtopic-header {
  margin-bottom: var(--space-4);
}

.subtopic-header h3 {
  font-size: var(--text-xl);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.bloom-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: var(--space-1) var(--space-3);
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Content within subtopics */
.subtopic ul {
  padding-left: var(--space-6);
  margin: var(--space-3) 0;
}

.subtopic li {
  margin-bottom: var(--space-2);
  line-height: 1.6;
  color: var(--text-secondary);
}

.subtopic li strong {
  color: var(--text-primary);
}

.subtopic p {
  margin-bottom: var(--space-3);
  line-height: 1.7;
  color: var(--text-secondary);
}

/* Definition term highlighting */
.def-term {
  font-weight: 700;
  color: var(--accent);
}

[data-theme="dark"] .def-term {
  color: var(--accent-light);
}

/* Callout boxes - extend shared callouts */
.callout {
  margin: var(--space-6) 0;
}

.callout p {
  margin-bottom: var(--space-2);
  color: var(--text-primary);
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout ul {
  padding-left: var(--space-6);
  margin: var(--space-2) 0;
}

.callout li {
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.callout-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Exam checklist */
.exam-checklist {
  background: var(--bg-card);
  border: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  margin-top: var(--space-12);
}

.exam-checklist h2 {
  color: var(--navy);
  margin-bottom: var(--space-6);
  text-align: center;
}

[data-theme="dark"] .exam-checklist h2 {
  color: var(--gold);
}

.exam-checklist ol {
  padding-left: var(--space-6);
  counter-reset: checklist;
}

.exam-checklist li {
  margin-bottom: var(--space-4);
  line-height: 1.6;
  padding-left: var(--space-2);
}

.exam-checklist li strong {
  color: var(--text-primary);
}

/* Intro section */
.intro-section {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  margin-bottom: var(--space-10);
  border: 1px solid var(--border-color);
}

.intro-section h2 {
  color: var(--navy);
  margin-bottom: var(--space-4);
}

[data-theme="dark"] .intro-section h2 {
  color: var(--accent);
}

.intro-section p {
  margin-bottom: var(--space-3);
  line-height: 1.7;
}

.strategy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.strategy-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: center;
}

.strategy-item .number {
  display: block;
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--accent);
}

.strategy-item .label {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Print styles */
@media print {
  .sidebar,
  .toc-toggle,
  .theme-toggle {
    display: none !important;
  }

  .study-layout {
    display: block;
  }

  .study-main {
    max-width: 100%;
    padding: 0;
  }

  .topic-header {
    background: none !important;
    color: #000 !important;
    border: 2px solid #000;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .topic-header h2 {
    color: #000 !important;
  }

  .topic-header .weight-badge {
    border: 1px solid #000;
  }

  .callout {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  .subtopic {
    page-break-inside: avoid;
  }

  .exam-checklist {
    page-break-before: always;
  }

  body {
    font-size: 11pt;
  }
}

/* Responsive */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .toc-toggle {
    display: flex;
  }

  .study-main {
    padding: var(--space-6) var(--space-4) var(--space-16);
  }

  .topic-header {
    padding: var(--space-4) var(--space-6);
  }
}

@media (max-width: 640px) {
  .study-header h1 {
    font-size: var(--text-2xl);
  }

  .exam-meta {
    flex-direction: column;
    align-items: center;
  }

  .exam-meta-item {
    width: 100%;
  }

  .strategy-grid {
    grid-template-columns: 1fr;
  }

  .intro-section,
  .exam-checklist {
    padding: var(--space-4);
  }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

.sidebar-overlay.open {
  display: block;
}
