/* Banenkaart — calm vacancy sheet/popup + travel rings (kandidaat-polish 04) */

:root {
    --map-iso-fill: #2563eb;
    --map-iso-line: #1d4ed8;
    --map-cluster: #16a34a;
    --map-cluster-selected: #f54a1b;
    --map-popup-pager-h: 44px;
}

/* Cluster sheet (mobile docked + desktop docked) */
.map-cluster-sheet,
.job-map-popup--cluster .maplibregl-popup-content {
    box-sizing: border-box;
}

.map-cluster-sheet {
    position: absolute;
    inset-inline: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 6;
    height: auto;
    max-height: min(60vh, 420px);
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px 20px 12px 12px;
    box-shadow: 0 -8px 24px rgba(15, 45, 92, 0.16);
    overflow: hidden;
    pointer-events: auto;
}

.map-pane.is-cluster-open .job-map-locate {
    bottom: calc(var(--map-cluster-sheet-h, 0px) + 12px);
}

/* Bottom nav sits outside .map-pane; sheet stays above it inside the pane */
@media (max-width: 899px) {
    .map-pane {
        position: relative;
    }

    .map-pane.is-cluster-open .map-pane__top-chrome {
        visibility: hidden;
        pointer-events: none;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden;
        opacity: 0;
    }

    .map-pane.is-cluster-open .job-map-popup--cluster {
        display: none !important;
    }

    .map-cluster-chip {
        position: absolute;
        top: 10px;
        inset-inline: 0;
        margin-inline: auto;
        z-index: 5;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.35rem;
        min-height: 44px;
        padding: 0.4rem 0.9rem;
        width: max-content;
        max-width: calc(100% - 24px);
        border: 1px solid var(--border);
        border-radius: 999px;
        background: var(--surface);
        color: var(--brand);
        font-size: 0.875rem;
        font-weight: 600;
        box-shadow: var(--shadow);
        cursor: pointer;
    }

    .map-cluster-chip[hidden] {
        display: none !important;
    }

    .map-cluster-chip__chevron {
        font-size: 0.75rem;
        line-height: 1;
        opacity: 0.7;
    }
}

@media (min-width: 900px) {
    .map-cluster-sheet.map-popup--docked,
    .map-cluster-sheet {
        inset-inline: auto;
        left: 50%;
        transform: translateX(-50%);
        width: min(360px, calc(100% - 48px));
        bottom: 24px;
        height: auto;
        max-height: min(60vh, 420px);
        min-height: 0;
        border-radius: var(--radius);
    }

    .map-cluster-chip {
        display: none !important;
    }

    /* Legacy floating cluster popup (kept for non-vacancy use). */
    .job-map-popup--cluster .maplibregl-popup-content {
        width: min(360px, calc(100vw - 48px));
        padding: 0;
        overflow: hidden;
    }
}

.map-cluster-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    max-height: inherit;
    background: var(--surface);
}

.map-cluster-card__grab {
    width: 40px;
    height: 5px;
    margin: 6px auto 4px;
    border-radius: 3px;
    background: var(--border);
    flex: 0 0 auto;
}

.map-cluster-card__chrome {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 0 0 auto;
    min-height: var(--map-popup-pager-h);
    padding: 0 0.55rem 0.35rem;
    background: var(--surface);
}

.map-cluster-card__heading {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.map-cluster-card__title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--brand);
    line-height: 1.3;
}

.map-cluster-card__sub {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-cluster-card__sub[hidden] {
    display: none !important;
}

.map-cluster-card__pager {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 0.1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted);
}

.map-cluster-card__pager[hidden] {
    display: none !important;
}

.map-cluster-card__nav,
.map-cluster-card__close {
    box-sizing: border-box;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--brand);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.map-cluster-card__nav {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border: 1px solid var(--border);
    color: var(--brand);
}

.map-cluster-card__close {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    background: var(--pearl);
    color: var(--brand);
}

.map-cluster-card__nav:hover:not(:disabled),
.map-cluster-card__close:hover {
    color: var(--brand);
    background: var(--pearl-mid, var(--pearl));
}

.map-cluster-card__nav:disabled {
    opacity: 0.35;
    cursor: default;
}

.map-cluster-card__counter {
    min-width: 2.8rem;
    padding-inline: 0.15rem;
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.map-cluster-card__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 0.75rem 0.75rem;
}

.map-cluster-card .map-popup__main {
    max-height: none;
    overflow: visible;
}

.map-cluster-card__viewport {
    position: relative;
    min-height: 0;
    overflow: hidden;
    touch-action: pan-y;
}

.map-cluster-card__slide {
    position: relative;
    width: 100%;
    will-change: transform, opacity;
}

.map-cluster-card__slide.is-enter-from-end {
    position: absolute;
    inset: 0;
    transform: translateX(100%);
    opacity: 0.01;
}

.map-cluster-card__slide.is-enter-from-start {
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    opacity: 0.01;
}

.map-cluster-card__slide.is-leave-to-start {
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    opacity: 0;
}

.map-cluster-card__slide.is-leave-to-end {
    position: absolute;
    inset: 0;
    transform: translateX(100%);
    opacity: 0;
}

.map-cluster-card__slide.is-active {
    transform: translateX(0);
    opacity: 1;
}

.map-cluster-card__slide.is-animating {
    transition: transform 200ms ease-out, opacity 200ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .map-cluster-card__slide.is-animating {
        transition: opacity 120ms ease-out;
    }
}

.map-cluster-card__dots {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 10px;
}

.map-cluster-card__dots[hidden] {
    display: none !important;
}

.map-cluster-card__dots > i {
    width: 6px;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
}

.map-cluster-card__dots > i.is-on {
    width: 18px;
    background: var(--brand);
}

/* Calm vacancy card */
.map-cluster-card .map-popup--calm,
.map-popup.map-popup--calm {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

.map-cluster-card .map-popup__main,
.map-popup--calm .map-popup__main {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    width: 100%;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    background: transparent;
}

.map-cluster-card .map-popup__media,
.map-cluster-card .map-popup__media--logo-only,
.map-cluster-card .map-popup__media--empty,
.map-popup--calm .map-popup__media,
.map-popup--calm .map-popup__media--logo-only,
.map-popup--calm .map-popup__media--empty {
    flex: none !important;
    width: 88px !important;
    min-width: 88px !important;
    max-width: 88px !important;
    height: 88px !important;
    min-height: 88px !important;
    max-height: 88px !important;
    border-radius: 12px;
    overflow: hidden;
    align-self: start;
}

.map-cluster-card .map-popup__media--empty,
.map-popup--calm .map-popup__media--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--coral) 8%, var(--gold-soft));
    color: var(--brand);
}

.map-popup--calm .map-popup__media--illustrated .map-popup__photo--illustrated {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center bottom;
    padding: 4px;
}

.map-cluster-card .map-popup__media--empty svg,
.map-popup--calm .map-popup__media--empty svg {
    width: 28px;
    height: 28px;
    opacity: 0.92;
}

.map-cluster-card .map-popup__photo,
.map-cluster-card .map-popup__media-logo,
.map-popup--calm .map-popup__photo,
.map-popup--calm .map-popup__media-logo {
    width: 88px;
    height: 88px;
    object-fit: cover;
    display: block;
}

.map-cluster-card .map-popup__body,
.map-popup--calm .map-popup__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: visible;
}

.map-cluster-card .map-popup__title,
.map-popup--calm .map-popup__title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    white-space: normal;
    text-overflow: clip;
    max-width: 100%;
    max-height: none;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--brand);
    text-decoration: none;
}

.map-cluster-card .map-popup__company,
.map-popup--calm .map-popup__company {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    margin: 0;
    font-size: 0.8125rem;
    color: var(--muted);
    text-decoration: none;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
}

.map-cluster-card .map-popup__company b,
.map-popup--calm .map-popup__company b {
    color: var(--text);
    font-weight: 600;
}

.map-popup__co-icon {
    flex: 0 0 auto;
    color: var(--muted);
}

.map-popup__match {
    margin: 0;
}

.map-popup__fit-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 3px 10px;
    background: var(--accent-soft);
    color: var(--brand);
    white-space: nowrap;
}

.map-popup__fit-pill.match-score--green,
.match-score--green .map-popup__fit-pill {
    background: var(--success-soft);
    color: var(--success);
}

.map-popup__fit-pill.match-score--orange {
    background: var(--accent-soft);
    color: var(--brand);
}

.map-popup__gate-link {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--brand);
    text-decoration: underline;
}

.map-popup__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin: 0;
    font-size: 0.8125rem;
    color: var(--muted);
}

.map-popup__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.map-popup__meta-item--travel {
    color: var(--map-iso-line);
    font-weight: 600;
}

.map-popup__meta .map-popup__spec-icon {
    width: 15px;
    height: 15px;
}

.map-popup__why {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 8px 0 0;
    font-size: 0.8125rem;
    color: var(--muted);
}

.map-popup__why-icon {
    flex: 0 0 auto;
    margin-top: 2px;
    color: var(--gold-deep, #a6851c);
}

.map-popup__actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    align-items: stretch;
}

.map-popup__view {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 48px;
    min-height: 48px;
    padding: 0 14px;
    border-radius: var(--radius-sm, 8px);
    background: var(--brand);
    color: #fff !important;
    border: 1px solid var(--brand);
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.map-popup__view:hover,
.map-popup__view:focus {
    background: var(--accent-hover, #163a6b);
    border-color: var(--accent-hover, #163a6b);
    color: #fff !important;
}

.map-popup__heart {
    box-sizing: border-box;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 8px);
    background: var(--surface);
    color: var(--brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.map-popup__heart.is-saved {
    color: var(--coral);
    border-color: var(--coral-soft, #ffe8e0);
    background: var(--coral-soft, #ffe8e0);
}

.map-popup__heart:hover {
    background: var(--pearl);
}

/* Hide MapLibre tip/close for cluster — chrome has its own × */
.job-map-popup--cluster .maplibregl-popup-tip,
.job-map-popup--cluster .maplibregl-popup-close-button {
    display: none !important;
}

.job-map-popup--cluster .maplibregl-popup-content {
    background: transparent;
    box-shadow: none;
}

/* Isochrone ring label pills (HTML markers) */
.app-shell--banenkaart-shell .job-map,
.jobsy-discovery[data-banenkaart-ssr="1"] .job-map {
    overflow: hidden;
    height: 100%;
    min-height: 0;
}

.app-shell--banenkaart-shell .job-map .maplibregl-canvas-container,
.jobsy-discovery[data-banenkaart-ssr="1"] .job-map .maplibregl-canvas-container {
    height: 100% !important;
}

.job-map-locate__message {
    position: absolute;
    left: 50%;
    top: 0.65rem;
    transform: translateX(-50%);
    width: min(22rem, calc(100% - 1.5rem));
    margin: 0;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    background: color-mix(in srgb, var(--warn-soft, #fff8e7) 94%, var(--surface));
    color: var(--warn, #a65b00);
    font-size: 0.82rem;
    font-weight: 600;
    z-index: 2;
    pointer-events: none;
    box-shadow: var(--shadow);
    text-align: center;
    transition: opacity 280ms ease;
}

.job-map-locate__message[hidden] {
    opacity: 0;
}

.map-iso-label {
    pointer-events: none;
    white-space: nowrap;
    max-width: calc(100% - 1rem);
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    border: 1.5px solid var(--map-iso-line);
    background: #fff;
    color: var(--map-iso-line);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: 0 1px 2px rgba(15, 45, 92, 0.12);
}

.map-iso-label--chosen {
    border-width: 1.5px;
    border-color: #fff;
    background: var(--map-iso-line);
    color: #fff;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(29, 78, 216, 0.35);
}

.map-iso-label__icon {
    margin-inline-end: 0.2rem;
}

/* The shared coach dock sits bottom-inline-end. On a phone it covers zoom and 3D.
   --lobsy-coach-clear-inline is set by jobsyCoachDock.syncClearance; 80px matches
   the 56px lobster plus its 12px inset and a 12px gap before JS runs. */
/* Mobile banenkaart: keep +/− adjacent — park compact attribution on the bottom-left. */
@media (max-width: 899px) {
    .jobsy-discovery.show-map .job-map .maplibregl-ctrl-bottom-right > .maplibregl-ctrl-attrib {
        position: absolute;
        left: calc(8px - 100vw + 100%);
        right: auto;
        top: auto;
        bottom: 0;
        margin: 0;
        float: none;
        z-index: 4;
        width: 24px;
        height: 24px;
        min-height: 24px;
        max-width: 24px;
        padding: 0;
    }

    .jobsy-discovery.show-map .job-map .maplibregl-ctrl-bottom-right > .maplibregl-ctrl-attrib.maplibregl-compact-show {
        width: auto;
        height: auto;
        max-width: min(70vw, 16rem);
        padding: 2px 28px 2px 8px;
    }
}

@media (max-width: 639px) {
    .app-shell:has([data-lobsy-coach]) .job-map .maplibregl-ctrl-bottom-right,
    .app-shell:has([data-lobsy-coach]) .job-map .maplibregl-ctrl-top-right,
    .app-shell:has([data-lobsy-coach]) .job-map .job-map-locate {
        right: calc(var(--lobsy-coach-clear-inline, 80px));
        margin-right: 0;
    }

    /* 3D lives in the same corner stack as zoom. Keep MapLibre's 10px margin
       so the switch lines up with + and −. */
    .app-shell:has([data-lobsy-coach]) .job-map .maplibregl-ctrl-bottom-right > .job-map-style-switch,
    .app-shell:has([data-lobsy-coach]) .job-map .maplibregl-ctrl-top-right > .job-map-style-switch {
        right: auto;
        margin: 0 10px 10px 0;
    }

    /* Compact "i" sits on the zoom stack when the corner moves left for the coach.
       Park it on the map's bottom-left instead. */
    .app-shell:has([data-lobsy-coach]) .job-map .maplibregl-ctrl-bottom-right > .maplibregl-ctrl-attrib {
        position: absolute;
        left: calc(8px - 100vw + var(--lobsy-coach-clear-inline, 80px) + 100%);
        right: auto;
        top: auto;
        bottom: 0;
        margin: 0;
        float: none;
        z-index: 4;
        width: 24px;
        height: 24px;
        min-height: 24px;
        max-width: 24px;
        padding: 0;
    }

    .app-shell:has([data-lobsy-coach]) .job-map .maplibregl-ctrl-bottom-right > .maplibregl-ctrl-attrib.maplibregl-compact-show {
        width: auto;
        height: auto;
        max-width: min(70vw, 16rem);
        padding: 2px 28px 2px 8px;
    }
}

/* Candidate banenkaart shell: map toggle is a sibling above .jobsy-discovery — give the grid remaining height. */
@media (max-width: 899px) {
    .app-shell--banenkaart-shell.app-shell.has-bottom-nav {
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
    }

    .app-shell--banenkaart-shell .app-main {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .app-shell--banenkaart-shell .app-main__content {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
    }

    .app-shell--banenkaart-shell .bk-map-toggle--banen {
        flex: 0 0 auto;
    }

    .app-shell--banenkaart-shell .jobsy-discovery {
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
    }
}

/* SSR banenkaart: hero strip row 1, filter toolbar row 2 (see banenkaart-page.css). */
@media (min-width: 900px) {
    .jobsy-discovery[data-banenkaart-ssr="1"] > .kb-nearby-banner--strip {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .jobsy-discovery[data-banenkaart-ssr="1"] > .jobsy-chrome {
        display: block;
        grid-column: 1 / -1;
        grid-row: 2;
        min-width: 0;
    }
}
