/* ═══════════════════════════════════════════════════════════
   CrossRef MD — Global Stylesheet
   Theme: dark academic · SGU Medical Reference
   ═══════════════════════════════════════════════════════════ */

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

/* ── Root Variables ─────────────────────────────────────── */
:root {
  --bg-base:        #0f1117;
  --bg-surface:     #13161f;
  --bg-card:        #151821;
  --bg-elevated:    #1a1f2e;
  --border:         #1e2535;
  --border-subtle:  #1a1f2e;
  --text-primary:   #e8eaf0;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --accent-blue:    #2563eb;
  --accent-teal:    #0d9488;
  --accent-green:   #16a34a;
  --accent-purple:  #7c3aed;
  --accent-amber:   #d97706;
  --accent-red:     #dc2626;
  --nav-height:     56px;
  --font-sans:      'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Base ───────────────────────────────────────────────── */
html { scroll-behavior: smooth; }
body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  padding-top: var(--nav-height);
  min-width: 320px;
}

a { color: #60a5fa; text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 700; }
em { font-style: italic; }
sup { font-size: 0.7em; }

/* ══════════════════════════════════════════════════════════
   GLOBAL NAVBAR
   ══════════════════════════════════════════════════════════ */
#crossref-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: #0b0d14;
  border-bottom: 1px solid #1e2535;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 0;
  z-index: 1000;
  user-select: none;
}

/* Site branding */
.nav-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 12px;
}
.nav-brand-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.01em;
  line-height: 1.1;
}
.nav-brand-tagline {
  font-size: 0.62rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
}
.nav-brand:hover .nav-brand-name { color: #93c5fd; }

/* Divider */
.nav-divider {
  width: 1px;
  height: 28px;
  background: #2a3347;
  margin: 0 12px;
  flex-shrink: 0;
}

/* Nav links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.nav-link {
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  text-decoration: none;
  background: none;
  border: none;
  font-family: inherit;
  position: relative;
}
.nav-link:hover { background: #1a1f2e; color: #fff; text-decoration: none; }
.nav-link.active { color: #60a5fa; }

/* Dropdown menus */
.nav-dropdown { position: relative; }
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #0e1120;
  border: 1px solid #2a3347;
  border-radius: 8px;
  min-width: 260px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 200;
  overflow: hidden;
}
.nav-dropdown-menu.right { left: auto; right: 0; }
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu { display: block; }
.nav-dropdown-header {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 14px 6px;
}
.nav-dropdown-item {
  display: block;
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  text-decoration: none;
  white-space: nowrap;
}
.nav-dropdown-item:hover { background: #1a2035; color: #fff; text-decoration: none; }
.nav-dropdown-item .item-num {
  display: inline-block;
  width: 22px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: monospace;
}
.nav-dropdown-separator { height: 1px; background: #1e2535; margin: 4px 0; }

/* Search bar */
.nav-search {
  margin-left: auto;
  position: relative;
  flex-shrink: 0;
}
.nav-search-input {
  background: #1a1f2e;
  border: 1px solid #2a3347;
  border-radius: 6px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  padding: 6px 12px 6px 32px;
  width: 220px;
  transition: border-color 0.15s, width 0.2s;
  outline: none;
}
.nav-search-input:focus { border-color: var(--accent-blue); width: 280px; }
.nav-search-input::placeholder { color: var(--text-muted); }
.nav-search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 13px;
}

/* Search results dropdown */
#search-results {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 380px;
  background: #0e1120;
  border: 1px solid #2a3347;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  z-index: 300;
  max-height: 420px;
  overflow-y: auto;
}
#search-results.active { display: block; }
.search-result-item {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid #1e2535;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.1s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: #1a2035; text-decoration: none; }
.search-result-title { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.search-result-meta { font-size: 0.74rem; color: var(--text-muted); margin-top: 2px; }
.search-result-snippet { font-size: 0.78rem; color: var(--text-secondary); margin-top: 4px; line-height: 1.4; }
.search-result-snippet mark { background: #1e3a6e; color: #93c5fd; border-radius: 2px; padding: 0 2px; }
.search-no-results { padding: 16px; text-align: center; font-size: 0.82rem; color: var(--text-muted); }

/* Hamburger (mobile) */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
}

/* ══════════════════════════════════════════════════════════
   PAGE HEADER (standardized across all lecture/DLA pages)
   ══════════════════════════════════════════════════════════ */
.page-header {
  background: linear-gradient(135deg, #1a1f2e 0%, #0f1117 100%);
  border-bottom: 2px solid #2a3040;
  padding: 32px 40px 24px;
  text-align: center;
}
.page-header .course-tag {
  display: inline-block;
  background: #1e2a3a;
  color: #60a5fa;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 4px;
  margin-bottom: 12px;
}
.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #f0f4ff;
  margin-bottom: 8px;
  line-height: 1.2;
}
.page-header .subtitle {
  color: #8892a4;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
}

/* ══════════════════════════════════════════════════════════
   LEGEND
   ══════════════════════════════════════════════════════════ */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  justify-content: center;
  padding: 14px 40px;
  background: #13151f;
  border-bottom: 1px solid #1e2130;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  color: #aab0c4;
}
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════
   CONTAINER & SECTIONS
   ══════════════════════════════════════════════════════════ */
.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 24px 60px;
}
section { margin-top: 36px; }

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  border-radius: 8px 8px 0 0;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}
.section-header .obj-badge {
  background: rgba(0,0,0,0.25);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
/* Header color themes */
.section-header.blue   { background: #1e3a8a; }
.section-header.teal   { background: #0f766e; }
.section-header.green  { background: #15803d; }
.section-header.purple { background: #6d28d9; }
.section-header.amber  { background: #b45309; }
.section-header.red    { background: #991b1b; }
.section-header.gray   { background: #374151; }
.section-header.orange { background: #9a3412; }

/* Also support section-card style (newer pages) */
.section-card {
  background: var(--bg-surface);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 22px;
  border: 1px solid var(--border);
}
.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 16px;
}
.chip-blue   { background: #1d4ed8; color: #dbeafe; }
.chip-teal   { background: #0f766e; color: #ccfbf1; }
.chip-green  { background: #15803d; color: #dcfce7; }
.chip-purple { background: #6d28d9; color: #ede9fe; }
.chip-amber  { background: #b45309; color: #fef3c7; }
.chip-gray   { background: #374151; color: #f3f4f6; }
.chip-red    { background: #991b1b; color: #fee2e2; }
.chip-rose   { background: #9f1239; color: #ffe4e6; }
.chip-orange { background: #9a3412; color: #ffedd5; }

/* Card body */
.section-body, .card-body {
  background: var(--bg-card);
  border-radius: 0 0 8px 8px;
  border: 1px solid var(--border);
  border-top: none;
  padding: 20px 24px;
}

/* ══════════════════════════════════════════════════════════
   BOXES & CARDS
   ══════════════════════════════════════════════════════════ */
.box {
  border-radius: 8px;
  padding: 10px 13px;
  font-size: 0.8rem;
  line-height: 1.5;
  border: 1px solid transparent;
  margin-bottom: 12px;
}
.box:last-child { margin-bottom: 0; }
.box-title { font-weight: 700; font-size: 0.82rem; margin-bottom: 5px; }
.box ul { padding-left: 16px; }
.box ul li { margin-bottom: 3px; }
.box h3 { font-size: 0.9rem; font-weight: 700; margin-bottom: 8px; color: #fff; }
.box p { margin-bottom: 6px; }
.box p:last-child { margin-bottom: 0; }

.blue   { background: #0e2240; border-color: #2563eb; }
.green  { background: #0a2818; border-color: #16a34a; }
.purple { background: #1a1040; border-color: #7c3aed; }
.amber  { background: #241800; border-color: #d97706; }
.red    { background: #270d0d; border-color: #dc2626; }
.teal   { background: #07201e; border-color: #0d9488; }
.gray   { background: #161b25; border-color: #475569; }
.navy   { background: #0d1a35; border-color: #3b82f6; }
.orange { background: #231208; border-color: #ea580c; }
.rose   { background: #2a0d1a; border-color: #e11d48; }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 0.67rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 3px;
}
.badge-blue   { background: #1d4ed8; color: #fff; }
.badge-teal   { background: #0f766e; color: #fff; }
.badge-green  { background: #15803d; color: #fff; }
.badge-purple { background: #6d28d9; color: #fff; }
.badge-amber  { background: #b45309; color: #fff; }
.badge-gray   { background: #374151; color: #fff; }
.badge-red    { background: #b91c1c; color: #fff; }
.badge-orange { background: #9a3412; color: #fff; }

/* ── Tags (older pages) ─────────────────────────────────── */
.tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
}
.tag-b { background: #1e3a8a; color: #93c5fd; }
.tag-s { background: #164e63; color: #67e8f9; }
.tag-r { background: #7f1d1d; color: #fca5a5; }
.tag-p { background: #4c1d95; color: #c4b5fd; }
.tag-y { background: #78350f; color: #fcd34d; }
.tag-t { background: #134e4a; color: #99f6e4; }
.tag-g { background: #14532d; color: #86efac; }
.tag-o { background: #7c2d12; color: #fdba74; }

/* ── Layout grids ───────────────────────────────────────── */
.two-col   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.four-col  { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 10px; }
.split-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.split-row .box { margin-bottom: 0; }
.split-row:last-child { margin-bottom: 0; }

/* ── Tables ─────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
th { background: #1a1f2e; color: #94a3b8; font-weight: 700; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.08em; padding: 8px 12px; text-align: left; border-bottom: 1px solid #2a3347; }
td { padding: 8px 12px; border-bottom: 1px solid #1a1f2e; vertical-align: top; line-height: 1.45; }
tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: #12151d; }
.td-green  { color: #4ade80; font-weight: 600; }
.td-red    { color: #f87171; font-weight: 600; }
.td-blue   { color: #60a5fa; font-weight: 600; }
.td-purple { color: #c4b5fd; font-weight: 600; }
.td-amber  { color: #fbbf24; font-weight: 600; }
.td-gray   { color: #94a3b8; }

/* ── Utility notes ──────────────────────────────────────── */
.principle-box { background: #0d1a35; border-left: 4px solid #3b82f6; border-radius: 0 7px 7px 0; padding: 10px 14px; font-size: 0.82rem; line-height: 1.55; margin-top: 10px; }
.clinical-note { background: #1a1040; border-left: 4px solid #7c3aed; border-radius: 0 7px 7px 0; padding: 10px 14px; font-size: 0.8rem; line-height: 1.5; margin-top: 10px; }
.warn-note     { background: #270d0d; border-left: 4px solid #dc2626; border-radius: 0 7px 7px 0; padding: 10px 14px; font-size: 0.8rem; line-height: 1.5; margin-top: 10px; }
.key-note      { background: #07201e; border-left: 4px solid #0d9488; border-radius: 0 7px 7px 0; padding: 10px 14px; font-size: 0.8rem; line-height: 1.5; margin-top: 10px; }
.warn { background: rgba(234,88,12,0.1); border-left: 3px solid #ea580c; border-radius: 0 5px 5px 0; padding: 10px 14px; font-size: 0.82rem; color: #fdba74; margin-top: 10px; }

/* Divider */
.divider { border: none; border-top: 1px solid #1e2a3a; margin: 16px 0; }
.arrow { text-align: center; font-size: 1.3rem; color: #64748b; line-height: 1; margin: 4px 0; }

/* Graph label */
.graph-label { font-size: 0.78rem; color: #64748b; text-align: center; font-style: italic; margin-top: 6px; }

/* ══════════════════════════════════════════════════════════
   MCQ — INTERACTIVE QUESTIONS (standardized)
   ══════════════════════════════════════════════════════════ */
.mcq-section { margin-top: 36px; }
.mcq-box {
  background: #161b25;
  border: 1px solid #2a3347;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.mcq-q {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 10px;
  color: #e2e8f0;
  line-height: 1.45;
}
.mcq-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}
.mcq-opt {
  background: #1a1f2e;
  border: 1px solid #242b3a;
  border-radius: 5px;
  padding: 7px 10px;
  font-size: 0.8rem;
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  user-select: none;
  line-height: 1.4;
}
.mcq-opt:hover:not(.disabled) { background: #263045; border-color: #60a5fa; color: #e2e8f0; }
.mcq-opt.selected-wrong   { background: #2d0808; border-color: #ef4444; color: #fca5a5; }
.mcq-opt.selected-correct { background: #0a2818; border-color: #22c55e; color: #4ade80; }
.mcq-opt.disabled { cursor: default; }
.mcq-feedback {
  display: none;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.84rem;
  line-height: 1.5;
}
.mcq-feedback.wrong   { display: block; background: #1a0808; border-left: 3px solid #ef4444; color: #fca5a5; }
.mcq-feedback.correct { display: block; background: #071a10; border-left: 3px solid #22c55e; color: #86efac; }
.mcq-tries { font-size: 0.74rem; color: #64748b; margin-top: 6px; }

/* SVG container */
.svg-container { width: 100%; overflow-x: auto; margin: 8px 0; }

/* ══════════════════════════════════════════════════════════
   HOMEPAGE
   ══════════════════════════════════════════════════════════ */
.home-hero {
  text-align: center;
  padding: 60px 40px 40px;
  background: linear-gradient(135deg, #0d1021 0%, #0f1117 100%);
  border-bottom: 1px solid #1e2535;
}
.home-hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.home-hero .tagline {
  font-size: 1rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 24px;
}
.home-hero .institution {
  display: inline-block;
  background: #1e2a3a;
  color: #60a5fa;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 20px;
}

/* Term cards */
.home-terms { max-width: 1060px; margin: 40px auto; padding: 0 24px; }
.term-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 24px;
  overflow: hidden;
}
.term-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  background: #1a1f2e;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border);
}
.term-header h2 { font-size: 1.1rem; font-weight: 700; color: #fff; }
.term-chevron { color: var(--text-muted); font-size: 12px; transition: transform 0.2s; }
.term-card.open .term-chevron { transform: rotate(180deg); }
.term-body { display: none; padding: 20px 22px; }
.term-card.open .term-body { display: block; }

/* Module cards */
.module-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 16px;
  overflow: hidden;
}
.module-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: #151821;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid transparent;
}
.module-card.open .module-header { border-bottom-color: var(--border); }
.module-color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.module-header h3 { font-size: 0.92rem; font-weight: 700; color: #fff; flex: 1; }
.module-chevron { color: var(--text-muted); font-size: 11px; transition: transform 0.2s; }
.module-card.open .module-chevron { transform: rotate(180deg); }
.module-body { display: none; }
.module-card.open .module-body { display: block; }

/* Section tabs */
.section-tabs {
  display: flex;
  border-bottom: 1px solid #1e3a5f;
  background: #0d1526;
  overflow-x: auto;
  gap: 2px;
  padding: 6px 8px 0;
}
.section-tab {
  padding: 8px 16px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #93c5fd;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 6px 6px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  background: #111827;
  transition: background 0.15s, color 0.15s;
  letter-spacing: .02em;
}
.section-tab:hover { background: #1e2d45; color: #e2e8f0; }
.section-tab.active { background: #1e3a5f; color: #fff; border-color: #2a4f7a; }
.section-panel { display: none; padding: 16px 18px; }
.section-panel.active { display: block; }

/* Item list */
.item-list { display: flex; flex-direction: column; gap: 6px; }

/* Resource download links */
.resource-link {
  justify-content: flex-start !important;
  gap: 10px;
}
.resource-icon { font-size: 1rem; flex-shrink: 0; }
.resource-dl {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: #60a5fa;
  background: #1e3a5f;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.item-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: #1a1f2e;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.1s, border-color 0.1s;
}
.item-link:hover { background: #1e2640; border-color: #3b82f6; text-decoration: none; }
.item-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  font-family: monospace;
  min-width: 24px;
}
.item-title { font-size: 0.85rem; color: var(--text-primary); flex: 1; }
.item-arrow { font-size: 0.8rem; color: var(--text-muted); }
.empty-section { color: var(--text-muted); font-size: 0.82rem; font-style: italic; padding: 8px 0; }

/* ══════════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════════ */
footer {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 18px 0 10px;
  border-top: 1px solid #1a1f2e;
  margin-top: 40px;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .two-col, .split-row { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: 1fr 1fr; }
  .four-col { grid-template-columns: 1fr 1fr; }
  .mcq-options { grid-template-columns: 1fr; }
  .page-header { padding: 24px 20px 18px; }
  .page-header h1 { font-size: 1.4rem; }
  .container { padding: 0 16px 40px; }
  .nav-links { display: none; }
  .nav-hamburger { display: block; }
  .nav-search-input { width: 160px; }
  .nav-search-input:focus { width: 200px; }
}

@media (max-width: 480px) {
  .three-col, .four-col { grid-template-columns: 1fr; }
}
