/* ── LOGIN PAGINA ── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f2f5;
  padding: 20px;
}
.login-box {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.12);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
}
.login-logo {
  text-align: center;
  margin-bottom: 16px;
}
.login-titel {
  font-size: 1.5em;
  font-weight: 700;
  color: #1c1e21;
  text-align: center;
  margin-bottom: 4px;
}
.login-subtitel {
  font-size: 0.9em;
  color: #65676b;
  text-align: center;
  margin-bottom: 24px;
}
.formulier-groep {
  margin-bottom: 16px;
}
.formulier-groep label {
  display: block;
  font-size: 0.85em;
  font-weight: 600;
  color: #65676b;
  margin-bottom: 6px;
}
.formulier-groep input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #dde1e7;
  border-radius: 8px;
  font-size: 0.97em;
  color: #1c1e21;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.formulier-groep input:focus {
  border-color: #094ea9;
}
.onthoud-rij {
  margin-bottom: 20px;
}
.onthoud-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9em;
  color: #1c1e21;
  cursor: pointer;
}
.login-knop {
  width: 100%;
  padding: 12px;
  background: #094ea9;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.login-knop:hover {
  background: #073d86;
}
.flash-melding {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9em;
}
.flash-error {
  background: #fde8e8;
  color: #c0392b;
  border: 1px solid #f5c0c0;
}
.flash-info {
  background: #eef4ff;
  color: #094ea9;
  border: 1px solid #c0d4f5;
}

/* ── HOOFDPAGINA ── */
:root {
  --achtergrond: #f0f2f5;
  --kaart-bg: #ffffff;
  --balk-bg: #094ea9;
  --balk-tekst: #ffffff;
  --accent: #094ea9;
  --accent-hover: #073d86;
  --tekst: #1c1e21;
  --tekst-zacht: #65676b;
  --rand: #dde1e7;
  --schaduw: 0 2px 8px rgba(0,0,0,0.10);
  --schaduw-hover: 0 4px 16px rgba(0,0,0,0.16);
  --radius: 12px;
  --radius-klein: 8px;
  --lettergrootte: 17px;
  --overgang: 0.2s ease;
  --sidebar-breedte: 210px;
  --kaart-breedte: 96px;
  --kaart-padding: 12px 6px 11px;
  --favicon-grootte: 32px;
}

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

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: var(--lettergrootte);
  background: var(--achtergrond);
  color: var(--tekst);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* TOPBALK */
#topbalk {
  background: var(--balk-bg); color: var(--balk-tekst);
  padding: 10px 20px; display: flex; align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  position: sticky; top: 0; z-index: 100; gap: 16px;
  flex-shrink: 0;
}
#welkom-blok { display: flex; flex-direction: column; min-width: 260px; }
#welkom-tekst { font-size: 1.5em; font-weight: 600; line-height: 1.2; }
#datum-tijd { font-size: 1em; opacity: 0.90; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; margin-top: 2px; }
#versie-label { font-size: 0.65em; opacity: 0.45; letter-spacing: 0.04em; margin-top: 2px; }
#topbalk-midden { flex: 1; max-width: 520px; }
#zoekbalk-wrapper { position: relative; }
#zoekbalk {
  width: 100%; padding: 13px 44px 13px 46px; border: none;
  border-radius: 28px; font-size: 1em;
  background: rgba(255,255,255,0.18); color: #fff; outline: none;
  transition: background var(--overgang);
}
#zoekbalk::placeholder { color: rgba(255,255,255,0.72); }
#zoekbalk:focus { background: rgba(255,255,255,0.28); }
#zoek-icoon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); opacity: 0.75; pointer-events: none; }
#zoek-wis {
  display: none; position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.25); border: none; color: #fff; border-radius: 50%;
  width: 22px; height: 22px; font-size: 0.8em; cursor: pointer;
  align-items: center; justify-content: center;
  transition: background var(--overgang); line-height: 1;
}
#zoek-wis:hover { background: rgba(255,255,255,0.40); }
#zoek-wis.zichtbaar { display: flex; }
#topbalk-rechts { display: flex; align-items: center; gap: 6px; }
.weergave-knop {
  background: rgba(255,255,255,0.15); border: none; color: #fff;
  border-radius: var(--radius-klein); padding: 7px 11px; cursor: pointer;
  font-size: 1em; transition: background var(--overgang);
  display: flex; align-items: center; gap: 5px;
}
.weergave-knop:hover { background: rgba(255,255,255,0.28); }
.weergave-knop.actief { background: rgba(255,255,255,0.32); font-weight: 700; }
.weergave-label { font-size: 0.78em; font-weight: 600; }
#instellingen-knop, #uitloggen-knop {
  background: rgba(255,255,255,0.15); border: none; color: #fff;
  border-radius: var(--radius-klein); padding: 7px 11px; cursor: pointer;
  font-size: 1em; transition: background var(--overgang);
  text-decoration: none; display: flex; align-items: center;
}
#instellingen-knop:hover, #uitloggen-knop:hover { background: rgba(255,255,255,0.28); }

/* HOOFD LAYOUT */
#hoofd-layout { display: flex; flex: 1; }

/* SIDEBAR */
#sidebar {
  width: var(--sidebar-breedte); flex-shrink: 0;
  background: #ffffff; border-right: 1px solid var(--rand);
  position: sticky; top: 68px; height: calc(100vh - 68px);
  overflow-y: auto; padding: 14px 10px 40px;
  transition: opacity 0.25s;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: var(--rand); border-radius: 4px; }
body.sorteer-az #sidebar { opacity: 0.35; pointer-events: none; }
.sidebar-label { font-size: 0.70em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--tekst-zacht); padding: 2px 10px 10px; }
.filter-knop {
  display: flex; align-items: center; width: 100%;
  padding: 11px 12px; border: none; border-radius: var(--radius-klein);
  background: transparent; cursor: pointer; font-size: 1em; font-weight: 500;
  color: var(--tekst); text-align: left;
  transition: background var(--overgang), color var(--overgang);
  margin-bottom: 2px; line-height: 1.3;
}
.filter-knop:hover { background: var(--achtergrond); }
.filter-knop.actief { background: #dce8ff; color: var(--accent); font-weight: 700; }
.sidebar-scheiding { border: none; border-top: 1px solid var(--rand); margin: 8px 4px; }

/* GRID GEBIED */
#grid-gebied { flex: 1; min-width: 0; padding: 16px 24px 60px; }
#sorteer-balk { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-bottom: 14px; }
.sorteer-knop {
  padding: 5px 14px; border: 1.5px solid var(--rand); border-radius: 20px;
  background: var(--kaart-bg); color: var(--tekst-zacht);
  font-size: 0.82em; font-weight: 600; cursor: pointer; transition: all var(--overgang);
}
.sorteer-knop:hover { border-color: var(--accent); color: var(--accent); background: #eef4ff; }
.sorteer-knop.actief { background: var(--accent); color: #fff; border-color: var(--accent); }

/* CATEGORIE SECTIES */
.cat-sectie { margin-bottom: 24px; }
.cat-sectie-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 0 2px; }
.cat-sectie-naam { font-size: 0.88em; font-weight: 700; color: var(--tekst-zacht); text-transform: uppercase; letter-spacing: 0.06em; }
.cat-sectie-lijn { flex: 1; height: 1px; background: var(--rand); }
.letter-sectie { width: 100%; margin-bottom: 20px; }
.letter-header { font-size: 0.80em; font-weight: 700; color: var(--tekst-zacht); text-transform: uppercase; letter-spacing: 0.08em; padding: 6px 2px 8px; border-bottom: 1px solid var(--rand); margin-bottom: 10px; }
.links-grid { display: flex; flex-wrap: wrap; gap: 8px; }

/* LINK ITEMS */
.link-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; width: var(--kaart-breedte); padding: var(--kaart-padding);
  background: var(--kaart-bg); border: 1.5px solid var(--rand);
  border-radius: var(--radius); text-decoration: none; color: var(--tekst);
  font-size: 0.76em; font-weight: 500; text-align: center;
  transition: box-shadow var(--overgang), border-color var(--overgang), background var(--overgang);
  word-break: break-word; line-height: 1.3;
}
.link-item:hover { box-shadow: var(--schaduw-hover); border-color: var(--accent); background: #eef4ff; }

/* Favicon: standaard én custom geüpload icon worden identiek getoond */
.link-favicon {
  width: var(--favicon-grootte);
  height: var(--favicon-grootte);
  border-radius: 6px;
  object-fit: contain;
}

.link-naam { max-width: calc(var(--kaart-breedte) - 8px); hyphens: auto; }
body.geen-favicons .link-favicon { display: none; }

/* Compact weergave */
body.weergave-compact .link-item { flex-direction: row; width: auto; padding: 7px 13px; gap: 8px; }
body.weergave-compact .link-favicon { width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0; }
body.weergave-compact .link-naam { max-width: none; }

/* Lijst weergave */
body.weergave-lijst .links-grid { flex-direction: column; gap: 1px; }
body.weergave-lijst .link-item { flex-direction: row; width: 100%; padding: 9px 12px; gap: 10px; border-radius: var(--radius-klein); border: none; background: transparent; font-size: 0.92em; }
body.weergave-lijst .link-item:hover { background: var(--rand); box-shadow: none; border-color: transparent; }
body.weergave-lijst .link-favicon { width: 18px; height: 18px; border-radius: 3px; flex-shrink: 0; }
body.weergave-lijst .link-naam { max-width: none; text-align: left; }

/* Geen resultaten */
#geen-resultaten { display: none; text-align: center; padding: 60px 20px; color: var(--tekst-zacht); }

/* FAB */
#cat-toevoegen-fab {
  position: fixed; bottom: 28px; right: 28px; width: 52px; height: 52px;
  background: #d5d7d9; color: #3a3a3a; border: none; border-radius: 50%;
  font-size: 1.5em; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--overgang), color var(--overgang), box-shadow var(--overgang), transform var(--overgang);
  z-index: 90;
}
#cat-toevoegen-fab:hover { background: var(--accent); color: #fff; box-shadow: 0 6px 24px rgba(0,0,0,0.28); transform: scale(1.08); }
.lege-melding { font-size: 0.84em; color: var(--tekst-zacht); font-style: italic; padding: 6px 2px; }

/* Lettergrootte */
body.lf-klein      { --lettergrootte: 14px; }
body.lf-normaal    { --lettergrootte: 16px; }
body.lf-groot      { --lettergrootte: 17px; }
body.lf-zeer-groot { --lettergrootte: 21px; }

/* ── MODALS ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 500;
  align-items: center; justify-content: center;
}
.modal-overlay.zichtbaar { display: flex; }
.modal {
  background: var(--kaart-bg); border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0,0,0,0.22);
  padding: 26px 30px; min-width: 340px; max-width: 95vw;
  max-height: 90vh; overflow-y: auto;
}
.modal h2 { font-size: 1.1em; margin-bottom: 18px; color: var(--tekst); }
.modal label { display: block; font-size: 0.87em; font-weight: 600; color: var(--tekst-zacht); margin-bottom: 5px; margin-top: 14px; }
.modal label:first-of-type { margin-top: 0; }
.modal input[type="text"], .modal input[type="color"], .modal select {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--rand);
  border-radius: var(--radius-klein); font-size: 0.97em;
  color: var(--tekst); background: var(--achtergrond); outline: none;
  transition: border-color var(--overgang);
}
.modal input:focus, .modal select:focus { border-color: var(--accent); }
.modal input[type="color"] { padding: 4px 6px; height: 40px; cursor: pointer; }
.url-hint { font-size: 0.76em; color: var(--tekst-zacht); margin-top: 4px; }
.naam-ophalen-status { font-size: 0.76em; color: var(--accent); margin-top: 4px; min-height: 1.2em; }

/* Categoriebeheer modal */
#cat-beheer-modal .modal { min-width: 420px; max-width: 580px; }
.cat-beheer-lijst { border: 1px solid var(--rand); border-radius: var(--radius-klein); overflow: hidden; margin-top: 6px; }
.cat-beheer-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  border-bottom: 1px solid var(--rand); background: var(--kaart-bg);
  transition: background var(--overgang); cursor: default;
}
.cat-beheer-item:last-child { border-bottom: none; }
.cat-beheer-item:hover { background: var(--achtergrond); }
.cat-beheer-item.sleep-item-over { background: #eef4ff; border-top: 2px solid var(--accent); }
.cat-beheer-item.sleep-item-actief { opacity: 0.45; }
.cat-beheer-handvat { color: var(--tekst-zacht); cursor: grab; font-size: 1.1em; padding: 2px 4px; opacity: 0.35; flex-shrink: 0; transition: opacity var(--overgang); border-radius: 3px; }
.cat-beheer-handvat:hover { opacity: 1; background: var(--rand); }
.cat-beheer-handvat:active { cursor: grabbing; }
.cat-beheer-naam { flex: 1; font-size: 0.95em; font-weight: 500; }
.cat-beheer-telling { font-size: 0.78em; color: var(--tekst-zacht); margin-right: 4px; }
.cat-beheer-naam-invoer { flex: 1; padding: 5px 9px; border: 1.5px solid var(--accent); border-radius: 5px; font-size: 0.92em; outline: none; background: #eef4ff; }

/* Link-lijst in cat-inst-modal */
#cat-inst-modal .modal { min-width: 400px; max-width: 560px; }
.link-lijst { margin-top: 6px; border: 1px solid var(--rand); border-radius: var(--radius-klein); overflow: hidden; }
.link-lijst-item {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px;
  border-bottom: 1px solid var(--rand); background: var(--kaart-bg);
  transition: background var(--overgang); cursor: default;
}
.link-lijst-item:last-child { border-bottom: none; }
.link-lijst-item:hover { background: var(--achtergrond); }
.link-lijst-item.sleep-item-over { background: #eef4ff; border-top: 2px solid var(--accent); }
.link-lijst-item.sleep-item-actief { opacity: 0.45; }
.link-lijst-handvat { color: var(--tekst-zacht); cursor: grab; font-size: 1em; padding: 2px 3px; opacity: 0.35; flex-shrink: 0; transition: opacity var(--overgang); border-radius: 3px; }
.link-lijst-handvat:hover { opacity: 1; background: var(--rand); }
.link-lijst-handvat:active { cursor: grabbing; }
.link-lijst-favicon { width: 18px; height: 18px; border-radius: 3px; flex-shrink: 0; object-fit: contain; }
.link-lijst-naam { flex: 1; font-size: 0.88em; color: var(--tekst); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-lijst-url { font-size: 0.72em; color: var(--tekst-zacht); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.link-actie-knop { background: none; border: none; cursor: pointer; padding: 4px 6px; border-radius: 5px; color: var(--tekst-zacht); font-size: 0.9em; transition: background var(--overgang), color var(--overgang); flex-shrink: 0; }
.link-actie-knop:hover { background: var(--rand); color: var(--tekst); }
.link-actie-knop.verwijder:hover { background: #fde8e8; color: #c0392b; }
.link-actie-knop.heeft-icon { color: var(--accent); opacity: 0.8; }
.link-actie-knop-klein { background: none; border: none; cursor: pointer; padding: 5px 7px; border-radius: 5px; font-size: 0.88em; color: var(--tekst-zacht); transition: background var(--overgang), color var(--overgang); flex-shrink: 0; }
.link-actie-knop-klein:hover { background: var(--rand); color: var(--tekst); }
.link-actie-knop-klein.verwijder:hover { background: #fde8e8; color: #c0392b; }
.link-naam-invoer { flex: 1; padding: 4px 8px; border: 1.5px solid var(--accent); border-radius: 5px; font-size: 0.88em; outline: none; background: #eef4ff; }
.link-toevoegen-sectie { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rand); }
.link-toevoegen-sectie-titel { font-size: 0.82em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--tekst-zacht); margin-bottom: 10px; }

/* Toggles */
.toggle-rij { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--rand); }
.toggle-rij:last-of-type { border-bottom: none; }
.toggle-label { font-size: 0.93em; }
.toggle { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #ccc; border-radius: 26px; cursor: pointer; transition: background 0.2s; }
.toggle-slider::before { content: ''; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: transform 0.2s; box-shadow: 0 1px 4px rgba(0,0,0,0.18); }
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Knoppen */
.modal-knoppen { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.knop-primair { padding: 9px 20px; background: var(--accent); color: #fff; border: none; border-radius: var(--radius-klein); font-size: 0.97em; font-weight: 600; cursor: pointer; transition: background var(--overgang); }
.knop-primair:hover { background: var(--accent-hover); }
.knop-primair:disabled { opacity: 0.55; cursor: not-allowed; }
.knop-secundair { padding: 9px 16px; background: var(--rand); color: var(--tekst); border: none; border-radius: var(--radius-klein); font-size: 0.97em; cursor: pointer; transition: background var(--overgang); }
.knop-secundair:hover { background: #cdd1d9; }
.knop-gevaar { padding: 9px 16px; background: #fde8e8; color: #c0392b; border: none; border-radius: var(--radius-klein); font-size: 0.97em; font-weight: 600; cursor: pointer; transition: background var(--overgang); }
.knop-gevaar:hover { background: #f5c0c0; }
.knop-nieuw-cat { width: 100%; padding: 10px; margin-top: 12px; background: var(--achtergrond); border: 1.5px dashed var(--rand); border-radius: var(--radius-klein); font-size: 0.92em; color: var(--tekst-zacht); cursor: pointer; transition: border-color var(--overgang), color var(--overgang), background var(--overgang); text-align: center; }
.knop-nieuw-cat:hover { border-color: var(--accent); color: var(--accent); background: #eef4ff; }

/* Instellingen secties */
.inst-sectie { border-top: 1px solid var(--rand); margin-top: 18px; padding-top: 14px; }
.inst-sectie-titel { font-size: 0.80em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--tekst-zacht); margin-bottom: 10px; }
.inst-rij { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 7px 0; }
.inst-rij-label { font-size: 0.93em; flex: 1; }
.inst-rij-control { min-width: 140px; }

/* Handmatig box */
.handmatig-box { background: var(--achtergrond); border: 1.5px solid var(--rand); border-radius: var(--radius-klein); padding: 14px; margin-top: 10px; }
.handmatig-stap { display: flex; align-items: flex-start; gap: 10px; font-size: 0.86em; color: var(--tekst); line-height: 1.55; margin-bottom: 9px; }
.handmatig-stap:last-child { margin-bottom: 0; }
.stap-nr { background: var(--accent); color: #fff; border-radius: 50%; width: 20px; height: 20px; font-size: 0.8em; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }

/* Bevestig modal */
#bevestig-modal .modal { max-width: 380px; }
#bevestig-modal p { margin-bottom: 8px; line-height: 1.5; }
