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

:root {
  --bg:        #111;
  --bg2:       #1a1a1a;
  --bg3:       #222;
  --rand:      #333;
  --tekst:     #e8e8e8;
  --tekst2:    #999;
  --accent:    #c8a96e;
  --accent2:   #a08050;
  --gevaar:    #c0392b;
  --gevaar2:   #962d22;
  --success:   #27ae60;
  --radius:    6px;
  --schaduw:   0 2px 12px rgba(0,0,0,.5);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--tekst);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

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

/* ── Knoppen ── */
button, .knop {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  background: var(--bg3); color: var(--tekst);
  border: 1px solid var(--rand); border-radius: var(--radius);
  cursor: pointer; font-size: 14px; transition: background .15s, border-color .15s;
  white-space: nowrap;
}
button:hover  { background: #2a2a2a; border-color: #555; }
button.primair { background: var(--accent); color: #111; border-color: var(--accent); font-weight: 600; }
button.primair:hover { background: var(--accent2); border-color: var(--accent2); }
button.gevaar  { background: transparent; color: var(--gevaar); border-color: var(--gevaar); }
button.gevaar:hover  { background: var(--gevaar); color: #fff; }
button.klein   { padding: 4px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ── Formulier ── */
label { display: block; margin-bottom: 4px; font-size: 14px; color: var(--tekst2); }
input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%; padding: 9px 12px;
  background: var(--bg3); color: var(--tekst);
  border: 1px solid var(--rand); border-radius: var(--radius);
  font-size: 14px; transition: border-color .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
}
.veld { margin-bottom: 16px; }
.veld-hint { display: block; margin-top: 5px; font-size: 12px; color: var(--tekst2); }

/* ── Header / navigatie ── */
.site-header {
  background: var(--bg2); border-bottom: 1px solid var(--rand);
  padding: 14px 24px; display: flex; align-items: center; justify-content: space-between;
}
.site-header h1 { font-size: 18px; font-weight: 600; color: var(--accent); }
.site-header nav { display: flex; gap: 10px; align-items: center; }

/* ── Foutmelding ── */
.fout-melding, .fout {
  background: rgba(192,57,43,.15); border: 1px solid var(--gevaar);
  color: #e57368; padding: 10px 16px; border-radius: var(--radius);
  margin-bottom: 16px; display: none;
}
.leeg { color: var(--tekst2); font-style: italic; padding: 20px 0; }

/* ── Badge ── */
.badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 20px; font-size: 12px;
  background: var(--bg3); border: 1px solid var(--rand); color: var(--tekst2);
}
.badge.ww { background: rgba(200,169,110,.15); border-color: var(--accent); color: var(--accent); }

/* ══════════════════════════════════════════════
   LOGIN OVERLAY
══════════════════════════════════════════════ */
#login-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.85); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.login-kaart {
  background: var(--bg2); border: 1px solid var(--rand);
  border-radius: var(--radius); padding: 36px 40px;
  width: min(400px, 90vw); box-shadow: var(--schaduw);
}
.login-kaart h2 { font-size: 20px; margin-bottom: 24px; color: var(--accent); }

/* ══════════════════════════════════════════════
   ADMIN: ALBUMS
══════════════════════════════════════════════ */
.admin-main { max-width: 960px; margin: 0 auto; padding: 24px 20px; }

.sectie-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding-bottom: 12px;
  border-bottom: 1px solid var(--rand);
}
.sectie-header h2 { font-size: 17px; }

.album-kaart {
  background: var(--bg2); border: 1px solid var(--rand);
  border-radius: var(--radius); padding: 16px 20px;
  margin-bottom: 12px;
  display: flex; flex-direction: column;
}
.album-kaart-hoofd {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
}
.album-kaart-bewerk {
  border-top: 1px solid var(--rand);
  margin-top: 16px; padding-top: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.bewerk-velden {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px;
}
.album-kaart-thumb { flex-shrink: 0; }
.album-kaart-thumb img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; display: block; }
.album-kaart-thumb--klik { cursor: pointer; }
.album-kaart-thumb--klik img { transition: opacity .15s; }
.album-kaart-thumb--klik:hover img { opacity: .8; }
.album-kaart-info { display: flex; flex-direction: column; gap: 4px; min-width: 200px; flex: 1; }
.album-kaart-info strong { font-size: 15px; }
.album-titel-link { cursor: pointer; }
.album-titel-link:hover { color: var(--accent); }
.slotje { font-size: 13px; }
.omschrijving { font-size: 13px; color: var(--tekst2); }
.bezoeker-teller { font-size: 12px; color: var(--tekst2); }
.album-kaart-acties { display: flex; gap: 8px; flex-wrap: wrap; }

/* Formulier-sectie */
.formulier-sectie {
  background: var(--bg2); border: 1px solid var(--rand);
  border-radius: var(--radius); padding: 24px; margin-bottom: 24px;
}
.formulier-sectie h3 { margin-bottom: 20px; font-size: 16px; }
.formulier-acties { display: flex; gap: 10px; margin-top: 8px; }

/* Wachtwoord toggle */
.toggle-rij {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; cursor: pointer;
}
.toggle-rij input[type=checkbox] {
  width: 18px; height: 18px; cursor: pointer;
}

/* ══════════════════════════════════════════════
   ADMIN: FOTOBEHEER
══════════════════════════════════════════════ */
.fotobeheer-header {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 20px; padding-bottom: 12px;
  border-bottom: 1px solid var(--rand);
}
.fotobeheer-header h2 { font-size: 17px; }

.foto-grid-admin {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.foto-kaart {
  background: var(--bg2); border: 1px solid var(--rand);
  border-radius: var(--radius); overflow: hidden;
  position: relative;
}
.foto-kaart img.foto-thumb {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
}
.foto-placeholder {
  width: 100%; aspect-ratio: 1; display: flex;
  align-items: center; justify-content: center;
  background: var(--bg3); color: var(--tekst2); font-size: 13px;
}
.foto-info {
  padding: 8px 10px; display: flex;
  align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap;
}
.bestandsnaam {
  font-size: 11px; color: var(--tekst2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 80px;
}
.zichtbaar-toggle { display: flex; align-items: center; gap: 4px; font-size: 12px; cursor: pointer; }
.zichtbaar-toggle input { width: auto; }

/* Foto-kaart statussen */
.foto-kaart.verwerkt-error { border-color: var(--gevaar); }
.foto-kaart.verwerkt-pending { opacity: .7; }

/* Multi-select */
.foto-kaart.selecteer-modus { cursor: pointer; user-select: none; }
.foto-kaart.selecteer-modus .zichtbaar-toggle,
.foto-kaart.selecteer-modus .gevaar.klein { display: none; }
.foto-kaart.geselecteerd { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.foto-kaart.selecteer-modus::after {
  content: ''; position: absolute; top: 7px; right: 7px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.5); border: 2px solid rgba(255,255,255,.4);
  pointer-events: none;
}
.foto-kaart.selecteer-modus.geselecteerd::after {
  content: '✓';
  background: var(--accent); border-color: var(--accent);
  color: #111; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.bulk-actie-balk {
  background: rgba(200,169,110,.08); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 10px 14px;
  margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.bulk-acties { display: flex; gap: 8px; flex-wrap: wrap; }
#selectie-teller { font-size: 14px; color: var(--accent); font-weight: 600; min-width: 90px; }

/* Dropzone */
.dropzone {
  border: 2px dashed var(--rand); border-radius: var(--radius);
  padding: 32px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
  color: var(--tekst2); font-size: 14px; margin-bottom: 16px;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent); background: rgba(200,169,110,.06);
  color: var(--tekst);
}

/* Upload-lijst */
.upload-lijst { margin-bottom: 20px; }
.upload-rij {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--rand);
  font-size: 13px;
}
.upload-naam { min-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voortgang-balk { flex: 1; height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.voortgang-vulling { height: 100%; background: var(--accent); border-radius: 3px; transition: width .2s; }
.upload-status { min-width: 120px; color: var(--tekst2); font-size: 12px; }
.upload-rij.klaar .voortgang-vulling { background: var(--success); }
.upload-rij.fout  .voortgang-vulling { background: var(--gevaar); }

/* Instellingen-sectie (metadata, header) */
.instellingen-sectie {
  background: var(--bg2); border: 1px solid var(--rand);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.instellingen-sectie h3 { margin-bottom: 14px; font-size: 15px; }
.metadata-velden { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-bottom: 14px; }
.metadata-velden label { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--tekst); cursor: pointer; }
.metadata-velden input { width: auto; }

/* ══════════════════════════════════════════════
   ALBUM PUBLIEK
══════════════════════════════════════════════ */
#album-header {
  height: 260px; background-size: cover; background-position: center;
  display: none; margin-bottom: 24px;
  border-radius: 0 0 var(--radius) var(--radius);
}
.album-info { padding: 24px 24px 0; }
.album-info h1 { font-size: 24px; font-weight: 700; color: var(--tekst); margin-bottom: 6px; }
.album-info p  { color: var(--tekst2); font-size: 14px; }

.foto-grid-publiek {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 3px; padding: 20px;
}
.foto-item {
  position: relative; overflow: hidden; cursor: pointer;
  background: var(--bg3); border-radius: 3px;
}
.foto-item img {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
  transition: transform .3s, opacity .3s;
}
.foto-item:hover img { transform: scale(1.04); }
.foto-meta {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 24px 10px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,.75));
  color: #ddd; font-size: 11px; opacity: 0; transition: opacity .2s;
}
.foto-item:hover .foto-meta { opacity: 1; }

/* Wachtwoord-scherm */
#wachtwoord-scherm {
  display: none; max-width: 380px; margin: 80px auto;
  padding: 36px; background: var(--bg2);
  border: 1px solid var(--rand); border-radius: var(--radius);
}
#wachtwoord-scherm h2 { font-size: 18px; margin-bottom: 20px; color: var(--accent); }

/* ══════════════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════════════ */
#lightbox {
  display: none; position: fixed; inset: 0;
  background: #000; z-index: 500;
  flex-direction: column;
}
#lightbox.actief { display: flex; }
#lightbox[style*="display: flex"] { display: flex !important; }
#lightbox[style*="display:"] { display: flex; }

.lightbox-body {
  flex: 1; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  touch-action: none;
}
#lightbox-img {
  max-width: 100%; max-height: calc(100vh - 130px);
  object-fit: contain; display: block;
  user-select: none; will-change: transform;
}
#lightbox-loader {
  position: absolute; color: var(--tekst2); font-size: 14px;
}
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.1); border: none; color: #fff;
  font-size: 28px; padding: 12px 18px; cursor: pointer; border-radius: var(--radius);
  transition: background .15s;
}
.lightbox-nav:hover { background: rgba(255,255,255,.2); }
#lightbox-prev { left: 16px; }
#lightbox-next { right: 16px; }

.lightbox-footer {
  padding: 14px 20px; display: flex; flex-shrink: 0;
  align-items: center; justify-content: space-between;
  border-top: 1px solid var(--rand); gap: 16px; flex-wrap: wrap;
}
#lightbox-info-panel {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 48px 20px 16px;
  background: linear-gradient(transparent, rgba(0,0,0,.85));
  transform: translateY(100%);
  transition: transform .25s ease;
  pointer-events: none;
}
#lightbox-info-panel.actief { transform: translateY(0); pointer-events: auto; }
#lightbox-meta { display: flex; gap: 8px 20px; flex-wrap: wrap; font-size: 13px; color: #ccc; }
#lightbox-meta span strong { color: #fff; }
#lightbox-info-knop { visibility: hidden; }
#lightbox-info-knop.actief { background: var(--accent); border-color: var(--accent); color: #111; }
.lightbox-acties { display: flex; gap: 10px; }

/* ── Download-modal ── */
#download-modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.7); z-index: 600;
  align-items: center; justify-content: center;
}
#download-modal[style*="display: "] { display: flex !important; }
.download-kaart {
  background: var(--bg2); border: 1px solid var(--rand);
  border-radius: var(--radius); padding: 28px 32px;
  width: min(460px, 90vw); box-shadow: var(--schaduw);
}
.download-kaart h3 { margin-bottom: 20px; font-size: 17px; }
.download-optie {
  display: block; padding: 16px 18px; margin-bottom: 12px;
  background: var(--bg3); border: 1px solid var(--rand);
  border-radius: var(--radius); text-decoration: none; color: var(--tekst);
  transition: border-color .15s, background .15s;
}
.download-optie:hover { border-color: var(--accent); background: rgba(200,169,110,.06); color: var(--tekst); }
.download-optie.laden { opacity: .55; pointer-events: none; cursor: wait; }
.download-optie.laden strong::after { content: ' …'; }
.download-optie strong { display: block; font-size: 15px; margin-bottom: 4px; }
.download-optie span { font-size: 13px; color: var(--tekst2); }
.download-sluit { margin-top: 8px; }

/* ══════════════════════════════════════════════
   ADMIN LIGHTBOX
══════════════════════════════════════════════ */
#admin-lightbox {
  position: fixed; inset: 0; z-index: 800;
  display: flex; align-items: center; justify-content: center;
}
.admin-lightbox-overlay {
  position: absolute; inset: 0; background: #000;
}
.admin-lightbox-inhoud {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
}
.admin-lightbox-sluit {
  position: absolute; top: -44px; right: 0;
  background: transparent; border: none; color: #fff;
  font-size: 30px; line-height: 1; padding: 4px 10px; cursor: pointer;
}
.admin-lightbox-sluit:hover { color: var(--accent); background: transparent; }
.admin-lightbox-img-wrap {
  display: flex; align-items: center; justify-content: center;
}
#admin-lb-img-container {
  position: relative; display: inline-block; line-height: 0;
}
#admin-lightbox-img {
  max-width: min(90vw, 1400px); max-height: calc(90vh - 70px);
  display: block; transition: opacity .2s;
}
#admin-lightbox-loader {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  color: var(--tekst); background: rgba(0,0,0,.6);
  padding: 8px 18px; border-radius: var(--radius); font-size: 14px;
  pointer-events: none; white-space: nowrap;
}
.admin-lightbox-acties {
  margin-top: 14px; display: flex; gap: 12px;
}
.admin-lightbox-acties button:disabled { opacity: .4; cursor: not-allowed; }
.foto-kaart img.foto-thumb { cursor: zoom-in; }

/* ── Raster-overlay voor rechtzetten ── */
#admin-lb-rotatie-raster {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.55) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.55) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.18) 1px, transparent 1px);
  background-size: 100% 50%, 50% 100%, 33.333% 33.333%, 33.333% 33.333%;
  background-position: 0 50%, 50% 0, 0 0, 0 0;
}

/* ── Crop-overlay (eigen implementatie) ── */
#admin-crop-overlay {
  position: absolute; inset: 0;
  cursor: crosshair; user-select: none; overflow: hidden;
}
#crop-box {
  position: absolute;
  border: 1px solid rgba(255,255,255,.9);
  box-shadow: 0 0 0 9999px rgba(0,0,0,.55);
  cursor: move;
}
#crop-box::after {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.2) 1px, transparent 1px);
  background-size: 33.333% 33.333%;
}
.crop-handle {
  position: absolute; width: 10px; height: 10px;
  background: #fff; border: 1px solid rgba(0,0,0,.4);
}
.crop-handle[data-pos="nw"] { top:-5px;  left:-5px;              cursor: nw-resize; }
.crop-handle[data-pos="n"]  { top:-5px;  left:calc(50% - 5px);   cursor: n-resize;  }
.crop-handle[data-pos="ne"] { top:-5px;  right:-5px;             cursor: ne-resize; }
.crop-handle[data-pos="e"]  { top:calc(50% - 5px); right:-5px;   cursor: e-resize;  }
.crop-handle[data-pos="se"] { bottom:-5px; right:-5px;           cursor: se-resize; }
.crop-handle[data-pos="s"]  { bottom:-5px; left:calc(50% - 5px); cursor: s-resize;  }
.crop-handle[data-pos="sw"] { bottom:-5px; left:-5px;            cursor: sw-resize; }
.crop-handle[data-pos="w"]  { top:calc(50% - 5px); left:-5px;    cursor: w-resize;  }

/* ── Rotatie-balk onderaan ── */
.admin-lb-rotatie-balk {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 24px;
  background: rgba(0,0,0,.88);
  backdrop-filter: blur(8px);
  border-top: 1px solid #333;
}
.admin-lb-rotatie-balk input[type=range] {
  width: min(38vw, 360px); accent-color: var(--accent); cursor: pointer;
}
.rotatie-stap {
  padding: 6px 16px; font-size: 20px; line-height: 1; font-weight: 300;
}
#admin-lb-rotatie-waarde {
  min-width: 46px; font-variant-numeric: tabular-nums;
  color: var(--accent); font-size: 14px; text-align: center;
}
.rotatie-balk-acties { display: flex; gap: 8px; margin-left: 16px; }


/* ── Aanpassen-balk ── */
.admin-lb-aanpassen-balk {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px;
  background: rgba(0,0,0,.88);
  backdrop-filter: blur(8px);
  border-top: 1px solid #333;
}
.aanpassen-rijen {
  display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px;
  align-items: center;
}
.aanpassen-rij {
  display: contents;
}
.aanpassen-label {
  font-size: 12px; color: var(--tekst2); white-space: nowrap;
}
.aanpassen-rijen input[type=range] {
  width: min(22vw, 220px); accent-color: var(--accent); cursor: pointer;
}
.aanpassen-waarde {
  min-width: 36px; font-variant-numeric: tabular-nums;
  color: var(--accent); font-size: 12px; text-align: right;
}
.aanpassen-acties { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.aanpassen-acties button.actief { background: var(--accent); color: #000; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .album-kaart-hoofd { flex-direction: column; align-items: flex-start; }
  .album-kaart-acties { justify-content: flex-start; }
  .bewerk-velden { grid-template-columns: 1fr; }
  .foto-grid-publiek { grid-template-columns: repeat(2, 1fr); padding: 12px; }
  .foto-grid-admin   { grid-template-columns: repeat(2, 1fr); }
}
