:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #fbfcfe;
  --border: #d9e0ec;
  --text: #233a63;
  --muted: #5f7392;
  --primary: #334ea2;
  --primary-soft: #e8edfb;
  --accent: #e25830;
  --gold: #f4b536;
  --success-bg: #e8f8ee;
  --success-fg: #166534;
  --shadow: 0 12px 40px rgba(35, 58, 99, 0.10);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #f7f8fb 0%, #fefefe 100%);
  color: var(--text);
}

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  text-decoration: none;
}

/* =========================================================
   ALGEMENE LAYOUT
========================================================= */

.app-shell {
  width: 100%;
  height: 100vh;
  padding: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

/* =========================================================
   BUTTONS / TABS / BADGES
========================================================= */

.btn,
.tab-btn,
.badge,
.icon-btn {
  border-radius: 14px;
  font-weight: 800;
}

.btn {
  min-height: 44px;
  padding: 10px 16px;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-soft {
  background: var(--primary-soft);
  color: var(--primary);
}

.btn-muted {
  background: #eef1f5;
  color: #304357;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  background: #eef1f5;
  font-size: .92rem;
}

.tab-btn {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  background: #eef1f5;
  color: #304357;
}

.tab-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  background: #eef1f5;
  color: var(--primary);
  flex: 0 0 auto;
}

/* =========================================================
   STARTSCHERM
========================================================= */

.start-layout {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 16px;
  height: calc(100vh - 32px);
  min-height: 0;
}

.start-hero {
  padding: 28px;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 20px;
  align-items: center;
}

.start-hero-copy h1 {
  margin: 0 0 14px;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.05;
}

.start-hero-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  max-width: 65ch;
}

.start-hero-panel {
  border: 1px solid rgba(51, 78, 162, .14);
  border-radius: 22px;
  padding: 22px;
  background: linear-gradient(135deg, rgba(244, 181, 54, .18) 0%, rgba(255, 255, 255, 1) 58%, rgba(51, 78, 162, .08) 100%);
}

.start-hero-panel h2 {
  margin: 0 0 10px;
}

.start-hero-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.class-tabs-card {
  padding: 16px 20px;
}

.class-tabs-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chapter-grid-card {
  padding: 20px;
  overflow: auto;
}

.chapter-grid-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.chapter-grid-header h2 {
  margin: 0 0 8px;
}

.chapter-grid-header p {
  margin: 0;
  color: var(--muted);
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.chapter-card {
  border-radius: 22px;
  border: 1px solid rgba(51, 78, 162, .14);
  background: linear-gradient(135deg, rgba(244, 181, 54, .16) 0%, rgba(255, 255, 255, 1) 58%, rgba(51, 78, 162, .08) 100%);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chapter-card h3 {
  margin: 0;
  font-size: 1.4rem;
}

.chapter-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.chapter-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
}

/* =========================================================
   LESDASHBOARD
========================================================= */

.layout-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  height: calc(100vh - 32px);
  min-height: 0;
  transition: grid-template-columns .25s ease;
}

.layout-grid.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.sidebar,
.main-panel {
  height: 100%;
  min-height: 0;
}

.sidebar {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
}

.layout-grid.sidebar-collapsed .sidebar {
  padding: 0;
  border: none;
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
}

.sidebar-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sidebar h1,
.main-panel h2,
.slide-card h3,
.launch-card h3 {
  margin: 0;
}

.sidebar-head p,
.panel-top p,
.slide-card p,
.launch-card p {
  color: var(--muted);
  line-height: 1.55;
  margin: 8px 0 0;
}

.sidebar-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.goals-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  min-height: 0;
  padding-right: 4px;
}

.goal-item {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-soft);
  padding: 16px;
  text-align: left;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.goal-item:hover {
  transform: translateY(-1px);
}

.goal-item-title {
  display: block;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--text);
}

.goal-item-desc {
  display: block;
  color: var(--muted);
  line-height: 1.5;
  font-size: .95rem;
}

.goal-item.done {
  border: 2px solid #22c55e;
  background: linear-gradient(135deg, rgba(232, 248, 238, 1) 0%, rgba(255, 255, 255, 1) 100%);
  box-shadow: 0 14px 30px rgba(34, 197, 94, .12);
}

.goal-item.done .goal-item-title {
  color: var(--success-fg);
}

.main-panel {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.panel-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.panel-actions,
.tab-row,
.slide-nav,
.launch-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tab-panel {
  display: none;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.tab-panel.active {
  display: flex;
}

/* =========================================================
   SLIDES BASIS
========================================================= */

.slides-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  min-height: 0;
}

.slides-meta {
  display: flex;
  justify-content: flex-start;
}

.slide-card,
.launch-card {
  border-radius: 24px;
  border: 1px solid rgba(51, 78, 162, .14);
  background: linear-gradient(135deg, rgba(244, 181, 54, .18) 0%, rgba(255, 255, 255, 1) 58%, rgba(51, 78, 162, .08) 100%);
  min-height: 0;
  padding: clamp(20px, 3vw, 38px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
}

.slide-kicker {
  flex: 0 0 auto;
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .84rem;
  margin-bottom: 10px;
}

.slide-card h3,
.launch-card h3 {
  flex: 0 0 auto;
  font-size: clamp(1.8rem, 3.4vw, 3.2rem);
  line-height: 1.06;
  margin-bottom: 14px;
}

.slide-card p,
.launch-card p {
  flex: 0 0 auto;
  font-size: clamp(1rem, 1.3vw, 1.14rem);
  max-width: 60ch;
}

.slide-text:empty,
.slide-points:empty,
.slide-extra:empty,
.slide-kicker:empty,
.slide-card h3:empty {
  display: none;
}

/* =========================================================
   POINTS — GEEN SCROLLBAR OP LESDOELEN
========================================================= */

.slide-points {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: visible;
  display: grid;
  gap: 12px;
  align-content: start;
  margin-top: 18px;
}

.slide-point {
  background: rgba(255, 255, 255, .88);
  border: 1px solid rgba(51, 78, 162, .12);
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--text);
  font-weight: 700;
}

/* Als er ook blocks/afbeeldingen zijn, nemen points enkel hun natuurlijke hoogte */
.slide-card:has(.slide-extra:not(:empty)) .slide-points {
  flex: 0 0 auto;
  overflow: visible;
}

/* =========================================================
   EXTRA CONTENT / BLOKKEN
========================================================= */

.slide-extra {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
  overflow: hidden;
}

.slide-section {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, .88);
  border: 1px solid rgba(51, 78, 162, .12);
  border-radius: 16px;
  padding: 14px 16px;
}

.slide-section-title {
  margin: 0 0 10px;
  color: var(--text);
  font-weight: 800;
}

.slide-section-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  white-space: pre-line;
}

.slide-list {
  margin: 0;
  padding-left: 20px;
  color: var(--text);
}

.slide-list li + li {
  margin-top: 8px;
}

.slide-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.slide-highlight {
  flex: 0 0 auto;
  border-radius: 16px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(51, 78, 162, .10) 0%, rgba(244, 181, 54, .16) 100%);
  border: 1px solid rgba(51, 78, 162, .12);
  color: var(--text);
  font-weight: 800;
}

/* =========================================================
   AFBEELDINGEN
========================================================= */

.slide-image-wrap {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  max-height: 100%;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(51, 78, 162, .12);
  background: rgba(255, 255, 255, .75);
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: transparent;
}

.slide-extra > .slide-image-wrap:only-child .slide-image {
  width: 100%;
  height: 100%;
}

.slide-image-caption {
  display: none !important;
}

.slide-gallery {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.slide-gallery .slide-image-wrap {
  height: 100%;
}

/* =========================================================
   KAHOOT / LINK BUTTON
========================================================= */

.slide-button-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 14px;
}

.slide-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 28px;
  min-height: 52px;
  border-radius: 16px;
  background: var(--primary);
  color: white;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(51, 78, 162, .18);
  transition: transform .18s ease, background .18s ease;
}

.slide-button:hover {
  transform: translateY(-2px);
  background: #2a3f85;
}

/* =========================================================
   PYCODEFLOW LAUNCH
========================================================= */

.launch-shell {
  width: 100%;
  min-height: 0;
  flex: 1;
  display: flex;
}

.launch-card {
  flex: 1;
  gap: 16px;
}

.launch-note {
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.55;
}

/* =========================================================
   TIMER
========================================================= */

.slide-timer {
  position: fixed;
  top: 22px;
  right: 28px;
  z-index: 9998;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .88);
  border: 1px solid rgba(51, 78, 162, .18);
  box-shadow: 0 10px 30px rgba(35, 58, 99, .16);
  color: var(--text);
  font-weight: 900;
  font-size: 1.15rem;
}

body.slide-only .slide-timer {
  display: inline-flex !important;
}

body:not(.slide-only) .slide-timer {
  display: none !important;
}

.slide-timer.timer-done {
  background: rgba(255, 255, 255, .88);
  color: var(--text);
}

/* =========================================================
   SLIDE-ONLY FULLSCREEN
========================================================= */

body.slide-only .panel-top,
body.slide-only .slide-nav,
body.slide-only .slides-meta {
  display: none !important;
}

body.slide-only .sidebar {
  display: none !important;
}

body.slide-only .layout-grid {
  grid-template-columns: 1fr !important;
  height: 100vh;
}

body.slide-only .main-panel {
  padding: 0;
  border: none;
  box-shadow: none;
  background: transparent;
}

body.slide-only .slide-card {
  height: 100vh;
  max-height: 100vh;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 60px;
  justify-content: flex-start;
}

body.slide-only .slide-card h3 {
  font-size: clamp(3rem, 5.4vw, 5rem);
}

body.slide-only .slide-card p {
  font-size: clamp(1.4rem, 2.1vw, 2rem);
}

body.slide-only .slide-point,
body.slide-only .slide-section,
body.slide-only .slide-highlight {
  font-size: clamp(1.2rem, 1.7vw, 1.6rem);
}

body.slide-only .slide-points {
  max-height: none;
  overflow: visible;
}

body.slide-only .slide-extra {
  flex: 1 1 auto;
  min-height: 0;
}

body.slide-only .slide-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 980px) {
  .app-shell {
    padding: 12px;
  }

  .start-layout {
    height: calc(100vh - 24px);
  }

  .start-hero {
    grid-template-columns: 1fr;
    padding: 22px;
  }

  .layout-grid,
  .layout-grid.sidebar-collapsed {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: calc(100vh - 24px);
  }

  .sidebar {
    height: auto;
    max-height: 34vh;
  }

  .layout-grid.sidebar-collapsed .sidebar {
    max-height: 0;
  }

  .main-panel {
    min-height: 0;
  }
}

@media (max-width: 800px) {
  .slide-columns,
  .slide-gallery {
    grid-template-columns: 1fr;
  }
}
