/* ══════════════════════════════════════════════════════════════
   kloklezen.css — Kloklezen Werkblad Generator
   Stijl: identiek aan Rekenbundel Generator (jufzisa.be)
   ══════════════════════════════════════════════════════════════ */

/* ── RESET & BASIS ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }

:root {
  --blauw:      #1A3A5C;
  --lichtblauw: #4A90D9;
  --accent:     #c4c22c;
  --groen:      #27AE60;
  --rood:       #E74C3C;
  --bg:         #F4F6FB;
  --wit:        #FFFFFF;
  --border:     #D8E2F0;
  --tekst:      #2C3E50;
  --muted:      #7F8C9A;
  --sidebar-w:  360px;
  --header-h:   64px;

  /* Kloklezen-specifieke kleuren per tab */
  --klok-blauw:   #A2D2FF;
  --klok-groen:   #A5D6A7;
  --klok-oranje:  #FFD0A0;
  --klok-paars:   #E1BEE7;
  --klok-rood:    #FFB3B3;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--tekst);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── HEADER ────────────────────────────────────────────────── */
header {
  height: var(--header-h);
  background: #ddeeff;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
}

header .logo {
  font-size: 22px;
  font-weight: 800;
  color: #1a3a5c;
  letter-spacing: -.5px;
}
header .logo span { color: var(--accent); }

header .subtitle {
  font-size: 13px;
  color: rgba(18, 45, 73, 0.7);
  margin-left: 4px;
}
header .spacer { flex: 1; }
header .badge {
  background: #1a3a5c;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: .5px;
}
.menu-knop {
  background: var(--blauw);
  color: white;
  border: none;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background .2s;
}
.menu-knop:hover { background: #0f2540; }

/* ── MAIN LAYOUT ───────────────────────────────────────────── */
.main {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - var(--header-h));
}

/* ── SIDEBAR ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--wit);
  border-right: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

/* ── TABS ──────────────────────────────────────────────────── */
.sidebar-tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 2px solid var(--border);
  background: #ffffff;
  scrollbar-gutter: stable;
}
.sidebar-tabs::-webkit-scrollbar { height: 14px; }
.sidebar-tabs::-webkit-scrollbar-track { background: #eaf2fb; }
.sidebar-tabs::-webkit-scrollbar-thumb { background: #4A90D9; border-radius: 999px; }
.sidebar-tabs::-webkit-scrollbar-thumb:hover { background: #2d6fad; }

.sidebar-tab {
  flex: 0 0 auto;
  min-width: 100px;
  padding: 12px 8px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  color: var(--blauw);
  border-bottom: 4px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
  white-space: normal;
  line-height: 1.3;
}

/* Tab kleuren */
.tab-klok     { background: var(--klok-blauw); }
.tab-klok:hover { background: #8ECAFF; }
.tab-klok.active { background: #4A90D9 !important; color: #fff; border-bottom-color: #1A3A5C !important; font-weight: 800; }

.tab-tijdverschil { background: var(--klok-groen); }
.tab-tijdverschil:hover { background: #80c984; }
.tab-tijdverschil.active { background: #27AE60 !important; color: #fff; border-bottom-color: #1B5E20 !important; font-weight: 800; }

.tab-verbinden { background: var(--klok-oranje); }
.tab-verbinden:hover { background: #FFC080; }
.tab-verbinden.active { background: #FF8C00 !important; color: #fff; border-bottom-color: #c45e00 !important; font-weight: 800; }

.tab-ordenen { background: var(--klok-paars); }
.tab-ordenen:hover { background: #CE93D8; }
.tab-ordenen.active { background: #9733b3 !important; color: #fff; border-bottom-color: #4A148C !important; font-weight: 800; }

.tab-rangschikken { background: #d4f0e8; color: #1a5c42; }
.tab-rangschikken:hover { background: #b8e6d4; }
.tab-rangschikken.active { background: #1e8a5e !important; color: #fff; border-bottom-color: #145c3e !important; font-weight: 800; }

.tabs-scroll-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  padding: 4px 10px;
  background: #f7f9fc;
  border-bottom: 1px solid var(--border);
}
.tabs-scroll-btn {
  padding: 2px 8px;
  border: none;
  background: #4A90D9;
  color: white;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
}
.tabs-scroll-btn:hover { background: #2d6fad; }

/* ── SIDEBAR CONTENT ───────────────────────────────────────── */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: none;
}
.sidebar-content.actief { display: block; }

/* ── SECTIETITEL ───────────────────────────────────────────── */
.sectie-titel {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--muted);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ── CONFIG KAART ──────────────────────────────────────────── */
.config-kaart {
  background: var(--wit);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}
.config-kaart .kaart-titel {
  font-size: 13px;
  font-weight: 700;
  color: var(--blauw);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.config-kaart .kaart-titel .icon {
  width: 26px; height: 26px;
  background: var(--blauw);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

/* ── FORM ELEMENTEN ────────────────────────────────────────── */
.form-rij { margin-bottom: 10px; }
.form-rij label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}
.form-rij select,
.form-rij input[type="number"] {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--tekst);
  background: var(--wit);
  outline: none;
  transition: border-color .2s;
  appearance: none;
}
.form-rij select:focus,
.form-rij input:focus { border-color: var(--lichtblauw); }

/* ── CHECKBOX CHIPS ────────────────────────────────────────── */
.checkbox-groep { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.checkbox-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: #ffffff;
  transition: all .2s;
  user-select: none;
}
.checkbox-chip input { display: none; }
.checkbox-chip.geselecteerd { border-color: var(--lichtblauw); background: #EBF3FB; color: var(--lichtblauw); }

/* ── RADIO CHIPS ───────────────────────────────────────────── */
.radio-groep { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.radio-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: #ffffff;
  transition: all .2s;
  user-select: none;
}
.radio-chip input { display: none; }
.radio-chip.geselecteerd { border-color: var(--lichtblauw); background: #EBF3FB; color: var(--lichtblauw); }

/* ── GENEREER KNOP ─────────────────────────────────────────── */
.genereer-knop {
  width: 100%;
  padding: 12px;
  background: var(--blauw);
  color: #fff;
  border: none;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  transition: background .2s;
  font-family: inherit;
}
.genereer-knop:hover { background: #0f2540; }

/* ── MELDING ───────────────────────────────────────────────── */
.melding-box {
  color: #c00;
  font-size: 12px;
  font-weight: 600;
  min-height: 20px;
  margin-bottom: 8px;
}

/* ── BINNENKORT BADGE ──────────────────────────────────────── */
.binnenkort-kaart {
  background: #f7f9fc;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  padding: 28px 20px;
  text-align: center;
  color: var(--muted);
}
.binnenkort-kaart .binnenkort-icon { font-size: 32px; margin-bottom: 10px; }
.binnenkort-kaart .binnenkort-titel {
  font-size: 14px;
  font-weight: 700;
  color: var(--blauw);
  margin-bottom: 6px;
}
.binnenkort-kaart p { font-size: 12px; line-height: 1.6; }

/* ── CONTENT AREA ──────────────────────────────────────────── */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

/* ── TOOLBAR ───────────────────────────────────────────────── */
.toolbar {
  background: var(--wit);
  border-bottom: 1.5px solid var(--border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.toolbar-knop {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--wit);
  color: var(--tekst);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  white-space: nowrap;
}
.toolbar-knop:hover { background: #EBF3FB; border-color: var(--lichtblauw); color: var(--lichtblauw); }
.toolbar-knop.primair {
  background: var(--blauw);
  color: white;
  border-color: var(--blauw);
}
.toolbar-knop.primair:hover { background: #0f2540; border-color: #0f2540; }
.toolbar-spacer { flex: 1; }

/* ── CANVAS AREA ───────────────────────────────────────────── */
.canvas-area {
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
  flex: 1;
  min-height: 0;
  height: 0;  /* Trucje: height:0 + flex:1 + min-height:0 = scrollt altijd */
}

#canvas-wrapper {
  background: white;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  border-radius: 8px;
  overflow: hidden;
  max-width: 100%;
}

#mainCanvas {
  display: block;
  width: 100%;
  height: auto;
}

/* ── SCROLLBAR SIDEBAR CONTENT ─────────────────────────────── */
.sidebar-content::-webkit-scrollbar { width: 6px; }
.sidebar-content::-webkit-scrollbar-track { background: transparent; }
.sidebar-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 100%; --header-h: 56px; }
  .main {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - var(--header-h));
}
  .sidebar { width: 100%; max-height: 50vh; border-right: none; border-bottom: 2px solid var(--border); }
  .content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}
  body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--tekst);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
}

/* ══════════════════════════════════════════════════════════════
   BUNDEL VISUELE PREVIEW (midden kolom)
   ══════════════════════════════════════════════════════════════ */

#bundelPreview {
  padding: 16px 20px;
}

.preview-leeg {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  padding: 40px;
}

.preview-blok {
  background: var(--wit);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.preview-blok-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f7f9fc;
  border-bottom: 1.5px solid var(--border);
}

.preview-blok-nr {
  font-size: 12px;
  font-weight: 800;
  color: var(--blauw);
  background: #EBF3FB;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.preview-blok-type {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
}

.preview-blok-verwijder {
  background: none;
  border: 1px solid #fcc;
  color: var(--rood);
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
  font-family: inherit;
  margin: 0;
}
.preview-blok-verwijder:hover { background: #fdecea; }

.preview-opdracht {
  font-size: 14px;
  font-style: italic;
  color: var(--blauw);
  background: #f5f8ff;
  border: 1px solid #c8d8f0;
  border-radius: 5px;
  padding: 7px 12px;
  margin: 8px 12px 4px 12px;
}

.preview-inhoud {
  padding: 4px 14px 10px;
}

.preview-inhoud > canvas {
  width: 100% !important;
  height: auto !important;
}
/* Tijdverschil klokken: vaste maat, niet uitrekken */
.preview-inhoud canvas.klok-vast {
  width: 90px !important;
  height: 90px !important;
}

/* ══════════════════════════════════════════════════════════════
   KLOK-GRID (individuele klokken in preview)
   ══════════════════════════════════════════════════════════════ */

.klok-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 12px;
}

.klok-cel {
  position: relative;
  background: #f9fbff;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.klok-cel canvas {
  width: 100% !important;
  height: auto !important;
  display: block;
}

.klok-cel-verwijder {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(255,255,255,0.9);
  border: 1px solid #fcc;
  color: var(--rood);
  font-size: 13px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  opacity: 0;
  transition: opacity .15s;
  line-height: 1;
}
.klok-cel:hover .klok-cel-verwijder { opacity: 1; }

.klok-cel-toevoegen {
  min-height: 80px;
  background: #f0f8ff;
  border: 2px dashed #b0d4f0;
  cursor: pointer;
  justify-content: center;
}
.klok-cel-toevoegen button {
  background: none;
  border: none;
  color: var(--lichtblauw);
  font-size: 24px;
  cursor: pointer;
  text-align: center;
  padding: 10px;
  font-family: inherit;
  margin: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background .15s;
}
.klok-cel-toevoegen button span {
  font-size: 11px;
  font-weight: 600;
}
.klok-cel-toevoegen button:hover { background: #ddeeff; }

/* ── MELDING IN TOOLBAR ────────────────────────────────────── */
.bundel-melding-toolbar {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

/* ── CANVAS AREA SCROLL FIX ────────────────────────────────── */
/* De truc: .main heeft overflow:hidden, .content ook,
   maar .canvas-area heeft flex:1 + min-height:0 + overflow-y:auto
   zodat hij scrollt binnen de vaste paginahoogte              */

/* Verbinden tab — oranje (al aanwezig maar bevestigen) */
.tab-verbinden { background: var(--klok-oranje); color: #1A3A5C; }
.tab-verbinden:hover { background: #FFC080; }
.tab-verbinden.active { background: #FF8C00 !important; color: #fff; border-bottom-color: #c45e00 !important; font-weight: 800; }

/* Schrijven tab */
.tab-schrijven { background: #e8d5f5; color: #3a1a6c; }
.tab-schrijven:hover { background: #d5b8f0; }
.tab-schrijven.active { background: #8e44ad !important; color: #fff; border-bottom-color: #6c3483 !important; font-weight: 800; }

/* Begrippen tab */
.tab-begrippen { background: #fde8f5; color: #5a1a4c; }
.tab-begrippen:hover { background: #f5c8e8; }
.tab-begrippen.active { background: #9b2576 !important; color: #fff; border-bottom-color: #7a1a5a !important; font-weight: 800; }
