:root,
[data-theme="light"] {
  --ns-yellow: #ffc917;
  --ns-yellow-hover: #f2b700;
  --ns-blue: #003082;
  --ns-blue-bright: #0063d3;
  --ns-blue-hover: #004ba0;
  --bg-page: #f5f6f8;
  --bg-surface: #ffffff;
  --bg-surface-alt: #f0f2f6;
  --bg-answer: #f8f9fc;
  --bg-tip: #fffbeb;
  --border-subtle: #e2e6ed;
  --border-strong: #c5cddb;
  --text-primary: #003082;
  --text-body: #1c2430;
  --text-muted: #5a6578;
  --text-on-yellow: #003082;
  --text-on-blue: #ffffff;
  --badge-basis-bg: #eef4fc;
  --badge-basis-fg: #004ba0;
  --badge-gevorderd-bg: #fef5d8;
  --badge-gevorderd-fg: #7c5100;
  --badge-calamiteit-bg: #fdecec;
  --badge-calamiteit-fg: #991b1b;
  --success-bg: #ebf7ef;
  --success-fg: #116432;
  --success-border: #9bd6b1;
  --warn-bg: #fff6e6;
  --warn-fg: #8a4b00;
  --warn-border: #efc683;
  --danger-bg: #fdecec;
  --danger-fg: #991b1b;
  --danger-border: #eab3b3;
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 6px 20px rgba(16, 24, 40, 0.08);
  --backdrop-bg: rgba(15, 23, 42, 0.55);
  --focus-ring: 0 0 0 3px rgba(0, 99, 211, 0.3);
}

[data-theme="dark"] {
  --ns-yellow: #ffc917;
  --ns-yellow-hover: #ffd64d;
  --ns-blue: #222228;
  --ns-blue-bright: #e4e4e9;
  --ns-blue-hover: #ffffff;
  --bg-page: #0b0b0d;
  --bg-surface: #151518;
  --bg-surface-alt: #1f1f24;
  --bg-answer: #1b1b20;
  --bg-tip: #211f18;
  --border-subtle: #2a2a31;
  --border-strong: #3d3d47;
  --text-primary: #f4f4f6;
  --text-body: #e2e2e7;
  --text-muted: #9a9aa6;
  --text-on-yellow: #111114;
  --text-on-blue: #111114;
  --badge-basis-bg: #222228;
  --badge-basis-fg: #b8c7d9;
  --badge-gevorderd-bg: #252219;
  --badge-gevorderd-fg: #e8c766;
  --badge-calamiteit-bg: #291c1e;
  --badge-calamiteit-fg: #e5989b;
  --success-bg: #16241c;
  --success-fg: #83d4a2;
  --success-border: #284b36;
  --warn-bg: #262015;
  --warn-fg: #ebc378;
  --warn-border: #4f3e21;
  --danger-bg: #29181a;
  --danger-fg: #eb9a9e;
  --danger-border: #59292e;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.65);
  --backdrop-bg: rgba(0, 0, 0, 0.78);
  --focus-ring: 0 0 0 3px rgba(255, 201, 23, 0.4);
}

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
  background-color: var(--bg-page);
  color: var(--text-body);
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--ns-blue-bright);
}

button,
input,
select,
textarea {
  font: inherit;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Compacte Header */
.site-header {
  background-color: var(--bg-surface);
  border-top: 3px solid var(--ns-yellow);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 58px;
  padding: 8px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  min-width: 0;
}

.brand-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Knoppen — minimaal 44px aanraakhoogte op mobiel */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.94rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease, transform 0.08s ease;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--ns-blue-bright);
  color: var(--text-on-blue);
}

[data-theme="dark"] .btn-primary {
  background-color: #2c2c34;
  color: #f4f4f6;
  border-color: var(--border-strong);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--ns-blue-hover);
}

[data-theme="dark"] .btn-primary:hover:not(:disabled) {
  background-color: #383842;
}

.btn-yellow {
  background-color: var(--ns-yellow);
  color: var(--text-on-yellow);
  border-color: rgba(0, 0, 0, 0.08);
}

.btn-yellow:hover:not(:disabled) {
  background-color: var(--ns-yellow-hover);
}

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

.btn-secondary:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-ghost:hover:not(:disabled) {
  background-color: var(--bg-surface-alt);
}

.btn-sm {
  min-height: 38px;
  padding: 7px 12px;
  font-size: 0.84rem;
  border-radius: 8px;
}

.btn-success {
  background-color: var(--success-bg);
  color: var(--success-fg);
  border-color: var(--success-border);
}

.btn-warn {
  background-color: var(--warn-bg);
  color: var(--warn-fg);
  border-color: var(--warn-border);
}

/* Hoofdinhoud */
main {
  flex: 1;
  padding: 16px 0 44px;
}

.intro-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  padding: 0 2px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.intro-strip-title {
  font-weight: 600;
  color: var(--text-primary);
}

.notice-bar {
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 0.88rem;
  background-color: var(--warn-bg);
  color: var(--warn-fg);
  border: 1px solid var(--warn-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

/* Vraag- en Antwoordkaart */
.generator-card {
  padding: 18px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-md);
}

.controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 18px;
}

.scope-pill-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.scope-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 600;
  max-width: 100%;
}

.scope-label-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background-color: var(--bg-surface-alt);
  color: var(--text-body);
  font-size: 1rem;
}

.select-compact {
  min-height: 38px;
  padding: 6px 10px;
  width: auto;
  font-size: 0.88rem;
}

.question-stage {
  min-height: 150px;
}

.question-empty {
  text-align: center;
  padding: 26px 16px;
  background-color: var(--bg-surface-alt);
  border-radius: 12px;
  border: 1px dashed var(--border-strong);
}

.question-empty p {
  margin: 0 0 12px;
}

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

.question-topline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.question-ref-line {
  font-weight: 600;
  color: var(--text-muted);
}

.question-status-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}

.badge-basis {
  background-color: var(--badge-basis-bg);
  color: var(--badge-basis-fg);
}

.badge-gevorderd {
  background-color: var(--badge-gevorderd-bg);
  color: var(--badge-gevorderd-fg);
}

.badge-calamiteit {
  background-color: var(--badge-calamiteit-bg);
  color: var(--badge-calamiteit-fg);
}

.remaining-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.question-title {
  font-size: clamp(1.12rem, 2.3vw, 1.38rem);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 18px;
  line-height: 1.45;
}

.question-primary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.question-primary-actions .btn {
  flex: 1 1 150px;
}

#btn-toggle-answer {
  flex: 1.4 1 180px;
}

/* Modelantwoord opmaak */
.answer-panel {
  margin-top: 18px;
  padding: 18px;
  border-radius: 12px;
  background-color: var(--bg-answer);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--ns-yellow);
}

.answer-heading {
  margin: 0 0 12px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.answer-content {
  font-size: 0.98rem;
  line-height: 1.62;
  color: var(--text-body);
}

.answer-paragraph {
  margin: 0 0 10px;
}

.answer-paragraph:last-child {
  margin-bottom: 0;
}

.answer-list,
.answer-steps {
  margin: 0 0 10px;
  padding-left: 20px;
}

.answer-list:last-child,
.answer-steps:last-child {
  margin-bottom: 0;
}

.answer-list li,
.answer-steps li {
  margin-bottom: 6px;
}

.answer-list li:last-child,
.answer-steps li:last-child {
  margin-bottom: 0;
}

.mentor-tip {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background-color: var(--bg-tip);
  border: 1px solid var(--border-subtle);
  font-size: 0.9rem;
  color: var(--text-body);
}

.mentor-tip strong {
  color: var(--ns-yellow-hover);
}

[data-theme="light"] .mentor-tip strong {
  color: var(--text-primary);
}

.answer-assess-row {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.answer-assess-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.answer-assess-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.shortcut-hint {
  margin: 14px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Compacte Hoofdstukkenlijst */
.chapters-section {
  position: relative;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title {
  margin: 0;
  font-size: 1.18rem;
  color: var(--text-primary);
}

.search-row {
  margin-bottom: 12px;
}

.chapter-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 780px) {
  .chapter-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

.chapter-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  color: var(--text-body);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.chapter-row:hover {
  border-color: var(--border-strong);
  background-color: var(--bg-surface-alt);
}

.chapter-row.is-selected {
  border-color: var(--ns-blue-bright);
  background-color: var(--bg-surface-alt);
}

[data-theme="dark"] .chapter-row.is-selected {
  border-color: var(--ns-yellow);
}

.chapter-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.84rem;
  font-weight: 700;
  background-color: var(--bg-surface-alt);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.chapter-row.is-selected .chapter-num {
  background-color: var(--ns-yellow);
  color: var(--text-on-yellow);
  border-color: transparent;
}

.chapter-main {
  flex: 1 1 auto;
  min-width: 0;
}

.chapter-name {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.chapter-right {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.chapter-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background-color: var(--bg-surface-alt);
  padding: 2px 8px;
  border-radius: 999px;
}

.chapter-indicator {
  font-size: 1.05rem;
  color: var(--text-muted);
  font-weight: 700;
  width: 20px;
  text-align: center;
}

.chapter-row.is-selected .chapter-indicator {
  color: var(--ns-yellow);
}

[data-theme="light"] .chapter-row.is-selected .chapter-indicator {
  color: var(--ns-blue-bright);
}

/* Sticky multi-select balk */
.selection-bar {
  position: sticky;
  bottom: 12px;
  z-index: 35;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background-color: var(--bg-surface);
  border: 2px solid var(--ns-yellow);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.selection-bar-info {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.selection-bar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Footer */
.site-footer {
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 16px 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.footer-link-btn {
  background: none;
  border: none;
  padding: 4px 0;
  color: var(--text-muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.84rem;
}

.footer-link-btn:hover {
  color: var(--text-primary);
}

.footer-admin-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  opacity: 0.72;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.footer-admin-link:hover {
  opacity: 1;
  color: var(--text-primary);
}

/* Cookie Banner */
.cookie-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 90;
  max-width: 880px;
  margin: 0 auto;
  padding: 16px 18px;
  border-radius: 12px;
  background-color: var(--bg-surface);
  border: 2px solid var(--ns-blue);
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .cookie-banner {
  border-color: var(--ns-yellow);
}

.cookie-banner-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.cookie-banner-copy {
  flex: 1 1 320px;
}

.cookie-banner-title {
  margin: 0 0 4px;
  font-size: 0.98rem;
  color: var(--text-primary);
}

.cookie-banner-text {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.cookie-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background-color: var(--backdrop-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-dialog {
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 20px;
}

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

.modal-title {
  margin: 0;
  font-size: 1.15rem;
  color: var(--text-primary);
}

.modal-body {
  font-size: 0.94rem;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.cookie-option {
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface-alt);
  margin-bottom: 12px;
}

.cookie-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.cookie-option-desc {
  margin: 6px 0 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.category-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--ns-yellow);
  cursor: pointer;
}

.session-list {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.session-item {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface-alt);
  font-size: 0.9rem;
}

/* Login pagina */
.login-page-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 16px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  padding: 24px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.alert-box {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
}

.alert-error {
  background-color: var(--danger-bg);
  color: var(--danger-fg);
  border: 1px solid var(--danger-border);
}

.alert-success {
  background-color: var(--success-bg);
  color: var(--success-fg);
  border: 1px solid var(--success-border);
}

.alert-warn {
  background-color: var(--warn-bg);
  color: var(--warn-fg);
  border: 1px solid var(--warn-border);
}

.category-desc {
  margin: 6px 0 12px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Mobiele optimalisaties */
@media (hover: none), (max-width: 768px) {
  .shortcut-hint {
    display: none;
  }
}

@media (max-width: 560px) {
  .brand-subtitle {
    display: none;
  }
  .generator-card {
    padding: 14px;
  }
  .answer-panel {
    padding: 14px;
  }
  .controls-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-controls {
    width: 100%;
  }
  .select-compact {
    width: 100%;
  }
  #btn-toggle-answer {
    order: -1;
    flex: 1 1 100%;
  }
  #btn-prev-question,
  #btn-next-question {
    flex: 1 1 0;
  }
  .answer-assess-row {
    flex-direction: column;
    align-items: stretch;
  }
  .answer-assess-buttons .btn {
    flex: 1 1 0;
  }
  .cookie-banner-actions {
    width: 100%;
  }
  .cookie-banner-actions .btn {
    flex: 1 1 auto;
  }
}
