:root {
  --bg-color: #f5f7fa;
  --text-color: #2c3e50;
  --nav-bg: #1a73e8;
  --nav-item-bg: rgba(255, 255, 255, 0.2);
  --nav-item-hover-bg: rgba(255, 255, 255, 0.3);
  --nav-item-color: white;
  --section-bg: #f8f9fa;
  --highlight-color: #1a73e8;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --table-bg: white;
  --table-border: #e8f0fe;
  --table-header-bg: #e8f0fe;
  --code-bg: #f5f5f5;
  --uml-bg: white;
  --uml-border: #1a73e8;
  --uml-header-bg: #e8f0fe;
  --tree-bg: white;
}
body.dark-mode {
  --bg-color: #121212;
  --text-color: #e0e0e0;
  --nav-bg: #0a0a0a;
  --nav-item-bg: rgba(255, 255, 255, 0.1);
  --nav-item-hover-bg: rgba(255, 255, 255, 0.2);
  --section-bg: #1e1e1e;
  --highlight-color: #42a5f5;
  --shadow-color: rgba(255, 255, 255, 0.1);
  --table-bg: #1e1e1e;
  --table-border: #2e2e2e;
  --table-header-bg: #2e2e2e;
  --code-bg: #2e2e2e;
  --uml-bg: #1e1e1e;
  --uml-border: #42a5f5;
  --uml-header-bg: #2e2e2e;
  --tree-bg: #1e1e1e;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Source Sans Pro', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
}
.container {
  display: flex;
  width: 100%;
  max-width: 1580px;
  margin: 0 auto;
  padding: 0;
  background-color: var(--bg-color);
}
body.nav-hidden .container {
  width: 100%;
}
.nav-menu {
  background-color: var(--nav-bg);
  padding: 20px;
  width: 300px;
  min-width: 300px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 2px 0 10px var(--shadow-color);
  max-height: 100vh;
  overflow-y: auto;
}
body.nav-hidden .nav-menu {
  display: none;
}
.nav-item {
  padding: 12px 16px;
  background-color: var(--nav-item-bg);
  border-radius: 8px;
  font-weight: 600;
  color: var(--nav-item-color);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
}
.nav-item:hover {
  background-color: var(--nav-item-hover-bg);
  transform: translateX(5px);
}
.toggle-mode {
  padding: 12px 16px;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  font-weight: 600;
  color: var(--nav-item-color);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
body.dark-mode .toggle-mode {
  background-color: rgba(255, 255, 255, 0.1);
}
.toggle-mode:hover {
  background-color: rgba(0, 0, 0, 0.4);
  transform: translateX(5px);
}
body.dark-mode .toggle-mode:hover {
  background-color: rgba(255, 255, 255, 0.2);
}
.content {
  flex: 1;
  padding: 40px 55px;
  min-width: 0; /* prevents flex children from overflowing */
}
body.nav-hidden .content {
  padding: 40px;
  width: 100%;
}
.section {
  margin-bottom: 60px;
  background-color: var(--section-bg);
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 4px 12px var(--shadow-color);
}
.section-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--highlight-color);
  margin-bottom: 25px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--table-border);
  display: flex;
  align-items: center;
}
.section-title i { margin-right: 15px; font-size: 24px; }
.subsection { margin-bottom: 30px; }
.subsection:last-child { margin-bottom: 0; }
.subsection-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--highlight-color);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
}
.subsection-title i { margin-right: 10px; font-size: 20px; }
.feature-list { list-style-type: none; }
.feature-list li {
  margin-bottom: 12px;
  font-size: 18px;
  display: flex;
  align-items: flex-start;
}
.feature-list li:before {
  content: "•";
  color: var(--highlight-color);
  font-weight: bold;
  display: inline-block;
  width: 1em;
  margin-right: 8px;
}
.highlight {
  color: var(--highlight-color);
  font-weight: 600;
}
.two-column { display: flex; gap: 30px; }
.column { flex: 1; }
.component-box {
  background-color: var(--bg-color);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 2px 5px var(--shadow-color);
  transition: transform 0.3s ease;
}
.component-box:hover { transform: translateY(-3px); }
.component-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--highlight-color);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
}
.component-title i { margin-right: 8px; }
.component-list { list-style-type: none; margin-left: 10px; }
.component-list li {
  margin-bottom: 8px;
  font-size: 16px;
  position: relative;
  padding-left: 20px;
}
.component-list li:before {
  content: "•";
  color: var(--highlight-color);
  font-weight: bold;
  position: absolute;
  left: 0;
}
.tag {
  display: inline-block;
  padding: 3px 8px;
  background-color: var(--table-border);
  color: var(--highlight-color);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  margin-left: 8px;
}
.app-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.app-card {
  background-color: var(--bg-color);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 5px var(--shadow-color);
  transition: transform 0.3s ease;
}
.app-card:hover { transform: translateY(-3px); }
.app-icon {
  font-size: 36px;
  color: var(--highlight-color);
  margin-bottom: 15px;
}
.app-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--highlight-color);
  margin-bottom: 12px;
}
.app-list { list-style-type: none; }
.app-list li {
  margin-bottom: 8px;
  font-size: 16px;
  position: relative;
  padding-left: 20px;
}
.app-list li:before {
  content: "•";
  color: var(--highlight-color);
  font-weight: bold;
  position: absolute;
  left: 0;
}
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  background-color: var(--table-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 5px var(--shadow-color);
}
.comparison-table th, .comparison-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--table-border);
}
.comparison-table th {
  background-color: var(--table-header-bg);
  color: var(--highlight-color);
  font-weight: 600;
}
.comparison-table tr:last-child td { border-bottom: none; }

/* Code blocks (B2, B3, B4) */
.code-block {
  background-color: var(--code-bg);
  border-left: 4px solid var(--highlight-color);
  padding: 15px;
  margin: 15px 0;
  border-radius: 0 8px 8px 0;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  overflow-x: auto;
}
.code-comment { color: #28a745; font-style: italic; }
.code-keyword { color: #007bff; font-weight: bold; }
.code-string { color: #dc3545; }
.code-number { color: #e67e22; }
.trace-table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
  background-color: var(--table-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 5px var(--shadow-color);
}
.trace-table th, .trace-table td {
  padding: 8px 12px;
  text-align: center;
  border: 1px solid var(--table-border);
}
.trace-table th {
  background-color: var(--table-header-bg);
  color: var(--highlight-color);
  font-weight: 600;
}

/* UML diagrams (B3) */
.diagram {
  background-color: var(--uml-bg);
  border-radius: 8px;
  padding: 20px;
  margin: 15px 0;
  box-shadow: 0 2px 5px var(--shadow-color);
  text-align: center;
  font-family: monospace;
}
.uml-box {
  border: 1px solid var(--uml-border);
  border-radius: 5px;
  margin: 10px auto;
  width: 200px;
}
.uml-class-name {
  background-color: var(--uml-header-bg);
  padding: 5px;
  font-weight: bold;
  color: var(--highlight-color);
}
.uml-attributes, .uml-methods {
  padding: 5px;
  text-align: left;
  border-top: 1px solid var(--table-border);
}

/* Tree diagrams (B4) */
.tree-diagram {
  background-color: var(--tree-bg);
  border-radius: 8px;
  padding: 20px;
  margin: 15px 0;
  text-align: center;
  font-family: 'Courier New', monospace;
  box-shadow: 0 2px 5px var(--shadow-color);
}

/* Floating nav toggle — always visible; acts as ☰/✕ to show/hide nav */
.floating-nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 16px;
  /* Sits inside the 300 px nav column regardless of viewport width:
     left edge of container = max(0, (100vw - 1580px)/2)
     We add 14px so it clears the container edge on very wide screens. */
  left: max(14px, calc((100vw - 1580px) / 2 + 14px));
  background-color: var(--nav-bg);
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--nav-item-color);
  font-size: 14px;
  cursor: pointer;
  z-index: 200;
  box-shadow: 0 2px 5px var(--shadow-color);
}
body.nav-hidden .floating-nav-toggle {
  display: flex;
}
.floating-nav-toggle:hover {
  background-color: rgba(0, 0, 0, 0.4);
}
body.dark-mode .floating-nav-toggle:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* ── HL badge & SL/HL toggle ───────────────────────────────────────────── */

/* Badge rendered inside nav items and section headings */
.hl-badge {
  display: inline-block;
  background: #e74c3c;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 1px;
  margin-left: 7px;
  vertical-align: middle;
  align-self: center;
  flex-shrink: 0;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  font-family: 'Source Sans Pro', sans-serif;
  line-height: 1.6;
}

/* Subtle left-border accent on every HL section card */
.hl-section {
  border-left: 4px solid rgba(231, 76, 60, 0.45) !important;
}

/* Toggle button in the nav sidebar */
.toggle-hl {
  padding: 10px 16px;
  background-color: rgba(231, 76, 60, 0.22);
  border: 1px solid rgba(231, 76, 60, 0.38);
  border-radius: 8px;
  font-weight: 600;
  color: #ff9090;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 13px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
body:not(.dark-mode) .toggle-hl {
  color: #c0392b;
  background-color: rgba(231, 76, 60, 0.1);
  border-color: rgba(231, 76, 60, 0.28);
}
.toggle-hl:hover {
  background-color: rgba(231, 76, 60, 0.38);
  transform: translateX(5px);
}
body:not(.dark-mode) .toggle-hl:hover {
  background-color: rgba(231, 76, 60, 0.2);
}

/* Hide HL sections and their nav items when toggled off */
body.hide-hl .hl-section  { display: none; }
body.hide-hl .hl-nav-item { display: none; }

/* Notice shown on B4 (fully HL page) when HL is hidden */
.hl-all-hidden-notice {
  display: none;
  background: rgba(231, 76, 60, 0.12);
  border: 1px solid rgba(231, 76, 60, 0.35);
  border-radius: 10px;
  padding: 24px 28px;
  margin-bottom: 30px;
  color: var(--text-color);
  font-size: 16px;
  line-height: 1.6;
}
.hl-all-hidden-notice i {
  color: #e74c3c;
  margin-right: 10px;
  font-size: 20px;
}
body.hide-hl .hl-all-hidden-notice { display: block; }

/* ── Command Terms page ──────────────────────────────────────────────────── */

/* AO level badges (used on commandterms.html) */
.ao-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin-left: 8px;
  vertical-align: middle;
  align-self: center;
  flex-shrink: 0;
  font-family: 'Source Sans Pro', sans-serif;
}
.ao-badge.ao1 { background: #2980b9; color: #fff; }
.ao-badge.ao2 { background: #e67e22; color: #fff; }
.ao-badge.ao3 { background: #c0392b; color: #fff; }
.ao-badge.ao4 { background: #8e44ad; color: #fff; }

/* Auto-linked command terms in section headings */
a.command-term-link {
  color: var(--highlight-color);
  text-decoration: underline dotted 1.5px;
  text-underline-offset: 3px;
  font-weight: 700;
  transition: color 0.2s;
}
a.command-term-link:hover {
  text-decoration: underline solid 2px;
}

/* Exam composition bar (50/50 visual split) */
.exam-bar-wrap {
  margin: 10px 0 18px 0;
}
.exam-bar-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 6px;
  opacity: 0.75;
}
.exam-bar {
  display: flex;
  height: 32px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 5px var(--shadow-color);
}
.exam-bar-ao12 {
  flex: 1;
  background: linear-gradient(90deg, #2980b9, #e67e22);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.exam-bar-ao3 {
  flex: 1;
  background: #c0392b;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

/* Non-clickable nav section label */
.nav-label {
  padding: 6px 16px 2px 16px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  cursor: default;
}

/* Definition quote style */
.quote-def {
  font-style: italic;
  color: var(--text-color);
  opacity: 0.85;
  border-left: 3px solid var(--highlight-color);
  padding: 8px 14px;
  margin: 8px 0 12px 0;
  background: var(--bg-color);
  border-radius: 0 6px 6px 0;
  font-size: 17px;
}

/* AO card grid */
.ao-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-top: 10px;
}
.ao-card {
  background: var(--bg-color);
  border-radius: 8px;
  padding: 18px 20px;
  box-shadow: 0 2px 5px var(--shadow-color);
}
.ao-card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ao-card p {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 6px;
}
.ao-card ul {
  list-style: none;
  margin-left: 4px;
}
.ao-card ul li {
  font-size: 15px;
  padding-left: 16px;
  position: relative;
  margin-bottom: 4px;
}
.ao-card ul li:before {
  content: "•";
  color: var(--highlight-color);
  position: absolute;
  left: 0;
}

/* Individual command term entries */
.term-entry {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--table-border);
}
.term-entry:last-child {
  border-bottom: none;
  margin-bottom: 0;
}
.term-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--highlight-color);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.term-tip {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.6;
  background: var(--bg-color);
  border-radius: 6px;
  padding: 10px 14px;
  box-shadow: 0 1px 4px var(--shadow-color);
}
.term-tip strong {
  color: var(--highlight-color);
}
