/* ═══════════════════════════════════════════════════════════
   ALLFLIX  –  Stylesheet
   ═══════════════════════════════════════════════════════════ */

/* ── Reset & tokens ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:       #0d0f14; --sf:  #171a22; --sf2: #1f2330;
  --ac:       #e8a838; --tx:  #e2e4ec; --mu:  #7a7f96; --br: #2b2f42;
  --pw:       300px;   --dw:  300px;   --rad: 7px;
  --ease:     cubic-bezier(.4,0,.2,1);
  --tdur:     .35s;
  --panel-bg: #1f2330; /* dark: zelfde als --sf2 / mode-knoppen */
}
html { transition: background var(--tdur) var(--ease), color var(--tdur) var(--ease); }
html, body {
  height: 100%; background: var(--bg); color: var(--tx);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px; overflow: hidden;
  overscroll-behavior: none;
  /* Gebruik dynamische viewport hoogte zodat de browser-UI-balk niet meegeteld wordt */
  height: 100dvh;
}
#settings, #detail, footer, #cw {
  transition: background var(--tdur) var(--ease), border-color var(--tdur) var(--ease);
}

/* ── App layout – geen header meer ──────────────────────── */
#app  {
  display: grid;
  grid-template-rows: 1fr auto;
  grid-template-areas: 'main' 'footer';
  height: 100vh;
  height: 100dvh;
}
#main {
  display: flex;
  overflow: hidden;
  position: relative;
  grid-area: main;
  height: 100%;
}

/* ── Settings panel ─────────────────────────────────────── */
#settings {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: var(--pw);
  background: var(--panel-bg);
  border-right: 1px solid var(--br);
  overflow-y: auto;
  padding: 52px 14px 16px;
  z-index: 35;
  transition: transform .3s var(--ease), opacity .3s var(--ease),
              background var(--tdur) var(--ease), border-color var(--tdur) var(--ease);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
/* Light mode: settings panel gebruikt visualisatie-achtergrond (--bg) */
#settings[data-theme="light"] {
  background: var(--panel-bg);
  border-right-color: var(--br);
}
#settings.hidden {
  transform: translateX(calc(-1 * var(--pw)));
  opacity: 0;
  pointer-events: none;
}
.sg { margin-bottom: 16px; }
.sg-label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--mu); margin-bottom: 6px; transition: color var(--tdur) var(--ease);
}

/* ── Visualisatie sub-items (binnen VISUALISATIE sectie) ─── */
.viz-sub {
  margin-bottom: 12px;
}
.viz-sub:last-child { margin-bottom: 0; }

/* ── Filter sub-items (binnen FILTERS sectie) ────────────── */
.filter-sub {
  margin-bottom: 12px;
}
.filter-sub:last-child { margin-bottom: 0; }
.filter-sub-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--mu);
  margin-bottom: 5px;
  transition: color var(--tdur) var(--ease);
}

/* ── ALLFLIX logo in settings ────────────────────────────── */
#settingsLogoWrap {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 14px;
  margin-top: 4px;
}
#settingsLogo {
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: .08em;
  color: var(--tx);
  line-height: 1;
  text-align: center;
}
.logo-all {
  color: var(--ac);
}
.logo-u {
  color: var(--ac);
}
#infoBtn {
  background: var(--sf);
  border: 1px solid var(--br);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: .78rem;
  color: var(--tx);
  cursor: pointer;
  transition: background .18s var(--ease), color .15s, border-color .15s;
  white-space: nowrap;
  line-height: 1;
}
#infoBtn:hover { background: var(--sf2); }
#infoBtn.active { background: var(--ac); color: var(--bg); border-color: var(--ac); }
.info-panel {
  background: var(--sf2);
  border: 1px solid var(--br);
  border-radius: var(--rad);
  padding: 9px 11px;
  font-size: .75rem;
  color: var(--mu);
  line-height: 1.55;
  margin-bottom: 14px;
}
.info-panel strong { color: var(--tx); }
.info-panel em { color: var(--ac); font-style: normal; }

/* ── Presets ─────────────────────────────────────────────── */
.preset-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}
.preset-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.preset-header-row .sg-label { margin-bottom: 0; }
.top-x-btn.active,
.top-x-btn.active:hover {
  background: var(--ac);
  color: var(--bg);
  border-color: var(--ac);
}
.preset-share-sep {
  width: 12px;
  flex-shrink: 0;
}
.preset-slot {
  display: flex;
  align-items: center;
  gap: 3px;
}
.preset-load-btn, .preset-save-btn {
  background: var(--sf2); color: var(--mu); border: 1px solid var(--br);
  border-radius: var(--rad); cursor: pointer; line-height: 1;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.preset-load-btn {
  min-width: 30px; padding: 5px 8px; font-size: .82rem; font-weight: 600;
}
.preset-load-btn.has-data {
  border-color: var(--ac); color: var(--ac);
}
.preset-save-btn {
  padding: 4px 6px; font-size: .72rem;
}
.preset-load-btn:hover, .preset-save-btn:hover { background: var(--br); color: var(--tx); }
@keyframes presetFlash {
  0%   { background: var(--ac); color: var(--bg); border-color: var(--ac); transform: scale(1);    }
  40%  { background: var(--ac); color: var(--bg); border-color: var(--ac); transform: scale(1.18); }
  100% { background: var(--ac); color: var(--bg); border-color: var(--ac); transform: scale(1);    }
}
.preset-load-btn.preset-saved-flash {
  animation: presetFlash 600ms ease forwards;
}

/* ── Zoekbalk ────────────────────────────────────────────── */
.search-wrap { display: flex; flex-direction: column; gap: 5px; }
.search-input-wrap { position: relative; display: flex; align-items: center; }
#searchInput {
  width: 100%;
  background: var(--sf2); border: 1px solid var(--br);
  color: var(--tx); border-radius: var(--rad);
  padding: 6px 28px 6px 10px; font-size: .8rem;
  outline: none;
  transition: border-color .18s var(--ease);
}
#searchInput:focus { border-color: var(--ac); }
.search-clear-btn {
  position: absolute; right: 6px;
  background: none; border: none; color: var(--mu);
  cursor: pointer; font-size: .8rem; padding: 2px 4px;
  display: none; align-items: center; justify-content: center;
  transition: color .15s;
}
.search-clear-btn:hover { color: var(--tx); }
#searchResult {
  font-size: .74rem; min-height: 1em;
}
.search-found    { color: #5cb85c; }
.search-notview  { color: var(--ac); }
.search-notfound { color: #e05555; }
.search-result-extra { font-size: .72rem; color: var(--mu); margin-top: 2px; }

/* ── Knoppen (gedeelde stijl) ────────────────────────────── */
.mode-btn, .dir-btn, .gdir-btn, .theme-btn, .pick-btn {
  background: var(--sf2); color: var(--mu); border: 1px solid var(--br);
  border-radius: var(--rad); cursor: pointer; white-space: nowrap; line-height: 1;
  transition: background .18s var(--ease), color .18s var(--ease),
              border-color .18s var(--ease);
}
.mode-btn:hover, .dir-btn:hover, .gdir-btn:hover,
.theme-btn:hover, .pick-btn:hover { background: var(--br); color: var(--tx); }
.mode-btn.active, .dir-btn.active, .gdir-btn.active,
.theme-btn.active, .pick-btn.active {
  background: var(--ac); color: var(--bg); border-color: var(--ac); font-weight: 600;
}
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }
.mode-btn, .dir-btn, .gdir-btn, .theme-btn { flex: 1; padding: 6px 10px; font-size: .78rem; }
.pick-wrap { display: flex; flex-wrap: wrap; gap: 5px; }
.pick-btn  { padding: 5px 10px; font-size: .76rem; }

/* ── Kleurschaal knoppen ─────────────────────────────────── */
.color-scale-wrap { gap: 6px; }
.color-scale-btn {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 5px 8px; border-radius: var(--rad);
  background: var(--sf2); border: 1px solid var(--br);
  cursor: pointer; transition: border-color .18s var(--ease);
}
.color-scale-btn canvas { border-radius: 3px; display: block; }
.color-scale-btn .cs-label { font-size: .68rem; color: var(--mu); white-space: nowrap; }
.color-scale-btn.active { border-color: var(--ac); }
.color-scale-btn.active .cs-label { color: var(--ac); }

/* ── Sliders ─────────────────────────────────────────────── */
.sg input[type="range"] { width:100%; accent-color: var(--ac); cursor:pointer; margin-top:4px; }
.vd { color: var(--ac); font-weight: 600; }

/* ── Filter ──────────────────────────────────────────────── */
.filter-group { margin-bottom: 10px; }
.filter-head {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 5px; flex-wrap: wrap;
}
.filter-title { font-size: .8rem; color: var(--tx); font-weight: 600; }
.filter-count { font-size: .7rem; color: var(--mu); margin-left: 2px; }
.filter-toggle-all {
  font-size: .68rem; color: var(--mu); background: none;
  border: 1px solid var(--br); border-radius: 5px;
  padding: 2px 6px; cursor: pointer; margin-left: auto;
  transition: background .15s, color .15s;
}
.filter-toggle-all:hover { background: var(--br); color: var(--tx); }
.filter-list { display: flex; flex-wrap: wrap; gap: 4px; }
.filter-row {
  display: flex; align-items: center; gap: 4px;
  background: var(--sf2); border: 1px solid var(--br);
  border-radius: 5px; padding: 3px 8px; cursor: pointer;
  font-size: .76rem; color: var(--mu);
  transition: background .15s, border-color .15s, color .15s;
  user-select: none;
}
.filter-row:hover { background: var(--br); color: var(--tx); }
.filter-row:has(input:checked) { border-color: var(--ac); color: var(--tx); }
.filter-row input[type="checkbox"] { accent-color: var(--ac); cursor: pointer; }

/* ── Toggle-knop & zoomfit ───────────────────────────────── */
#topBtns {
  position: absolute; top: 10px; left: 10px; z-index: 30;
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  transition: left .3s var(--ease);
}
#topBtns.shifted { left: calc(var(--pw) + 18px); }
.tbtn {
  background: var(--sf); border: 1px solid var(--br);
  color: var(--tx); padding: 7px 11px; border-radius: 8px;
  cursor: pointer; font-size: .78rem;
  transition: background .18s var(--ease);
  white-space: nowrap;
  line-height: 1;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tbtn:hover { background: var(--sf2); }

/* Modusknoppen in topbar */
#modeBtns {
  display: flex; gap: 5px; flex-wrap: wrap;
}
#modeBtns .mode-btn {
  padding: 6px 10px; font-size: .76rem;
  flex: none;
}

/* ── Canvas ──────────────────────────────────────────────── */
#cw  { position: absolute; inset: 0; overflow: hidden; background: var(--bg); }
#viz { width: 100%; height: 100%; display: block; }

/* ── Geen data bericht ───────────────────────────────────── */
#noDataMsg {
  position: absolute; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  font-size: 1.1rem; color: var(--mu);
  pointer-events: none;
  z-index: 5;
}

/* ── Tooltip ─────────────────────────────────────────────── */
#tip {
  position: fixed; pointer-events: none;
  background: var(--sf); border: 1px solid var(--br);
  padding: 6px 10px; border-radius: 7px; font-size: .8rem;
  opacity: 0; transition: opacity .12s;
  max-width: 220px; box-shadow: 0 4px 20px rgba(0,0,0,.35);
  z-index: 100; color: var(--tx);
  line-height: 1.5;
}

/* ── Detail panel ────────────────────────────────────────── */
#detail {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: var(--dw);
  background: var(--sf);
  border-left: 1px solid var(--br);
  padding: 14px 12px;
  overflow-y: auto;
  transform: translateX(var(--dw));
  z-index: 20;
  transition: transform .3s var(--ease),
              background var(--tdur) var(--ease),
              border-color var(--tdur) var(--ease);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#detail.on { transform: translateX(0); }
#detail h3 { font-size:.95rem; font-weight:700; color:var(--ac); margin-bottom:12px; line-height:1.3; padding-right:24px; }
.xbtn { position:absolute; top:14px; right:12px; background:none; border:none; color:var(--mu); font-size:1.1rem; cursor:pointer; z-index: 25; padding: 8px; margin: -8px; touch-action: manipulation; }
.xbtn:hover { color:var(--tx); }
.df { margin-bottom:8px; }
.df .k { font-size:.68rem; text-transform:uppercase; letter-spacing:.08em; color:var(--mu); transition:color var(--tdur) var(--ease); }
.df .v { color:var(--tx); font-size:.83rem; line-height:1.4; word-break:break-word; transition:color var(--tdur) var(--ease); }
.df .v a { color:var(--ac); text-decoration:none; }
.df .v a:hover { text-decoration:underline; }
.df .v.synopsis { font-style:italic; color:var(--mu); font-size:.8rem; }

/* ── Footer ──────────────────────────────────────────────── */
footer {
  grid-area: footer; text-align:center; padding:6px 12px;
  font-size:.68rem; color:var(--mu); border-top:1px solid var(--br);
  background:var(--bg); display:flex; align-items:center; justify-content:center;
  gap: 4px; flex-wrap: wrap;
}
footer a { color:var(--mu); text-decoration:none; }
footer a:hover { color:var(--tx); }
.footer-btn {
  background: none; border: 1px solid var(--br); border-radius: 5px;
  color: var(--mu); padding: 2px 8px; cursor: pointer; font-size: .68rem;
  transition: background .15s, color .15s;
}
.footer-btn:hover { background: var(--br); color: var(--tx); }
#shareFeedback { color: #5cb85c; font-size: .68rem; }

/* ── D3 assen ────────────────────────────────────────────── */
.axis line, .axis path { stroke: var(--br); transition: stroke var(--tdur) var(--ease); }
.axis text { fill: var(--mu); font-size: 10px; transition: fill var(--tdur) var(--ease); }
.axis .tick line { display: none; }
.al  { fill:var(--mu); font-size:11px; transition:fill var(--tdur) var(--ease); }

/* ── Groepslabels – groter ───────────────────────────────── */
.gl {
  fill: var(--tx);
  font-size: 17px;
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
  opacity: .92;
  paint-order: stroke fill;
  stroke: var(--bg);
  stroke-width: 5px;
  stroke-linejoin: round;
  transition: fill var(--tdur) var(--ease), stroke var(--tdur) var(--ease);
}
.gl-count {
  fill: var(--tx);
  font-size: 13px;
  font-weight: 500;
  opacity: .75;
}

/* ── Allflix subtitel ────────────────────────────────────── */
.netflux-subtitle {
  fill: var(--mu);
  font-size: 18px;
  font-style: italic;
  letter-spacing: .03em;
  pointer-events: none;
  opacity: .75;
  transition: fill var(--tdur) var(--ease);
}

/* ── Kleurlegenda ─────────────────────────────────────────── */
.leg-label {
  fill: var(--mu); font-size: 9px;
  text-transform: uppercase; letter-spacing: .07em;
}
.leg-tick { fill: var(--mu); font-size: 9px; }

/* ── Desktop: settings panel volle schermhoogte via position:fixed ── */
@media (min-width: 769px) {
  #settings {
    position: fixed;
    top: 0;
    bottom: 0;
  }
  /* topBtns ook fixed zodat het altijd boven het fixed settings-panel uitkomt */
  #topBtns {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 40;
  }
  #topBtns.shifted {
    left: calc(var(--pw) + 18px);
  }
}

/* ── Mobiel ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --pw:92vw; --dw:min(300px,92vw); --table-top: 90px; }

  #settings {
    position: fixed;
    left: 0; right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    height: 55vh;
    height: 55dvh;
    border-right: none;
    border-top: 1px solid var(--panel-bg);
    border-radius: 14px 14px 0 0;
    padding: 16px 14px 16px;
    transform: translateY(0);
    z-index: 50;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 -6px 32px rgba(0,0,0,.4);
    box-sizing: border-box;
    background: var(--panel-bg);
  }
  /* Light mode op mobiel: ook --panel-bg (= visualisatie-achtergrond) */
  #settings[data-theme="light"] {
    background: var(--panel-bg);
  }
  /* Voorkom overflow van inhoud binnen settings op mobiel */
  #settings * { max-width: 100%; box-sizing: border-box; }
  #settings .pick-wrap, #settings .btn-row { flex-wrap: wrap; }
  #settings.hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
  }
  /* Detail panel: op mobiel fixed en breed zodat sluitknop altijd bereikbaar is */
  #detail {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(300px, 92vw);
    z-index: 45;
  }
  /* Als detail open is, zet het boven topBtns en settings-tab */
  #detail.on {
    z-index: 65;
  }
  #detail:not(.on) { transform: translateX(110vw); }
  /* Voorkom dat het body horizontaal scrollt naar het detailpaneel */
  #app { overflow: hidden; touch-action: pan-y; }
  #main { overflow: hidden; }
  /* Tabel links uitgelijnd – settings komt van onderaf, geen horizontale verschuiving */
  #tableWrap { left: 0 !important; }
  /* Sluitknop detail: groot tapvlak op mobiel */
  .xbtn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    top: 8px;
    right: 6px;
    padding: 0;
    margin: 0;
    background: var(--sf2);
    border: 1px solid var(--br) !important;
    border-radius: 50%;
    color: var(--tx);
    z-index: 10;
  }
  .gl { font-size: 13px; }
  /* topBtns: niet verschuiven op mobiel */
  #topBtns.shifted { left: 10px; }
  /* Sluitknop zichtbaar in settings */
  .settings-close-btn { display: flex; }
  /* Mobiele footer zichtbaar */
  .mobile-footer { display: flex; }
  /* Normale footer verbergen op mobiel */
  footer { display: none; }
}

/* ── Tabelmodus ──────────────────────────────────────────── */
#tableWrap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  top: var(--table-top, 56px);
  overflow: auto;
  background: var(--bg);
  padding: 0 12px 12px;
  transition: left .3s var(--ease), top .2s var(--ease);
  touch-action: pan-x pan-y;
}
#dataTable {
  width: 100%;
  border-collapse: collapse;
  font-size: .78rem;
  color: var(--tx);
}
#dataTable thead th {
  position: sticky;
  top: 0;
  background: var(--sf);
  border-bottom: 2px solid var(--br);
  padding: 8px 10px;
  text-align: left;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--mu);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  z-index: 2;
  transition: color .15s, background var(--tdur) var(--ease);
}
#dataTable thead th:hover { color: var(--tx); }
#dataTable thead th.sort-active { color: var(--ac); }
#dataTable tbody tr {
  border-bottom: 1px solid var(--br);
  transition: background .12s;
}
#dataTable tbody tr:hover { background: var(--sf); cursor: pointer; }
#dataTable tbody td {
  padding: 6px 10px;
  vertical-align: middle;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#dataTable tbody td.td-title { font-weight: 600; color: var(--tx); max-width: 260px; }
#dataTable tbody td.td-num   { text-align: right; font-variant-numeric: tabular-nums; }
#dataTable tbody td.td-rownum { text-align: right; color: var(--mu); font-size: .7rem; font-variant-numeric: tabular-nums; width: 32px; padding-right: 6px; }
#dataTable tbody td.td-unknown { color: var(--mu); font-style: italic; }
#dataTable tbody td.td-link  { text-align: right; white-space: nowrap; }
#dataTable tbody td.td-link a { color: var(--ac); text-decoration: none; font-size: .74rem; }
#dataTable tbody td.td-link a:hover { text-decoration: underline; }
.tbl-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ── Zoekresultaat titellabels ───────────────────────────── */
.bubble-lbl {
  font-size: 10px;
  fill: var(--tx);
  opacity: 0.85;
  pointer-events: none;
}
.search-label {
  fill: var(--tx);
  font-size: 10px;
  font-weight: 600;
  paint-order: stroke fill;
  stroke: var(--bg);
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: 0.92;
}

/* ── Jaar dual-range slider ──────────────────────────────── */
.year-range-wrap { margin-top: 4px; }
.dual-range-wrap {
  position: relative;
  height: 32px;
  margin: 4px 0;
}
.dual-range-track {
  position: absolute;
  top: 50%; left: 0; right: 0;
  transform: translateY(-50%);
  height: 4px;
  background: var(--br);
  border-radius: 2px;
  pointer-events: none;
}
.dual-range-fill {
  position: absolute;
  height: 100%;
  background: var(--ac);
  border-radius: 2px;
}
.dual-range-input {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
  cursor: pointer;
}
.dual-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ac);
  border: 2px solid var(--sf);
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
  pointer-events: all;
  cursor: grab;
}
.dual-range-input::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ac);
  border: 2px solid var(--sf);
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
  pointer-events: all;
  cursor: grab;
}
.dual-range-input::-webkit-slider-thumb:active { cursor: grabbing; }
.dual-range-input::-moz-range-thumb:active { cursor: grabbing; }

/* ── Zoekfilter-checkbox ─────────────────────────────────── */
.search-filter-btns {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}
.search-filter-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .78rem;
  color: var(--tx);
  cursor: pointer;
  user-select: none;
  padding: 3px 0;
}
.search-filter-check input[type="checkbox"] {
  accent-color: var(--ac);
  width: 14px; height: 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.search-filter-out-text {
  font-size: .72rem;
  color: var(--mu);
  padding-left: 21px;
}

/* ── Mobiel: sluitknop in settings ───────────────────────── */
.settings-close-btn {
  display: none;
  background: none;
  border: 1px solid var(--br);
  color: var(--tx);
  border-radius: 50%;
  width: 28px; height: 28px;
  cursor: pointer;
  font-size: .9rem;
  line-height: 1;
  flex-shrink: 0;
  margin-left: auto;
}
/* #settingsLogoWrap flex al ingesteld in mobile media query hierboven */
#settingsLogoWrap { display: flex; align-items: center; gap: 8px; }

/* ── Jaar-range header + reset ───────────────────────────── */
.year-range-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  margin-bottom: 4px;
}
.year-range-reset-btn {
  background: none;
  border: 1px solid var(--br);
  border-radius: var(--rad);
  color: var(--mu);
  font-size: .68rem;
  padding: 2px 7px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  flex-shrink: 0;
}
.year-range-reset-btn:hover {
  background: var(--ac);
  color: var(--bg);
  border-color: var(--ac);
}

/* ── Toggle rij (checkbox in instellingen) ───────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  color: var(--tx);
  cursor: pointer;
  user-select: none;
}
.toggle-row input[type="checkbox"] {
  accent-color: var(--ac);
  width: 14px; height: 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.label-toggle-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
}
.label-fontsize-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.label-fontsize-btn {
  background: var(--sf2);
  border: 1px solid var(--br);
  color: var(--tx);
  border-radius: var(--rad);
  width: 22px; height: 22px;
  font-size: .85rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .15s, border-color .15s;
}
.label-fontsize-btn:hover {
  background: var(--ac);
  color: var(--bg);
  border-color: var(--ac);
}
.label-fontsize-val {
  font-size: .78rem;
  color: var(--mu);
  min-width: 18px;
  text-align: center;
}

/* ── Titel-teller in topbar ──────────────────────────────── */
.title-count {
  font-size: .88rem;
  font-weight: 600;
  color: var(--tx);
  white-space: nowrap;
  padding: 0 2px;
  align-self: center;
  letter-spacing: .01em;
}


/* ── Info Modal ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  position: relative;
  background: var(--sf);
  border: 1px solid var(--br);
  border-radius: 12px;
  padding: 28px 28px 24px;
  max-width: min(480px, 92vw);
  max-height: calc(100dvh - 48px);
  width: 100%;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  animation: slideUp .18s ease;
}
@keyframes slideUp { from { transform: translateY(14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@media (max-width: 768px) {
  .modal-overlay {
    padding: 16px;
    align-items: center;
    justify-content: center;
  }
  .modal-box {
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    width: 100%;
    overflow-y: auto;
    margin: 0;
  }
}
.modal-close {
  position: absolute;
  top: 12px; right: 14px;
  background: none;
  border: none;
  color: var(--mu);
  font-size: 1.1rem;
  cursor: pointer;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  transition: background .15s, color .15s;
}
.modal-close:hover { background: var(--br); color: var(--tx); }
.modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: .08em;
  margin: 0 0 14px;
  color: var(--tx);
}
.modal-title .logo-all { color: var(--ac); }
.info-panel { border: none; background: none; padding: 0; font-size: .88rem; line-height: 1.65; }


/* ── Mobiele footer / settings footer-info ───────────────── */
.mobile-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--br);
}
.mobile-footer-meta {
  font-size: .68rem;
  color: var(--mu);
  line-height: 1.7;
}
.mobile-footer-meta a { color: var(--mu); text-decoration: none; }
.mobile-footer-meta a:hover { color: var(--tx); }

/* ── Footer-link (past naadloos in footer-tekst) ─────────── */
.footer-link {
  color: var(--mu);
  text-decoration: none;
  transition: color .15s;
}
.footer-link:hover { color: var(--tx); text-decoration: underline; }

/* ── Share-modal CSS is verwijderd (Web Share API gebruikt) ── */

/* ── Contact modal ───────────────────────────────────────── */
.contact-modal-box {
  max-width: min(520px, 94vw);
}
.contact-modal-title {
  display: flex;
  align-items: center;
  font-size: 1.15rem;
  margin-bottom: 10px;
}
.contact-intro {
  font-size: .82rem;
  color: var(--mu);
  line-height: 1.6;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--br);
}
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
/* Twee velden naast elkaar op bredere viewports */
.contact-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 500px) {
  .contact-field-row { grid-template-columns: 1fr; }
}
.contact-email-hint {
  font-size: .68rem;
  color: var(--mu);
  font-style: italic;
  margin-top: -8px;
}
.contact-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.contact-field label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--mu);
  font-weight: 600;
}
.contact-required { color: var(--ac); }
.contact-optional {
  font-size: .68rem;
  color: var(--mu);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
.contact-field input,
.contact-field textarea {
  background: var(--sf2);
  border: 1px solid var(--br);
  border-radius: var(--rad);
  color: var(--tx);
  font-size: .83rem;
  padding: 9px 12px;
  outline: none;
  font-family: inherit;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
  resize: vertical;
  width: 100%;
}
.contact-field input:focus,
.contact-field textarea:focus {
  border-color: var(--ac);
  box-shadow: 0 0 0 3px rgba(232,168,56,.15);
}
.contact-field input::placeholder,
.contact-field textarea::placeholder { color: var(--mu); opacity: .6; }
.contact-recaptcha {
  /* reCAPTCHA widget uitlijning */
  transform-origin: left top;
}
.contact-feedback {
  padding: 10px 13px;
  border-radius: var(--rad);
  font-size: .8rem;
  line-height: 1.45;
}
.contact-feedback.success {
  background: rgba(92,184,92,.1);
  border: 1px solid rgba(92,184,92,.5);
  color: #6fcf6f;
}
.contact-feedback.error {
  background: rgba(224,85,85,.1);
  border: 1px solid rgba(224,85,85,.4);
  color: #e07070;
}
.contact-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 2px;
}
.contact-submit-btn {
  background: var(--ac);
  border: none;
  border-radius: var(--rad);
  color: var(--bg);
  font-size: .84rem;
  font-weight: 700;
  padding: 10px 26px;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  letter-spacing: .02em;
}
.contact-submit-btn:hover  { opacity: .88; transform: translateY(-1px); }
.contact-submit-btn:active { transform: translateY(0); }
.contact-submit-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.contact-cancel-btn {
  background: none;
  border: 1px solid var(--br);
  border-radius: var(--rad);
  color: var(--mu);
  font-size: .84rem;
  padding: 10px 18px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.contact-cancel-btn:hover { background: var(--br); color: var(--tx); }


/* ── Settings tab label (mobiel, aan de zijkant) ─────────── */
.settings-tab { display: none; }

/* ── Fractie slider wrap ─────────────────────────────────── */
.fraction-slider-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fraction-slider-wrap input[type="range"] {
  flex: 1;
  accent-color: var(--ac);
  cursor: pointer;
  margin-top: 4px;
}
.fraction-100-btn {
  padding: 2px 7px;
  font-size: .68rem;
  flex-shrink: 0;
  white-space: nowrap;
  background: none;
  border: 1px solid var(--br);
  border-radius: var(--rad);
  color: var(--mu);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.fraction-100-btn:hover {
  background: var(--ac);
  color: var(--bg);
  border-color: var(--ac);
}

/* ── Fractie-label rij (label + 100%-knop op één regel) ─── */
.fraction-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.fraction-label-row .sg-label,
.fraction-label-row .filter-sub-label { margin-bottom: 0; }

/* ── Dual-bol slider ─────────────────────────────────────── */
.dual-bol-wrap {
  position: relative;
  height: 34px;
  margin: 4px 0;
}
.dual-bol-track {
  position: absolute;
  top: 50%; left: 0; right: 0;
  transform: translateY(-50%);
  height: 4px;
  background: var(--br);
  border-radius: 2px;
  pointer-events: none;
}
.dual-bol-fill {
  position: absolute;
  height: 100%;
  background: var(--ac);
  border-radius: 2px;
}
.dual-bol-input {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
  cursor: pointer;
  accent-color: var(--ac);
}
.dual-bol-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ac);
  border: 2px solid var(--sf);
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
  pointer-events: all;
  cursor: grab;
}
.dual-bol-input::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ac);
  border: 2px solid var(--sf);
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
  pointer-events: all;
  cursor: grab;
}
.dual-bol-input::-webkit-slider-thumb:active { cursor: grabbing; }
.dual-bol-input::-moz-range-thumb:active { cursor: grabbing; }

/* ── Allflix A-label (JS bepaalt zichtbaarheid) ──────────── */
.allflix-lbl { display: none; }

/* ── Title count: desktop rechts van modeBtns, mobiel inline ─ */
.title-count-desktop { display: inline; }
.title-count-mobile  { display: none; }

/* ── Extra mobiel ────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Hamburger (#tgBtn) verbergen – settings-tab doet dit op mobiel */
  #tgBtn { display: none !important; }

  /* topBtns: position:fixed zodat het boven het fixed settings-panel uitkomt */
  #topBtns {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 55;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    max-width: calc(100vw - 20px);
  }
  /* Nooit verschuiven op mobiel */
  #topBtns.shifted { left: 10px !important; }

  /* Rij 1: zoom, info, titleCount (mobile) */
  #zoomFitBtn          { order: 1; }
  #infoBtn             { order: 1; }
  .title-count-mobile  { order: 1; display: inline; }
  /* Rij 2: modusknoppen */
  #modeBtns            { order: 2; flex-basis: 100%; }

  /* Desktop title count verbergen */
  .title-count-desktop { display: none !important; }

  /* Settings-tab: links onderaan, boven het panel */
  .settings-tab {
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 0;
    left: 20px;
    width: 52px;
    height: 32px;
    background: var(--panel-bg);
    border: 1px solid var(--br);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    color: var(--tx);
    font-size: 1.3rem;
    font-weight: 900;
    cursor: pointer;
    z-index: 60;
    box-shadow: none;
    transition: background .18s var(--ease), bottom .3s var(--ease);
    pointer-events: all !important;
  }
  .settings-tab:hover { background: var(--sf); }

  /* Panel open: tab schuift mee, naadloos aan panel */
  .settings-tab.settings-open {
    bottom: 55vh;
    bottom: 55dvh;
    background: var(--panel-bg);
    box-shadow: none;
    border-bottom: 1px solid var(--panel-bg);
  }
}
