/* ============================================================
   VOORSCHOTEN ELECTION DISPLAY — FRONTEND
   Broadcast-grade dark UI, TV-ready
   ============================================================ */

/* ─── RESET & ROOT ─────────────────────────────────────────── */
:root {
    --vs-bg:      #0a0e1a;
    --vs-accent:  #f5c842;
    --vs-text:    #ffffff;
    --vs-surface: rgba(255,255,255,0.05);
    --vs-border:  rgba(255,255,255,0.1);
    --vs-done:    #22c55e;
    --vs-counting:#f59e0b;
    --vs-radius:  8px;
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

.vs-screen {
    background: var(--vs-bg);
    color: var(--vs-text);
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* ─── HEADER ───────────────────────────────────────────────── */
.vs-screen-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px 32px;
    background: rgba(0,0,0,0.4);
    border-bottom: 2px solid var(--vs-accent);
    flex-shrink: 0;
    z-index: 10;
}

.vs-header-overlay {
    position: absolute;
    top: 0; left: 0; right: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.75) 0%, transparent 100%);
    border-bottom: none;
}

.vs-gemeente-wordmark { height: 32px; width: auto; }
.vs-wordmark-text {
    font-size: 18px;
    font-weight: 800;
    fill: var(--vs-accent);
    letter-spacing: 3px;
    font-family: 'Segoe UI', Arial, sans-serif;
}

.vs-screen-title {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    opacity: 0.85;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.vs-live-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #dc2626;
    color: white;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 2px;
    padding: 6px 14px;
    border-radius: 4px;
    text-transform: uppercase;
}

.vs-live-dot {
    width: 8px; height: 8px;
    background: white;
    border-radius: 50%;
    animation: vs-blink 1s ease-in-out infinite;
}

@keyframes vs-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ─── TIMESTAMP ─────────────────────────────────────────────── */
.vs-timestamp {
    position: absolute;
    bottom: 12px; right: 20px;
    font-size: 11px;
    opacity: 0.35;
}

/* ─── LOADING ───────────────────────────────────────────────── */
.vs-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    opacity: 0.5;
}

.vs-spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--vs-accent);
    border-radius: 50%;
    animation: vs-spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes vs-spin {
    to { transform: rotate(360deg); }
}

/* ════════════════════════════════════════════════════════════
   SCHERM 1: ZETELVERDELING
   ════════════════════════════════════════════════════════════ */

/* Stats balk */
.vs-zetels-stats {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--vs-border);
    flex-shrink: 0;
}

.vs-stat {
    flex: 1;
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-right: 1px solid var(--vs-border);
}

.vs-stat:last-child { border-right: none; }

.vs-stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.5;
}

.vs-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--vs-accent);
}

/* Partijen display */
.vs-parties-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    padding: 0;
}

.vs-party-bar-row {
    display: grid;
    grid-template-columns: 220px 1fr 80px;
    align-items: center;
    gap: 12px;
    padding: 14px 28px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    transition: background 0.2s;
}

.vs-party-bar-row:hover { background: rgba(255,255,255,0.03); }

.vs-party-bar-identity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vs-party-logo-img {
    width: auto;
    height: 36px;
    max-width: 56px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.vs-party-logo-fallback {
    width: 36px; height: 36px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.vs-party-name-full {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
}

.vs-party-abbr-small {
    font-size: 11px;
    opacity: 0.5;
}

/* Dubbele balk kolom */
.vs-bars-col {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Nieuwe zetels — dikke balk */
.vs-bar-row-new {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vs-bar-new-track {
    flex: 1;
    height: 20px;
    background: rgba(255,255,255,0.07);
    border-radius: 4px;
    overflow: hidden;
}

.vs-bar-new-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
    min-width: 2px;
}

/* Oude zetels — dunnere balk eronder */
.vs-bar-row-prev {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vs-bar-prev-track {
    flex: 1;
    height: 10px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
}

.vs-bar-prev-fill {
    height: 100%;
    background: var(--vs-bar-prev, rgba(255,255,255,0.35));
    border-radius: 3px;
    min-width: 2px;
}

/* Zetels label naast de balken */
.vs-bar-seats-label {
    font-size: 22px;
    font-weight: 900;
    color: var(--vs-accent);
    min-width: 32px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    text-shadow: 0 0 12px rgba(245,200,66,0.35);
}

.vs-bar-seats-prev {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.45;
    color: var(--vs-text);
}

/* Percentage kolom */
.vs-party-pct-col {
    font-size: 14px;
    font-weight: 600;
    opacity: 0.75;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
    top: 0; left: 0;
    height: 100%;
    border-radius: 3px;
    background: #444 !important;
    opacity: 1;
}

/* ════════════════════════════════════════════════════════════
   SCHERM 2: STEMBUREAUS TABEL
   ════════════════════════════════════════════════════════════ */

.vs-screen-stembureaus {
    overflow: auto;
}

.vs-stations-header {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 8px 16px;
    background: rgba(0,0,0,0.3);
    border-bottom: 1px solid var(--vs-border);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 5;
}

.vs-header-name  { width: 260px; flex-shrink: 0; }
.vs-header-total { width: 80px; text-align: right; flex-shrink: 0; }
.vs-header-party {
    flex: 1;
    text-align: center;
    min-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vs-header-status { width: 100px; text-align: center; flex-shrink: 0; }

.vs-stations-table {
    flex: 1;
    overflow: auto;
}

.vs-station-row {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    transition: background 0.15s;
}

.vs-station-row:hover { background: rgba(255,255,255,0.03); }

.vs-station-row.is-done {
    background: rgba(34,197,94,0.06);
}

@keyframes vs-row-counting-done {
    0%,100% { background: rgba(0,0,0,0); }
    50%      { background: var(--vs-pulse, #22c55e); opacity: 0.25; }
}

.vs-station-row.is-counting-done {
    animation: vs-row-counting-done 2s ease-in-out infinite;
}

.vs-status-done {
    background: color-mix(in srgb, var(--vs-done, #22c55e) 18%, transparent);
    color: var(--vs-done, #22c55e);
}

.vs-status-counting {
    background: color-mix(in srgb, var(--vs-busy, #DAAA00) 15%, transparent);
    color: var(--vs-busy, #DAAA00);
    animation: vs-count-pulse 2s ease-in-out infinite;
}

.vs-station-row-name {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.vs-station-nr-badge {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.vs-station-row.is-done .vs-station-nr-badge {
    background: rgba(34,197,94,0.25);
    color: #4ade80;
}

.vs-station-row-name-text {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.vs-station-row-total {
    width: 80px;
    flex-shrink: 0;
    text-align: right;
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--vs-accent);
}

.vs-station-row-party-votes {
    flex: 1;
    text-align: center;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    min-width: 50px;
    border-left: 1px solid rgba(255,255,255,0.08);
    padding: 0 4px;
}

.vs-station-row-status {
    width: 100px;
    flex-shrink: 0;
    text-align: center;
}

.vs-status-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 20px;
}

@keyframes vs-count-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ════════════════════════════════════════════════════════════
   SCHERM 3: KAART
   ════════════════════════════════════════════════════════════ */

.vs-screen-kaart {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.vs-leaflet-map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Leaflet container — geen position:fixed op parents! */
.vs-leaflet-map .leaflet-container {
    width: 100%;
    height: 100%;
    background: #e8e8e8;
}

.vs-map-progress {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(10,14,26,0.88);
    border: 1px solid var(--vs-border);
    border-radius: 40px;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    backdrop-filter: blur(10px);
    min-width: 280px;
}

.vs-map-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
}

.vs-map-progress-bar::after {
    content: '';
    display: block;
    height: 100%;
    width: inherit;
    background: var(--vs-done);
    border-radius: 3px;
    transition: width 0.6s ease;
}

.vs-map-progress-label {
    color: var(--vs-text);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0.85;
}

/* Map legend */
.vs-map-legend {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-left: auto;
}

.vs-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    opacity: 0.8;
}

.vs-legend-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.vs-legend-counting {
    background: var(--vs-counting);
    box-shadow: 0 0 0 3px rgba(245,158,11,0.3);
    animation: vs-pulse-legend 1.5s ease-in-out infinite;
}

.vs-legend-done {
    background: var(--vs-done);
    box-shadow: 0 0 0 3px rgba(34,197,94,0.3);
}

@keyframes vs-pulse-legend {
    0%, 100% { box-shadow: 0 0 0 3px rgba(245,158,11,0.3); }
    50%       { box-shadow: 0 0 0 7px rgba(245,158,11,0.1); }
}

/* Leaflet marker overrides */
.vs-map-marker-counting {
    width: 20px; height: 20px;
    background: var(--vs-dot-busy, #DAAA00);
    border-radius: 50%;
    border: 3px solid rgba(218, 170, 0, 0.4);
    position: relative;
}

.vs-map-marker-done {
    width: 20px; height: 20px;
    background: var(--vs-dot-done, #22c55e);
    border-radius: 50%;
    border: 3px solid rgba(34, 197, 94, 0.4);
    animation: vs-marker-done-pulse 3s ease-in-out infinite;
}

@keyframes vs-marker-pulse {
    0%   { box-shadow: 0 0 0 0px  rgba(218, 170, 0, 0.5); }
    60%  { box-shadow: 0 0 0 10px rgba(218, 170, 0, 0.05); }
    100% { box-shadow: 0 0 0 0px  rgba(218, 170, 0, 0); }
}

@keyframes vs-marker-done-pulse {
    0%   { box-shadow: 0 0 0 0px  rgba(34, 197, 94, 0.5); }
    60%  { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0.05); }
    100% { box-shadow: 0 0 0 0px  rgba(34, 197, 94, 0); }
}

/* Actieve marker — toont welk stembureau in het infopaneel staat */
.vs-marker-active {
    border: 3px solid rgba(255,255,255,0.7) !important;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.2);
    animation: vs-marker-active-pulse 2.5s ease-in-out infinite !important;
}

@keyframes vs-marker-active-pulse {
    0%   { box-shadow: 0 0 0 2px rgba(0,0,0,0.15), 0 0 0 3px rgba(255,255,255,0.3); }
    60%  { box-shadow: 0 0 0 2px rgba(0,0,0,0.05), 0 0 0 8px rgba(255,255,255,0); }
    100% { box-shadow: 0 0 0 2px rgba(0,0,0,0.15), 0 0 0 3px rgba(255,255,255,0.3); }
}

/* Leaflet popup */
.vs-popup-name {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 4px;
}

.vs-popup-status {
    font-size: 12px;
}

.vs-popup-status.done    { color: #22c55e; }
.vs-popup-status.counting { color: #DAAA00; }

/* Leaflet dark tiles filter */
.leaflet-tile {
    filter: brightness(0.7) contrast(1.1) saturate(0.5);
}

/* ─── PROGRESS BAR FIX ─────────────────────────────────────── */
.vs-map-progress-bar {
    position: relative;
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
}

#vs-map-progress-bar {
    height: 100%;
    background: var(--vs-done);
    border-radius: 3px;
    transition: width 0.6s ease;
    min-width: 0;
}

/* ─── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 1100px) {
    .vs-party-bar-row {
        grid-template-columns: 180px 50px 1fr 70px;
    }
    .vs-party-votes-col { display: none; }
}

/* ─── GEMEENTELOGO IN HEADER ────────────────────────────── */
.vs-gemeente-logo-wrap {
    display: flex;
    align-items: center;
}

.vs-gemeente-logo-img {
    max-height: 48px;
    max-width: 180px;
    object-fit: contain;
    display: block;          /* Geen inline witruimte */
    min-width: 0;            /* Geen minimumbreedte */
    background: transparent; /* Nooit wit als fallback */
}

/* Verberg gebroken afbeeldingen volledig */
.vs-gemeente-logo-img[src=""],
.vs-gemeente-logo-img:not([src]) {
    display: none;
}

/* ─── INFOPANEEL LINKSONDER ─────────────────────────────── */
.vs-map-infopanel {
    position: absolute;
    bottom: 32px;
    right: 24px;
    left: auto;
    z-index: 800;
    width: 500px;
}

.vs-map-infopanel-inner {
    background: color-mix(in srgb, var(--vs-panel-bg, #0a0e1a) calc(var(--vs-panel-opacity, 0.72) * 100%), transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--vs-panel-text, #ffffff);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animatie: exit → zacht vervagen naar links */
.vs-map-infopanel-inner.vs-panel-exit {
    opacity: 0;
    transform: translateX(-8px);
}

/* Animatie: enter → zacht inschuiven van rechts */
.vs-map-infopanel-inner.vs-panel-enter {
    animation: panelSlideIn 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes panelSlideIn {
    from { opacity: 0; transform: translateX(10px); }
    to   { opacity: 1; transform: translateX(0); }
}

.vs-infopanel-nr {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #0a0e1a;
    color: #f5c842;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 10px;
}

.vs-infopanel-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vs-infopanel-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--vs-panel-text, #ffffff);
    line-height: 1.2;
    margin-bottom: 4px;
}

.vs-infopanel-status {
    font-size: 12px;
    font-weight: 600;
}

.vs-panel-done    { color: #4ade80; }
.vs-panel-counting { color: #DAAA00; }

.vs-infopanel-votes {
    font-size: 12px;
    color: rgba(255,255,255,0.55);
    margin-bottom: 8px;
}

/* Mini-bars per partij */
.vs-panel-bar-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.vs-panel-bar-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.8);
    width: 40px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vs-panel-bar-track {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.12);
    border-radius: 3px;
    overflow: hidden;
}

.vs-bar-new-fill,
.vs-bar-prev-fill,
.vs-panel-bar-fill {
    height: 100%;
    border-radius: 3px;
}

.vs-panel-bar-val {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    width: 36px;
    text-align: right;
    flex-shrink: 0;
}

/* Dots navigatie */
.vs-infopanel-dots {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 10px;
}

.vs-panel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(207,21,45,0.4);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.vs-panel-dot.active {
    background: #cf152d;
    transform: scale(1.3);
}

.vs-panel-dot:hover {
    background: rgba(207,21,45,0.7);
}

/* ─── KAART FULLSCREEN — verberg WP chrome ──────────────────── */
body.vs-kaart-fullscreen #wpadminbar,
body.vs-kaart-fullscreen header,
body.vs-kaart-fullscreen footer,
body.vs-kaart-fullscreen .site-header,
body.vs-kaart-fullscreen .site-footer,
body.vs-kaart-fullscreen .nav-bar,
body.vs-kaart-fullscreen .elementor-section-wrap > *:not(.elementor-section:has(.vs-screen-kaart)),
body.vs-kaart-fullscreen .wp-site-blocks > *:not(:has(.vs-screen-kaart)) {
    display: none !important;
}

body.vs-kaart-fullscreen,
body.vs-kaart-fullscreen html {
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

body.vs-kaart-fullscreen .vs-screen-kaart {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    top: 0 !important;
    left: 0 !important;
}

/* ─── FIX THEMA WRAPPERS VOOR LEAFLET ──────────────────────── */
/* overflow:hidden op parent-elementen breekt Leaflet zoom/drag */
body.vs-kaart-fullscreen main,
body.vs-kaart-fullscreen #vs-page,
body.vs-kaart-fullscreen .vs-content {
    overflow: visible !important;
    position: static !important;
    height: auto !important;
    min-height: 0 !important;
}

/* Verberg zoom-uit knop, alleen zoom-in tonen */
.vs-screen-kaart .leaflet-control-zoom-out {
    display: none !important;
}

/* ── Disclaimer ────────────────────────────────────────── */
.vs-disclaimer {
    text-align: center;
    font-size: 11px !important;
    color: rgba(255,255,255,0.35) !important;
    padding: 12px 24px 16px;
    letter-spacing: 0.02em;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: 8px;
}