/* =========================================================
   Ultimate Map Guide – kaartpagina
   ========================================================= */
:root {
  --map-water: #1a2c44;
  --map-land: #3b4250;
  --b-enter: #1f5fd1;      /* donkerblauw: toegankelijk */
  --b-closed: #a9d0f2;     /* lichtblauw: niet toegankelijk */
  --sidebar-w: 320px;
}

body.map-page { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.map-page .site-header { position: relative; flex-shrink: 0; }
.map-page .header-inner { max-width: none; }

.map-layout { flex: 1; display: flex; min-height: 0; }

/* ---------- Zijbalk ---------- */
.map-sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px;
  font-size: .92rem;
  position: relative;
}
.sb-section { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.sb-section:last-child { border-bottom: 0; }
.sb-section h2 { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 10px; }
.sb-head { display: flex; justify-content: space-between; align-items: center; }
.sb-mini button {
  background: none; border: 0; color: var(--teal); cursor: pointer; font: inherit; font-size: .8rem; padding: 2px 6px;
}
.sb-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 0 12px;
}
.sb-search:focus-within { border-color: var(--pink); }
.sb-search > i { color: var(--text-muted); flex-shrink: 0; font-size: .9rem; }
.sb-search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: inherit; padding: 10px 0; }

.search-results { margin-top: 8px; max-height: 240px; overflow-y: auto; }
.search-results button {
  width: 100%; text-align: left; display: flex; gap: 8px; align-items: center;
  background: none; border: 0; color: var(--text); font: inherit; cursor: pointer;
  padding: 7px 8px; border-radius: 8px;
}
.search-results button:hover, .search-results button:focus-visible { background: var(--surface); }
.search-results small { color: var(--text-muted); margin-left: auto; }
.search-results .empty { color: var(--text-muted); padding: 6px 8px; }

.cat-list li { margin-bottom: 4px; }
.cat-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 8px; cursor: pointer;
  user-select: none;
}
.cat-item:hover { background: var(--surface); }
.cat-item input { accent-color: var(--c); width: 16px; height: 16px; }
.cat-item .cat-dot {
  width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 20%, transparent); color: var(--c); font-weight: 800; font-size: .8rem;
}
.cat-item .count { margin-left: auto; color: var(--text-muted); font-size: .82rem; }
.cat-item:has(input:not(:checked)) { opacity: .5; }

.toggle { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.toggle input { accent-color: var(--pink); }

.progress { margin-top: 10px; font-size: .85rem; color: var(--text-muted); }
.progress .bar { height: 6px; background: var(--surface); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.progress .bar span { display: block; height: 100%; background: var(--grad-sunset); }

.legend li { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
.sw { width: 20px; height: 14px; border-radius: 3px; flex-shrink: 0; }
.sw-enter { background: var(--b-enter); outline: 1px solid #5d8fe8; }
.sw-closed { background: var(--b-closed); }
.sw-park { background: #3f5a3c; }
.sw-beach { background: #c9b27c; }
.sw-road { background: #e7c873; height: 5px; }
.sw-dot { width: 14px; height: 14px; border-radius: 50%; background: #b54738; border: 3px solid var(--b-enter); margin-inline: 3px; }
.sw-map-enter { background: #546e9e; outline: 1px solid #3d5684; }
.sw-map-closed { background: #acb8cc; outline: 1px solid #8f9cb2; }
.sw-own { background: linear-gradient(90deg, var(--b-enter) 50%, var(--b-closed) 50%); }
.hint a { color: var(--teal); }
.map-select {
  width: 100%; margin-bottom: 8px; padding: 8px; border-radius: 8px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); font: inherit;
}
.popup-area { color: var(--text-muted); font-size: .85rem; margin-top: -2px; }
.popup-src { color: var(--text-muted); font-size: .72rem; margin-top: 6px; border-top: 1px solid var(--border); padding-top: 6px; }
.search-results button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results small { flex-shrink: 0; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.editor summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
.editor summary::-webkit-details-marker { display: none; }
.editor summary::after {
  content: "\f078"; font-family: "Font Awesome 6 Free"; font-weight: 900;
  color: var(--text-muted); font-size: .8rem; transition: transform .2s;
}
.editor[open] summary::after { transform: rotate(180deg); }
.editor summary h2 { margin: 0; }
.editor fieldset { border: 0; padding: 0; margin: 8px 0; }
.hint { color: var(--text-muted); font-size: .82rem; margin: 6px 0; }
kbd { background: var(--surface-2); border-radius: 4px; padding: 0 5px; font-size: .78rem; }
.tool-opts { display: none; margin: 6px 0 10px; padding: 10px; background: var(--surface); border-radius: 8px; }
.tool-opts.active { display: block; }
.tool-opts select {
  width: 100%; margin-top: 4px; padding: 7px; border-radius: 6px;
  background: var(--bg-2); color: var(--text); border: 1px solid var(--border); font: inherit;
}
.editor-actions { display: grid; gap: 6px; margin-top: 8px; }
.btn-sm {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font: inherit; font-size: .85rem; cursor: pointer;
}
.btn-sm:hover { border-color: rgba(255,255,255,.25); }
.btn-sm.danger { color: #ff8fa8; }

.sidebar-close, .sidebar-open { display: none; }

/* ---------- Kaart ---------- */
.map-wrap { flex: 1; position: relative; min-width: 0; isolation: isolate; }
#map { position: absolute; inset: 0; background: var(--map-water); }
#map.tool-draw, #map.tool-marker { cursor: crosshair; }
#map.tool-toggle .leaflet-interactive, #map.tool-delete .leaflet-interactive { cursor: pointer; }

.coords {
  position: absolute; left: 10px; bottom: 10px; z-index: 500;
  background: rgba(13,10,26,.8); color: var(--text-muted);
  font: 12px/1 ui-monospace, Consolas, monospace;
  padding: 6px 8px; border-radius: 6px; pointer-events: none;
}
.map-loading {
  position: absolute; inset: 0; z-index: 600; display: grid; place-items: center;
  background: var(--map-water); color: var(--text-muted);
}
.map-loading[hidden] { display: none; }

/* Leaflet aanpassingen voor donker thema */
.leaflet-container { font-family: var(--font); }
.leaflet-bar a, .leaflet-bar a:hover { background: var(--bg-2); color: var(--text); border-color: var(--border); }
.leaflet-control-attribution { background: rgba(13,10,26,.75) !important; color: var(--text-muted) !important; font-size: 11px; }
.leaflet-control-attribution a { color: var(--teal) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 14px 16px; font-size: .9rem; line-height: 1.5; }
.leaflet-container a.leaflet-popup-close-button { color: var(--text-muted); }

.popup-cat { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--c); }
.popup-title { font-size: 1.05rem; font-weight: 700; margin: 2px 0 4px; }
.popup-desc { color: var(--text-muted); margin: 0 0 8px; }
.popup-meta { color: var(--text-muted); font-size: .78rem; font-family: ui-monospace, Consolas, monospace; }
.popup-found { display: flex; gap: 6px; align-items: center; cursor: pointer; margin-top: 6px; }
.popup-found input { accent-color: var(--teal); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.badge-enter { background: var(--b-enter); color: #fff; }
.badge-closed { background: var(--b-closed); color: #0d2238; }

/* Markeringen */
.mk {
  --c: #fff;
  width: 28px; height: 28px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--c);
  border: 2px solid #0d0a1a;
  box-shadow: 0 3px 8px rgba(0,0,0,.5);
  display: grid; place-items: center;
  transition: transform .15s;
}
.mk i { transform: rotate(45deg); color: #0d0a1a; font-size: 12px; line-height: 1; }
.mk:hover { transform: rotate(-45deg) scale(1.15); }
.mk.found { opacity: .4; filter: grayscale(.6); }
.mk-icon { background: none; border: 0; }

/* Labels */
.map-label { background: none; border: 0; }
.map-label span {
  display: block; transform: translate(-50%, -50%);
  white-space: nowrap; pointer-events: none;
  font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: #e9ecf3; font-size: 13px;
  text-shadow: 0 0 4px #000, 0 0 8px rgba(0,0,0,.7);
}
.map-label.k-poi span { font-size: 11px; letter-spacing: .08em; font-weight: 700; color: #f6f1ff; }
.map-label.k-water span { color: #8fb3d9; font-style: italic; letter-spacing: .2em; font-weight: 600; }

/* ---------- Mobiel ---------- */
@media (max-width: 820px) {
  .map-sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 1000;
    width: min(88vw, 340px);
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow);
    padding-top: 50px;
  }
  .map-sidebar.open { transform: none; }
  .sidebar-close {
    display: block; position: absolute; right: 10px; top: 8px;
    background: none; border: 0; color: var(--text); font-size: 1.3rem; cursor: pointer; width: 40px; height: 40px;
  }
  .sidebar-open {
    display: block; position: absolute; left: 10px; top: 10px; z-index: 500;
    background: var(--bg-2); color: var(--text); border: 1px solid var(--border);
    padding: 8px 14px; border-radius: 999px; font: inherit; font-weight: 600; cursor: pointer;
    box-shadow: var(--shadow);
  }
  .leaflet-top.leaflet-left { top: 50px; }
}

/* Gemarkeerd gebied (na klikken op een gebied in de zoekresultaten) */
.area-chip {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 500;
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-2); color: var(--text);
  border: 1px solid #ff4f8b; border-radius: 999px;
  padding: 6px 6px 6px 14px; box-shadow: var(--shadow);
  max-width: calc(100% - 140px);
}
.area-chip[hidden] { display: none; }
.area-chip > i { color: #ff4f8b; }
.area-chip .area-name { font-weight: 700; margin-right: 8px; }
.area-chip .area-meta { color: var(--text-muted); font-size: .82rem; }
.area-chip button {
  background: var(--surface-2); border: 0; color: var(--text); cursor: pointer;
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
}
.area-chip button:hover { background: #ff4f8b; }
@media (max-width: 820px) { .area-chip { top: 56px; max-width: calc(100% - 20px); } }
