/* ============================================================================
   KP LOCATION MAP (Mapbox GL)
   Figma: dark bg, 1920x1080, pins #6BABD3, panel 480px white
   ============================================================================ */

.kp-location-map {
    width: 100%;
    padding: 0 !important;
}
.kp-location-map__container {
    position: relative;
    width: 100%;
    height: clamp(520px, 80vh, 760px);
    overflow: hidden;
    background: #0d1c38;
    display: flex;
    flex-direction: row;
}
.kp-location-map__map {
    flex: 1;
    height: 100%;
}

/* Mapbox overrides */
.kp-location-map .mapboxgl-ctrl-group button {
    background: #0d1c38;
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.25);
}
.kp-location-map .mapboxgl-ctrl button .mapboxgl-ctrl-icon {
    filter: invert(1);
}
.kp-location-map .mapboxgl-ctrl-logo,
.kp-location-map .mapboxgl-ctrl-attrib {
    opacity: 0.4;
}

/* Custom pin markers */
.kp-location-map__pin {
    background: #6babd3;
    border-radius: 40px;
    padding: 4px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}
.kp-location-map__pin:hover,
.kp-location-map__pin[data-active="true"] {
    transform: scale(1.25);
    box-shadow: 0 0 0 4px rgba(107, 171, 211, 0.3);
}
.kp-location-map__pin svg {
    width: 20px;
    height: 20px;
    color: #ffffff;
}

/* Side panel */
.kp-location-map__panel {
    width: 480px;
    flex-shrink: 0;
    background: #ffffff;
    box-shadow: -8px 0 40px 0 rgba(0,0,0,0.1);
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
    margin-right: -480px;
    margin-top: 16px;
    height: calc(100% - 32px);
    max-height: calc(100% - 32px);
    min-height: 0;
    transition: margin-right 0.35s ease;
    z-index: 10;
}
.kp-location-map__panel.is-open {
    margin-right: 16px;
}
.kp-location-map__panel-close {
    align-self: flex-end;
    background: none;
    border: none;
    cursor: pointer;
    color: #0d1c38;
    padding: 0;
}
.kp-location-map__panel-close:hover {
    opacity: 0.7;
}
.kp-location-map__panel-image {
    width: 100%;
    height: 180px;
    flex-shrink: 0;
    background-color: #c4c4c4;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}
.kp-location-map__panel-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.kp-location-map__panel-title {
    color: #0d1c38;
    font-family: var(--font-heading, "sofia-pro", sans-serif);
    font-size: 32px;
    line-height: 130%;
    font-weight: 400;
    margin: 0;
    white-space: pre-line;
}
.kp-location-map__panel-subtitle {
    color: rgba(13, 28, 56, 0.5);
    font-family: var(--font-main, "acumin-pro", sans-serif);
    font-size: 16px;
    line-height: 150%;
    font-weight: 400;
    margin: 0;
}
.kp-location-map__panel-desc {
    color: #0d1c38;
    font-family: var(--font-main, "acumin-pro", sans-serif);
    font-size: 16px;
    line-height: 150%;
    font-weight: 400;
}
.kp-location-map__panel-desc ul {
    list-style: disc;
    margin: 0;
    padding-left: 20px;
}
.kp-location-map__panel-desc li {
    margin-bottom: 4px;
}
.kp-location-map__panel-contact {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.kp-location-map__panel-contact-title {
    color: #0d1c38;
    font-family: var(--font-heading, "sofia-pro", sans-serif);
    font-size: 24px;
    line-height: 140%;
    font-weight: 400;
    margin: 0;
}
.kp-location-map__panel-contact-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #0d1c38;
    font-family: var(--font-main, "acumin-pro", sans-serif);
    font-size: 16px;
    line-height: 150%;
}
.kp-location-map__panel-btn {
    width: 100%;
    justify-content: center;
}

/* Desktop — past in één viewport-oogopslag (minus header) */
@media (min-width: 1024px) {
    .kp-location-map__container {
        height: clamp(620px, calc(100vh - 120px), 820px);
    }
}

/* ─── Bottom nav (prev/next + counter) ─── */
.kp-location-map__nav {
    position: absolute;
    left: 50%;
    bottom: 32px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    background: rgba(13, 28, 56, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 9999px;
    color: #ffffff;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 5;
    font-family: var(--font-main, "acumin-pro", sans-serif);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.02em;
}
.kp-location-map__nav-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.kp-location-map__nav-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.5);
}
.kp-location-map__nav-btn:active {
    transform: scale(0.95);
}
.kp-location-map__nav-counter {
    min-width: 48px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ─── Reopen arrow (zichtbaar wanneer panel dicht is) ─── */
.kp-location-map__reopen {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 36px;
    height: 64px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: rgba(13, 28, 56, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-right: none;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    z-index: 5;
    transition: background-color 0.2s ease, padding-right 0.2s ease;
}
.kp-location-map__reopen:hover {
    background: rgba(13, 28, 56, 1);
    padding-right: 4px;
}
.kp-location-map__reopen svg {
    transform: rotate(180deg);
}
/* Zichtbaar maken wanneer panel niet open is */
.kp-location-map__container:not(.panel-open) .kp-location-map__reopen {
    display: flex;
}

/* Mobile: reopen-pijl niet relevant (cards staan al onder de kaart). Nav wél tonen. */
@media (max-width: 1023px) {
    .kp-location-map__reopen {
        display: none !important;
    }
    /* Nav onder in de map (16:10 aspect ratio op mobile) */
    .kp-location-map__container .kp-location-map__nav {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        top: calc(100vw * 10 / 16 - 56px);
        bottom: auto;
        z-index: 6;
    }
}

/* Mobile: Osmo pattern — map top, cards horizontal scroll below */
@media (max-width: 1023px) {
    .kp-location-map__container {
        flex-direction: column;
        height: auto;
        touch-action: pan-y;
    }
    .kp-location-map__map {
        aspect-ratio: 16 / 10;
        flex: none;
        height: auto;
    }
    .kp-location-map__panel {
        position: relative;
        width: 100%;
        margin-right: 0;
        margin-top: 0;
        box-shadow: none;
        background: #0d1c38;
        flex-direction: column;
        overflow: hidden;
        gap: 0;
        opacity: 0;
        transform: translateY(20px);
        transition: max-height 0.3s ease, opacity 0.3s ease, transform 0.3s ease,
                    padding 0.3s ease, border 0.3s ease;
        /* Default verborgen op mobile */
        display: flex;
        max-height: 0;
        padding: 0;
        border-top: 0 solid rgba(255,255,255,0.1);
        pointer-events: none;
    }
    .kp-location-map__panel::-webkit-scrollbar { display: none; }
    .kp-location-map__panel.is-open {
        margin-right: 0;
        max-height: 50vh;
        opacity: 1;
        transform: none;
        border-top-width: 1px;
        pointer-events: auto;
        overflow-y: auto;
    }
    /* Mobile: toon alleen de actieve card, navigatie via pijltjes */
    .kp-location-map__panel .kp-location-map__panel-content {
        display: none;
        padding: 24px 16px;
    }
    .kp-location-map__panel .kp-location-map__panel-content.is-active {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    /* Close-knop rechtsboven in het panel op mobile */
    .kp-location-map__panel .kp-location-map__panel-close {
        display: flex;
        position: absolute;
        top: 12px;
        right: 12px;
        left: auto;
        margin: 0;
        z-index: 3;
        background: rgba(13, 28, 56, 0.9);
        color: #ffffff;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 50%;
        padding: 6px;
        width: 36px;
        height: 36px;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }
    .kp-location-map__panel .kp-location-map__panel-close svg {
        width: 18px;
        height: 18px;
    }
    /* Reserveer ruimte bovenin zodat titel niet onder de close-knop verdwijnt */
    .kp-location-map__panel .kp-location-map__panel-content.is-active {
        padding-right: 56px;
    }
    .kp-location-map__panel-image {
        display: none;
    }
    .kp-location-map__panel-content {
        scroll-snap-align: center;
        flex: 0 0 80%;
        min-width: 80%;
        padding: 1.5rem;
        border-right: 1px solid rgba(255,255,255,0.1);
    }
    .kp-location-map__panel-title {
        font-size: 1.5rem;
        line-height: 140%;
        color: #ffffff;
    }
    .kp-location-map__panel-subtitle {
        color: rgba(255,255,255,0.5);
    }
    .kp-location-map__panel-desc {
        color: rgba(255,255,255,0.7);
        margin-bottom: 0;
    }
    .kp-location-map__panel-contact-title {
        color: #ffffff;
    }
    .kp-location-map__panel-contact-items {
        color: rgba(255,255,255,0.7);
    }
    .kp-location-map__panel-contact-items a {
        color: #6babd3;
    }
    .kp-location-map__panel-btn {
        margin-top: auto;
    }
}
