:root,
html[data-theme="light"] {
  --bg: #f4f4f7;
  --surface: #ffffff;
  --surface2: #eef0f4;
  --border: #d8dbe3;
  --text: #1a1a22;
  --muted: #5c5c6e;
  --accent: #6a4ae8;
  --accent-hover: #5a3ad4;
  --success: #16a34a;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 8px 28px rgba(20, 20, 40, .12);
}

html[data-theme="dark"] {
  --bg: #0f0f12;
  --surface: #1a1a22;
  --surface2: #242430;
  --border: #2e2e3a;
  --text: #e8e8ed;
  --muted: #9a9aab;
  --accent: #7c5cfc;
  --accent-hover: #6a4ae8;
  --success: #22c55e;
  --danger: #ef4444;
  --shadow: 0 8px 32px rgba(0,0,0,.4);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.container-full {
  max-width: none;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px 40px;
}
.container-full .player-layout {
  grid-template-columns: minmax(240px, 300px) 1fr;
  gap: 28px;
  min-height: calc(100vh - 180px);
}
.container-full .content-area {
  min-height: 60vh;
}
.container-full .video-wrap video {
  max-height: min(75vh, 900px);
}
@media (max-width: 800px) {
  .container-full {
    padding: 0 12px 32px;
  }
  .container-full .player-layout {
    grid-template-columns: 1fr;
  }
}

/* Header */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 95;
  backdrop-filter: blur(12px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo span { color: var(--accent); }

.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a { color: var(--muted); font-size: .95rem; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: .9rem;
  border: none;
  cursor: pointer;
  transition: all .15s ease;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-success { background: var(--success); color: #fff; }
.btn-block { width: 100%; justify-content: center; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.card-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 2.5rem;
}

.card-body { padding: 20px; }
.card-title { font-size: 1.15rem; font-weight: 600; margin-bottom: 8px; }
.card-desc { color: var(--muted); font-size: .9rem; margin-bottom: 16px; }
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.price { font-weight: 700; font-size: 1.2rem; color: var(--accent); }

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

/* Forms */
.form-box {
  max-width: 400px;
  margin: 60px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}
.form-box h1 { font-size: 1.5rem; margin-bottom: 8px; }
.form-box p { color: var(--muted); margin-bottom: 24px; font-size: .95rem; }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
}
.form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124,92,252,.2);
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: .9rem;
}
.alert-error { background: rgba(239,68,68,.15); color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }
.alert-success { background: rgba(34,197,94,.15); color: #86efac; border: 1px solid rgba(34,197,94,.3); }

/* Course player */
.player-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  margin-top: 24px;
}
@media (max-width: 800px) {
  .player-layout { grid-template-columns: 1fr; }
}

.sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  height: fit-content;
  position: sticky;
  top: 80px;
}
.sidebar h3 { font-size: .95rem; margin-bottom: 12px; color: var(--muted); }
.lesson-list { list-style: none; }
.lesson-list li a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 4px;
}
.lesson-list li a:hover,
.lesson-list li a.active {
  background: var(--surface2);
  color: var(--text);
  text-decoration: none;
}
.lesson-list li a.active { border-left: 3px solid var(--accent); }

.content-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  min-height: 400px;
}
.content-area h2 { margin-bottom: 20px; font-size: 1.4rem; }
.content-area pre {
  background: var(--bg);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
  font-size: .9rem;
  border: 1px solid var(--border);
}
.content-area p { margin-bottom: 12px; white-space: pre-wrap; }

.video-wrap {
  position: relative;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}
.video-wrap video { width: 100%; display: block; }

.img-wrap {
  text-align: center;
  margin: 20px 0;
}
.img-wrap img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.img-wrap figcaption { color: var(--muted); font-size: .85rem; margin-top: 8px; }

/* Hero */
.hero {
  text-align: center;
  padding: 60px 0 40px;
}
.hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #fff 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 500px; margin: 0 auto 24px; }

/* Badge */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  background: rgba(124,92,252,.2);
  color: #c4b5fd;
}

/* Footer */
footer {
  text-align: center;
  padding: 40px 0 20px;
  color: var(--muted);
  font-size: .85rem;
  border-top: 1px solid var(--border);
  margin-top: 60px;
}

/* Utils */
.mt-4 { margin-top: 24px; }
.mb-4 { margin-bottom: 24px; }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }

/* Progress */
.progress-bar {
  height: 8px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  border-radius: 4px;
  transition: width .3s ease;
}

.lesson-list .check {
  color: var(--success);
  font-weight: 700;
  margin-right: 4px;
}

/* Admin */
.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  margin-top: 24px;
}
@media (max-width: 700px) {
  .admin-layout { grid-template-columns: 1fr; }
}
.admin-nav {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  height: fit-content;
  position: sticky;
  top: 80px;
}
.admin-nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 4px;
}
.admin-nav a:hover, .admin-nav a.active {
  background: var(--surface2);
  color: var(--text);
  text-decoration: none;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.admin-table th, .admin-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.admin-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.admin-table tr:hover td { background: var(--surface2); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

.lesson-editor {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}
.lesson-editor .form-group { margin-bottom: 10px; }
.lesson-editor textarea {
  width: 100%;
  min-height: 100px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
  resize: vertical;
}
.lesson-editor select {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .9rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.stat-card .num {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}
.stat-card .label {
  font-size: .8rem;
  color: var(--muted);
  margin-top: 4px;
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}
.btn-danger:hover {
  background: rgba(239,68,68,.15);
  text-decoration: none;
}


/* Rich text les-inhoud */
.lesson-html {
  line-height: 1.7;
  word-wrap: break-word;
}
.lesson-html p { margin-bottom: 0.85em; }
.lesson-html h1, .lesson-html h2, .lesson-html h3,
.lesson-html h4, .lesson-html h5, .lesson-html h6 {
  margin: 1.1em 0 0.5em;
  line-height: 1.3;
  color: var(--text);
}
.lesson-html ul, .lesson-html ol { margin: 0.6em 0 0.6em 1.4em; }
.lesson-html li { margin-bottom: 0.35em; }
.lesson-html table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  font-size: 0.95rem;
}
.lesson-html th, .lesson-html td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}
.lesson-html th { background: var(--surface2); }
.lesson-html a { color: var(--accent); }
.lesson-html img { max-width: 100%; height: auto; border-radius: 8px; }
.lesson-html blockquote {
  border-left: 3px solid var(--accent);
  margin: 1em 0;
  padding: 0.4em 0 0.4em 1em;
  color: var(--muted);
}
.lesson-html pre, .lesson-html code {
  font-family: ui-monospace, monospace;
  font-size: 0.9em;
}
.lesson-html pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  overflow-x: auto;
}



/* ── Mobile nav ─────────────────────────────────────────── */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  z-index: 100;
}
.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle.is-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle.is-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle.is-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}
.nav-user { font-size: .9rem; }

/* Desktop: toon desktop-nav, verberg mobiel-panel */
.nav-links-mobile { display: none !important; }

@media (max-width: 768px) {
  .nav {
    flex-wrap: nowrap;
    position: relative;
  }

  .nav-toggle {
    display: flex;
    margin-left: auto;
  }

  /* Verberg desktop-links in de header */
  .nav-links-desktop {
    display: none !important;
  }

  /* Panel onder de header zodat hamburger zichtbaar blijft */
  .nav-links-mobile {
    display: none !important;
    position: fixed;
    top: 60px;
    right: 0;
    left: 0;
    bottom: 0;
    z-index: 90;
    margin: 0;
    padding: 0;
    background: #0f0f12;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-links-mobile.is-open {
    display: block !important;
  }

  .nav-mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 1;
  }

  .nav-mobile-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
  }

  .nav-close {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface2);
    color: var(--text);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nav-close:active {
    background: var(--border);
  }

  .nav-mobile-inner {
    padding: 8px 16px 32px;
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: 480px;
    margin: 0 auto;
  }

  .nav-links-mobile a,
  .nav-links-mobile .nav-user {
    display: block;
    padding: 16px 14px;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
  }

  .nav-links-mobile a:hover,
  .nav-links-mobile a:active {
    background: var(--surface2);
    color: var(--accent);
  }

  .nav-links-mobile .btn {
    margin-top: 20px;
    width: 100%;
    justify-content: center;
    text-align: center;
    border-bottom: none;
    padding: 14px 16px;
    font-size: 1rem;
  }

  .nav-links-mobile .badge {
    display: inline-block;
    width: fit-content;
    margin: 12px 14px 0;
  }

  body.nav-open {
    overflow: hidden;
    touch-action: none;
  }

  .hero h1 { font-size: 1.75rem; }
  .hero { padding: 36px 0 24px; }
  .container { padding: 0 16px; }
  .form-box { margin: 32px auto; padding: 24px 18px; }
  .player-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .content-area { padding: 20px; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-nav {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .admin-nav a { margin-bottom: 0; }
  .admin-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .card-footer { flex-wrap: wrap; gap: 10px; }
}


.lesson-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
  flex-wrap: wrap;
}
.lesson-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}


/* Compact cursusoverzicht – minder scrollen */
.hero-compact {
  padding: 20px 0 12px;
  text-align: center;
}
.hero-compact h1 {
  font-size: 1.5rem;
  margin-bottom: 6px;
}
.hero-compact p {
  font-size: 0.95rem;
  margin: 0 auto 8px;
  max-width: 560px;
}

.grid-overview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  align-content: start;
}

.card-overview {
  display: flex;
  flex-direction: column;
}

.card-img-sm {
  height: 120px;
  font-size: 2rem;
}

.card-body-sm {
  padding: 14px 16px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-body-sm .card-title {
  font-size: 1rem;
  margin-bottom: 6px;
}

.card-desc-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
  font-size: 0.85rem;
  line-height: 1.4;
  flex: 1;
}

.card-body-sm .card-footer {
  margin-top: auto;
}

@media (min-width: 1100px) {
  .grid-overview {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

@media (max-width: 600px) {
  .card-img-sm { height: 100px; }
  .hero-compact { padding: 16px 0 8px; }
}



/* Cursus-speler: alles in viewport, bij video GEEN scroll */
html.player-html,
body.player-mode {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  margin: 0;
}

body.player-mode {
  display: flex;
  flex-direction: column;
}

body.player-mode header {
  flex: 0 0 auto;
}

body.player-mode footer {
  display: none !important;
}

body.player-mode main.container-full {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: none;
  height: auto;
  padding: 0 12px 8px;
  overflow: hidden;
  box-sizing: border-box;
}

.player-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 6px;
  overflow: hidden;
}

.player-top {
  flex: 0 0 auto;
  padding-top: 6px;
}
.player-back { font-size: 0.75rem; }
.player-course-title {
  margin: 2px 0 4px;
  font-size: 1.1rem;
  line-height: 1.2;
}
.player-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.player-progress-row .progress-bar {
  flex: 1;
  max-width: 280px;
  height: 6px;
}
.player-progress-label {
  font-size: 0.8rem;
  white-space: nowrap;
}

body.player-mode .player-layout {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

body.player-mode .sidebar {
  position: static !important;
  height: auto;
  max-height: 100%;
  overflow-y: auto;
  padding: 10px 12px;
  margin: 0;
  min-height: 0;
}

body.player-mode .content-area {
  min-height: 0;
  height: auto;
  max-height: 100%;
  overflow: hidden;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
}

/* Alleen niet-video mag intern scrollen (lange tekst) */
body.player-mode .content-area:not(.content-area-video) {
  overflow-y: auto;
}

body.player-mode .lesson-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
  flex: 0 0 auto;
}
body.player-mode .lesson-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

/* Video-stack vult rest, bijlagen + meta blijven zichtbaar */
body.player-mode .content-area-video {
  overflow: hidden !important;
}

body.player-mode .lesson-video-stack {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 4px;
  overflow: hidden;
}

body.player-mode .lesson-video-stack .video-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

body.player-mode .lesson-video-stack .video-wrap video,
body.player-mode .content-area-video .video-wrap video {
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

body.player-mode .video-meta {
  flex: 0 0 auto;
  margin: 0;
  font-size: 0.7rem;
  opacity: 0.75;
  line-height: 1.2;
}

body.player-mode .lesson-files {
  flex: 0 0 auto;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  max-height: 72px;
  overflow: hidden;
}

body.player-mode .lesson-files h3 {
  font-size: 0.8rem;
  margin: 0 0 4px;
}

body.player-mode .lesson-files ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
}

body.player-mode .lesson-files-compact .btn {
  padding: 4px 8px;
  font-size: 0.75rem;
}

body.player-mode .content-area-video .lesson-nav,
body.player-mode .content-area-video > div[style*="margin-top:auto"] {
  flex: 0 0 auto;
  margin-top: 6px !important;
  padding-top: 8px !important;
}

body.player-mode .img-wrap img {
  max-height: min(50vh, 400px);
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  display: block;
  object-fit: contain;
}

@media (max-width: 800px) {
  body.player-mode {
    overflow: auto;
    height: auto;
    max-height: none;
    display: block;
  }
  body.player-mode main.container-full {
    height: auto;
    overflow: visible;
    padding: 0 12px 24px;
  }
  body.player-mode .player-layout {
    grid-template-columns: 1fr;
    overflow: visible;
  }
  body.player-mode .sidebar {
    max-height: 140px;
  }
  body.player-mode .content-area,
  body.player-mode .content-area-video {
    overflow: visible !important;
    max-height: none;
  }
  body.player-mode .lesson-video-stack .video-wrap {
    flex: none;
    height: 40vh;
  }
  body.player-mode .lesson-files {
    max-height: none;
  }
  body.player-mode footer {
    display: block !important;
  }
}


/* Theme toggle icons */
html[data-theme="light"] .theme-icon-dark { display: none; }
html[data-theme="light"] .theme-icon-light { display: inline; }
html[data-theme="dark"] .theme-icon-light { display: none; }
html[data-theme="dark"] .theme-icon-dark { display: inline; }
html:not([data-theme="light"]):not([data-theme="dark"]) .theme-icon-light { display: inline; }
html:not([data-theme="light"]):not([data-theme="dark"]) .theme-icon-dark { display: none; }

html[data-theme="dark"] .nav-links-mobile {
  background: rgba(15, 15, 18, 0.97);
}
html[data-theme="light"] .nav-links-mobile {
  background: #ffffff;
}

.nav-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

@media (min-width: 769px) {
  .nav-tools .nav-toggle { display: none; }
  .nav-tools { margin-left: 0; order: 3; }
  .nav-links-desktop { order: 2; }
  .logo { order: 1; }
  .nav { gap: 12px; }
}

/* ── Course card overlay (groter, volledige tekst) ───────── */
.course-card {
  position: relative;
  overflow: visible;
  z-index: 1;
}
.course-card.is-overlay-open {
  z-index: 40;
}

.course-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: max(100%, 340px);
  min-width: 280px;
  max-width: min(420px, 92vw);
  max-height: min(80vh, 560px);
  z-index: 50;
  background: rgba(18, 18, 26, 0.98);
  backdrop-filter: blur(10px);
  color: #e8e8ed;
  padding: 18px 18px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 16px 48px rgba(0,0,0,.45);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, visibility .18s ease, transform .18s ease;
}

html[data-theme="light"] .course-overlay {
  background: rgba(255, 255, 255, 0.98);
  color: #1a1a22;
  box-shadow: 0 16px 48px rgba(20,20,40,.18);
}

.course-card.is-overlay-open .course-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.course-overlay-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(0,0,0,.35);
  color: inherit;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  z-index: 2;
}

html[data-theme="light"] .course-overlay-close {
  border-color: var(--border);
  background: var(--surface2);
}

.course-overlay-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-top: 2px;
  overflow: hidden;
}

.course-overlay-thumb {
  height: 120px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.course-overlay-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.course-overlay-inner h3 {
  font-size: 1.15rem;
  margin: 0 0 10px;
  line-height: 1.3;
  padding-right: 32px;
}

.course-overlay-desc {
  font-size: 0.92rem;
  line-height: 1.55;
  opacity: 0.95;
  margin: 0 0 14px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 4.5em;
  max-height: min(42vh, 280px);
  padding-right: 4px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.course-overlay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  flex-shrink: 0;
  padding-top: 4px;
}

.course-overlay-actions .btn {
  flex: 1 1 auto;
  justify-content: center;
  text-align: center;
}

@media (max-width: 480px) {
  .course-overlay {
    width: min(94vw, 360px);
    max-height: 85vh;
  }
  .course-overlay-thumb { height: 100px; }
}
