/* ============================================================
   9. Simulator
   ============================================================ */
#simulator .sim-shell {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    grid-template-rows: minmax(0, 1fr);
    gap: 40px;
    height: 640px;
}

/* Map card — fixed height "strip", contained rather than overflowing */
.map-card {
    background: #ffffff00;
    padding: 12px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    display: flex;
}

.map-card svg {
    width: 100%;
    height: 100%;
    display: block;
}

.region {
    fill: var(--paper-dim);
    stroke: var(--paper);
    stroke-width: 2;
    cursor: pointer;
    transition: fill .15s;
}

.region:hover {
    fill: var(--teal);
}

.region.active {
    fill: var(--ink);
}

.region-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 600;
    fill: var(--ink);
    pointer-events: none;
    dominant-baseline: middle;
    text-anchor: middle;
    transition: fill .50s;
}

.label-group text.name {
    fill: var(--ink);
}

.label-group.active text.name {
    fill: var(--paper);
}

.label-group text.price {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    fill: var(--teal-deep);
    opacity: 0;
    text-anchor: middle;
    transition: opacity .15s;
}

.label-group.hovered text.price,
.label-group.active text.price {
    opacity: 1;
    fill: var(--gold);
}

/* Pricing panel — fixed height, flex column: header/slider/controls stay
   put, the manifest list scrolls internally, footer totals stay pinned */
.panel {
    border: 1px solid var(--line);
    background: var(--paper-dim);
    padding: 26px 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.panel h3 {
    font-size: 1rem;
    margin-bottom: 16px;
}

.weight-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.weight-row label {
    font-size: 0.85rem;
    opacity: 0.75;
}

.weight-row .w-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--teal-deep);
}

input[type=range] {
    width: 100%;
    accent-color: var(--teal-deep);
    margin: 8px 0 16px;
}

/* Select-all / clear-selection controls above the manifest */
.select-controls {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

/* Select-all strip — full-width checkbox bar */
.select-all-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.select-all-strip:hover {
    border-color: var(--teal);
    background: var(--paper);
}

.select-all-strip input[type=checkbox] {
    accent-color: var(--teal-deep);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
}

.select-controls {
    margin-bottom: 12px;
}

.link-btn {
    background: none;
    border: none;
    padding: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    color: var(--teal-deep);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.link-btn:hover {
    color: var(--gold);
}

/* Scrollable region list — this is what keeps the panel (and page) at a
   fixed height instead of growing as more regions get selected */
.manifest-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    margin-bottom: 14px;
    padding-right: 6px;
}

.manifest {
    list-style: none;
    padding: 0;
    margin: 0;
}

.manifest .empty {
    opacity: 0.5;
    font-style: italic;
    font-size: 0.85rem;
    padding: 8px 0;
}

/* One gemeente group: header (select-all-in-group + subtotal) plus its
   deelgemeentes indented underneath */
.manifest-group {
    margin-bottom: 2px;
}

/* Toggle button on each group header */
.g-toggle {
    background: none;
    border: none;
    padding: 0 4px;
    font-size: 1rem;
    line-height: 1;
    color: var(--ink);
    cursor: pointer;
    transition: transform .2s;
}

.g-toggle:hover {
    color: var(--teal-deep);
}

/* Collapsed state: hide the sublist */
.manifest-group.collapsed .manifest-sub {
    display: none;
}

/* Rotate arrow when collapsed */
.manifest-group.collapsed .g-toggle {
    transform: rotate(-90deg);
}

.manifest-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}

.g-left {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.86rem;
}

.g-left input[type=checkbox] {
    accent-color: var(--teal-deep);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.g-subtotal {
    font-size: 0.82rem;
    opacity: 0.85;
}

.manifest-sub {
    list-style: none;
    margin: 0;
    padding: 0 0 4px;
}

.manifest-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0 6px 4px;
    font-size: 0.83rem;
    opacity: 0.5;
    border-bottom: 1px dashed var(--line);
    transition: opacity .15s;
}

.manifest-item.selected {
    opacity: 1;
}

.manifest-item label {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    padding-left: 14px;
}

.manifest-item input[type=checkbox] {
    accent-color: var(--teal-deep);
    width: 13px;
    height: 13px;
    cursor: pointer;
    flex-shrink: 0;
}

.manifest-item .adr {
    opacity: 0.6;
    font-size: 0.9em;
}

.manifest .amt {
    font-family: 'JetBrains Mono', monospace;
}

/* Footer block (totals, discount, checkbox) stays pinned below the
   scrollable list rather than scrolling away with it */
.panel-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--line);
    padding-top: 4px;
}

.subtotal-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding-top: 8px;
}

.subtotal-row .amt {
    font-family: 'JetBrains Mono', monospace;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.82rem;
    opacity: 0.8;
    padding: 12px 0;
    border-top: 1px dashed var(--line);
    margin-top: 10px;
    cursor: pointer;
}

.check-row input[type=checkbox] {
    accent-color: var(--teal-deep);
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    cursor: pointer;
}

.welcome-budget-control p {
    margin: 6px 0 0 24px;
    color: var(--sim-muted);
    font-size: 0.72rem;
    line-height: 1.4;
}

.discount-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--gold);
    padding-top: 4px;
}

.discount-row .amt {
    font-family: 'JetBrains Mono', monospace;
}

.discount-badge {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    background: var(--gold);
    color: var(--paper);
    padding: 2px 7px;
    border-radius: 2px;
    margin-left: 8px;
    vertical-align: middle;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-top: 1px solid var(--ink);
    padding-top: 14px;
    margin-top: 8px;
}

.total-row .lab {
    font-size: 0.85rem;
    opacity: 0.7;
}

.total-row.first .lab {
    color: var(--gold);
    opacity: 1;
}

.total-row .amt {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.7rem;
    font-weight: 600;
    color: var(--teal-deep);
}

.total-row.first .amt {
    color: var(--gold);
}

.panel .note {
    font-size: 0.74rem;
    opacity: 0.55;
    margin-top: 16px;
}

/* Simulator — stack panel below map on small screens, drop the fixed
   height (each gets its own bounded height instead) */
@media (max-width: 900px) {
    #simulator .sim-shell {
        grid-template-columns: 1fr;
        height: auto;
    }

    .map-card {
        height: 320px;
    }

    .panel {
        height: 520px;
    }
}

/* Map-first campaign planner */
#simulator .sim-shell {
    position: relative;
    display: block;
    height: clamp(610px, 72vh, 700px);
    min-height: 0;
    border: 1px solid rgba(34, 88, 82, .22);
    border-radius: 12px;
    overflow: hidden;
    background: #dce7e4;
    box-shadow: 0 18px 45px rgba(5, 32, 29, .14);
}

.map-card {
    position: absolute;
    inset: 0;
    display: block;
    height: auto;
    padding: 0;
    overflow: hidden;
    background:
        linear-gradient(28deg, transparent 49.8%, rgba(255,255,255,.7) 50%, transparent 50.2%) 0 0 / 190px 140px,
        linear-gradient(105deg, transparent 49.5%, rgba(255,255,255,.62) 50%, transparent 50.5%) 35px 25px / 230px 160px,
        radial-gradient(ellipse at 72% 44%, rgba(138,202,173,.55) 0 16%, transparent 16.4%),
        #dbe7e6;
}
.map-card::before { content:""; position:absolute; inset:0; background:linear-gradient(90deg, rgba(30,56,61,.1), transparent 36%), repeating-linear-gradient(0deg, transparent 0 72px, rgba(45,107,99,.07) 73px 74px); pointer-events:none; }
.map-card::after { content:""; position:absolute; inset:0; background:linear-gradient(90deg, rgba(30,56,61,.08), transparent 32%); pointer-events:none; }
.map-card svg { position:absolute; inset:96px 52px 62px 365px; width:calc(100% - 417px); height:calc(100% - 158px); z-index:1; filter:drop-shadow(0 10px 9px rgba(13,45,42,.12)); }
.region { fill: rgba(244,251,247,.74); stroke: rgba(35,89,81,.48); stroke-width: 1.15; }
.region:hover { fill:#9bdbc2; }
.region.active { fill:#008e88; stroke:#006f6a; }
.region-label { font-family:'IBM Plex Sans', sans-serif; font-size:12px; fill:#1f4541; text-shadow:0 1px 2px rgba(255,255,255,.85); }
.label-group.active text.name { fill:#fff; }
.label-group text.price { fill:#075e5a; font-size:10px; }
.label-group.active text.price { fill:#e6fff3; }

.map-toolbar { position:absolute; z-index:2; left:375px; top:24px; display:flex; align-items:start; justify-content:space-between; gap:28px; width:calc(100% - 430px); color:#173d3a; }
.map-kicker { display:block; color:#008e88; font-size:.68rem; font-weight:600; letter-spacing:.1em; text-transform:uppercase; }
.map-toolbar h3, .selection-panel h3 { margin:3px 0 2px; font-family:'IBM Plex Sans',sans-serif; font-size:1.2rem; color:#173d3a; }
.map-toolbar p { margin:0; font-size:.82rem; color:#476561; }
.selection-count { padding:9px 11px; border:1px solid rgba(33,96,89,.16); border-radius:5px; background:rgba(255,255,255,.88); font:600 .75rem 'IBM Plex Sans',sans-serif; white-space:nowrap; }
.map-summary { position:absolute; z-index:3; right:22px; bottom:22px; padding:13px 16px; border-radius:5px; background:#007c78; color:#fff; min-width:165px; box-shadow:0 5px 16px rgba(0,61,58,.22); }
.map-summary span { display:block; font-size:.68rem; opacity:.8; text-transform:uppercase; letter-spacing:.08em; }.map-summary strong { font:600 1.15rem 'JetBrains Mono',monospace; }
.map-legend { position:absolute; left:375px; bottom:24px; z-index:2; display:flex; gap:16px; padding:9px 11px; border-radius:5px; background:rgba(255,255,255,.86); color:#345a56; font-size:.72rem; }.legend-dot { display:inline-block; width:9px; height:9px; border-radius:50%; background:#effbf5; border:1px solid #2e776d; }.legend-dot.is-active { background:#008e88; }
.map-zoom { position:absolute; z-index:3; right:22px; top:24px; display:flex; flex-direction:column; overflow:hidden; border-radius:5px; background:#fff; box-shadow:0 2px 8px rgba(0,0,0,.14); }.map-zoom b { width:34px; height:32px; display:grid; place-items:center; color:#24534f; border-bottom:1px solid #d5e0de; font-size:18px; }.map-zoom b:last-child { border:0; }

.selection-panel { position:absolute; z-index:5; inset:0 auto 0 0; width:350px; padding:24px 20px 18px; display:flex; flex-direction:column; background:rgba(255,255,255,.98); box-shadow:5px 0 20px rgba(21,61,57,.16); color:#1e3634; }
.selection-panel-head { display:flex; align-items:start; justify-content:space-between; padding-bottom:16px; border-bottom:1px solid #dce7e4; }.selection-panel .link-btn { color:#007c78; }.selection-panel .weight-row { margin-top:18px; }.selection-panel .weight-row label { color:#40615d; }.selection-panel .weight-row .w-val { color:#007c78; }.selection-panel input[type=range] { accent-color:#008e88; margin-bottom:12px; }.selection-panel .select-controls { padding-bottom:10px; border-bottom:1px solid #dce7e4; }.selection-panel .manifest-scroll { margin-top:8px; }.selection-panel .manifest-item, .selection-panel .manifest-group-header { border-color:#dce7e4; }.selection-panel .panel-footer { border-color:#dce7e4; }.selection-panel .total-row { border-color:#40615d; }.selection-panel .total-row .amt { color:#007c78; }.selection-panel .discount-row { color:#b47722; }.selection-panel .discount-badge { background:#e2a540; color:#fff; }

@media (max-width: 900px) { #simulator .sim-shell { height:auto; min-height:0; overflow:visible; display:flex; flex-direction:column; border-radius:10px; } .map-card { position:relative; order:1; height:440px; } .selection-panel { position:relative; order:2; width:100%; height:540px; box-shadow:none; } .map-card svg { inset:90px 24px 48px; width:calc(100% - 48px); height:calc(100% - 138px); } .map-toolbar { left:22px; top:18px; width:calc(100% - 82px); }.map-legend { left:20px; bottom:18px; }.map-summary { right:18px; bottom:16px; }.map-zoom { right:18px; top:18px; } }

@media (max-width: 560px) { #simulator .sim-shell { margin:0 -10px; } .map-card { height:400px; } .map-toolbar h3 { font-size:1rem; }.map-toolbar p { max-width:25ch; }.selection-count { display:none; }.map-card svg { inset:94px 14px 65px; width:calc(100% - 28px); height:calc(100% - 159px); }.map-legend { left:14px; bottom:18px; gap:10px; font-size:.67rem; }.map-summary { right:14px; bottom:14px; min-width:135px; padding:10px 12px; }.selection-panel { height:560px; padding:20px 16px 16px; }.map-zoom { right:14px; top:14px; } }

/* Full-width simulator strip */
#simulator { padding:0; }
#simulator .simulator-wrap { max-width:none; padding:0; }
#simulator .section-head { display:none; }
#simulator .sim-shell { border-radius:0; height:clamp(720px, 74vh, 900px); }
.map-card {
    background:
        linear-gradient(28deg, transparent 49.8%, rgba(255,255,255,.7) 50%, transparent 50.2%) 0 0 / 190px 140px,
        linear-gradient(105deg, transparent 49.5%, rgba(255,255,255,.62) 50%, transparent 50.5%) 35px 25px / 230px 160px,
        #dbe7e6;
}
.selection-panel { width:370px; padding:28px 24px 20px; }
.selection-panel-head p { margin:5px 0 0; max-width:27ch; color:#5d7672; font-size:.78rem; line-height:1.45; }
.map-card svg { inset:82px 8vw 56px 410px; width:calc(100% - 410px - 16vw); height:calc(100% - 138px); }
.map-card svg { cursor:grab; touch-action:none; }
.map-card svg.is-panning { cursor:grabbing; }
.map-card,
.map-card svg,
.map-card svg * { -webkit-user-select:none; user-select:none; }
.region { cursor:inherit; }

/* Give the draggable map a little more usable space around the edges. */
.map-card svg { inset:62px 4vw 38px 382px; width:calc(100% - 382px - 8vw); height:calc(100% - 100px); }
.map-card svg { transform:scaleX(.84); transform-origin:center; }
.map-toolbar { left:410px; width:calc(100% - 480px); }
.map-legend { left:410px; }
.map-zoom[aria-hidden="true"] { display:none; }
.map-zoom-actions { right:24px; top:24px; }
.map-zoom button { width:34px; height:32px; display:grid; place-items:center; padding:0; border:0; border-bottom:1px solid #d5e0de; background:#fff; color:#24534f; font:600 18px/1 'IBM Plex Sans',sans-serif; cursor:pointer; }
.map-zoom button:last-child { border-bottom:0; }
.map-zoom button:hover { background:#eaf5f2; color:#007c78; }

@media (max-width: 900px) { #simulator { padding:48px 0; } #simulator .simulator-wrap { padding:0 18px; } #simulator .sim-shell { height:auto; } .map-card svg { inset:90px 24px 48px; width:calc(100% - 48px); height:calc(100% - 138px); transform:none; } .map-toolbar { left:22px; width:calc(100% - 82px); }.map-legend { left:20px; }.selection-panel { width:100%; } }

@media (max-width: 560px) { #simulator .simulator-wrap { padding:0 10px; } #simulator .sim-shell { margin:0; } .map-zoom-actions { right:14px; top:14px; } }

/* Keep the map calm: a region gets its name only after it is selected.
   Prices remain in the calculation panel, where they are easier to scan. */
.label-group .region-label { opacity:0; transition:opacity .18s ease, fill .18s ease; }
.label-group.active .region-label { opacity:1; }
.label-group text.price,
.label-group.active text.price,
.label-group.hovered text.price { opacity:0; }
.region-label { font-size:10px; font-weight:600; }

/* Simulator palette — follows the site's existing day/night theme. */
:root {
    --sim-map: rgba(16, 25, 30, .66);
    --sim-region: #233842;
    --sim-region-border: rgba(143, 198, 223, .38);
    --sim-region-hover: #315b6d;
    --sim-region-active: #093f59;
    --sim-panel: #17252c;
    --sim-panel-line: rgba(143, 198, 223, .16);
    --sim-text: #f4f7f8;
    --sim-soft: #a9bdc7;
    --sim-accent: #2f7694;
    --sim-card: #233842;
}

[data-theme="light"] {
    --sim-map: rgba(232, 243, 247, .76);
    --sim-region: rgba(247, 250, 251, .92);
    --sim-region-border: rgba(9, 63, 89, .38);
    --sim-region-hover: #d7eaf1;
    --sim-region-active: #093f59;
    --sim-panel: #f7fafb;
    --sim-panel-line: rgba(9, 63, 89, .16);
    --sim-text: #18262d;
    --sim-soft: #61747e;
    --sim-accent: #4b8da7;
    --sim-card: #eaf1f4;
}

#simulator .sim-shell { background:var(--sim-map); border-color:var(--sim-panel-line); box-shadow:0 18px 45px rgba(0,0,0,.2); }
.map-card { background:var(--sim-map); backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px); }
.map-card::before {
    z-index:0;
    background:transparent;
}
.map-card::after { background:transparent; }
.region { fill:var(--sim-region); stroke:var(--sim-region-border); }
.region:hover { fill:var(--sim-region-hover); }
.region.active { fill:var(--sim-region-active); stroke:var(--sim-accent); }
.region.active { stroke-width:1.45; }
.region.active { stroke:#10191e; }
[data-theme="light"] .region.active { stroke:#f7fafb; }
[data-theme="light"] .label-group.active text.name,
[data-theme="light"] .label-group.active text.price {
    fill:#f7fafb;
    text-shadow:0 1px 2px rgba(9,63,89,.45);
}
.region-label { fill:var(--sim-text); text-shadow:0 1px 2px rgba(0,0,0,.35); }
.label-group.active text.name { fill:var(--sim-text); }
.map-toolbar { color:var(--sim-text); }.map-toolbar p { color:var(--sim-soft); }.map-kicker { color:var(--sim-accent); }
.selection-count, .map-legend, .map-zoom, .map-zoom button { background:var(--sim-card); color:var(--sim-text); border-color:var(--sim-panel-line); }
.map-summary { background:var(--sim-region-active); color:var(--sim-text); }
[data-theme="light"] .map-summary { color:#f7fafb; }
.legend-dot { background:var(--sim-region); border-color:var(--sim-soft); }.legend-dot.is-active { background:var(--sim-region-active); }
.map-zoom button:hover { background:var(--sim-region-hover); color:var(--sim-accent); }
.selection-panel { background:var(--sim-panel); color:var(--sim-text); }
.selection-panel-head, .selection-panel .select-controls, .selection-panel .manifest-item, .selection-panel .manifest-group-header, .selection-panel .panel-footer { border-color:var(--sim-panel-line); }
.selection-panel h3 { color:var(--sim-text); }.selection-panel-head p, .selection-panel .weight-row label { color:var(--sim-soft); }
.selection-panel .link-btn, .selection-panel .weight-row .w-val { color:var(--sim-accent); }
.selection-panel input[type=range], .selection-panel input[type=checkbox] { accent-color:var(--sim-accent); }
.selection-panel .total-row { border-color:var(--sim-text); }.selection-panel .total-row .amt { color:var(--sim-accent); }
.selection-panel .discount-row { color:var(--sim-accent); }.selection-panel .discount-badge { background:var(--sim-accent); color:var(--sim-panel); }
