/* ── Map container ─────────────────────────────────────────── */
.bb-map {
    height: 650px;
}

/* ── Leaflet popup cleanup ─────────────────────────────────── */
.leaflet-popup-content-wrapper {
    padding: 0 !important;
}
.leaflet-popup-tip-container {
    display: none;
}
.leaflet-popup-close-button {
    display: none;
}

/* ── Tile layer style ──────────────────────────────────────── */
.leaflet-tile {
    filter: brightness(1.2) grayscale(1) contrast(0.9) saturate(0.7) hue-rotate(10deg);
    opacity: 1;
}

/* ── Pin marker ────────────────────────────────────────────── */
.pin {
    box-sizing: border-box;
    position: absolute;
    width: 60px;
    height: 60px;
    cursor: pointer;
    border-radius: 50% 50% 50% 0;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.2);
    transform: rotate(-45deg);
    padding: 5px;
}
.pin img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    transform: rotate(45deg);
}

/* ── Cluster markers ───────────────────────────────────────── */
.marker-cluster {
    background-color: rgba(211, 93, 137, 0.6);
    border-radius: 50%;
    text-align: center;
    color: white;
}
.marker-cluster div {
    font-weight: bold;
}
.marker-cluster-small,
.marker-cluster-small div {
    width: 40px;
    height: 40px;
    line-height: 40px;
    font-size: 14px;
    background-color: rgba(211, 93, 137, 0.6);
}
.marker-cluster-medium,
.marker-cluster-medium div {
    width: 40px;
    height: 40px;
    line-height: 40px;
    font-size: 14px;
    background-color: rgba(94, 151, 171, 0.6);
}
.marker-cluster-large,
.marker-cluster-large div {
    width: 50px;
    height: 50px;
    line-height: 50px;
    font-size: 16px;
    background-color: rgba(255, 0, 0, 0.6);
}

/* ── Image grid (show_grid="true") ─────────────────────────── */
.bb-image-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.bb-grid-item {
    flex: 1 1 calc(33.333% - 8px);
    box-sizing: border-box;
}
.bb-grid-item img {
    width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: block;
}
.bb-grid-item img:hover {
    border-color: #777;
}

/* ── Masonry grid (masonry="true") ─────────────────────────── */
.bb-image-grid.bb-masonry {
    display: block;
    columns: 3;
    column-gap: 8px;
}
.bb-image-grid.bb-masonry .bb-grid-item {
    break-inside: avoid;
    margin: 0 0 8px 0;
    flex: none;
}

/* ── Side-by-side layout (layout="side") ───────────────────── */
.bb-map-layout {
    --bb-map-top-offset: 0px;
    display: grid;
    grid-template-columns: minmax(260px, 40%) minmax(0, 1fr);
    gap: 12px;
    position: relative;
    align-items: start;
}
.bb-map-layout .bb-map {
    grid-column: 1;
    grid-row: 1;
    position: sticky !important;
    top: var(--bb-map-top-offset);
    height: calc(100vh - var(--bb-map-top-offset));
    min-height: 400px;
}
.bb-map-layout .bb-image-grid {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    margin-top: 0;
}
.bb-map-layout .bb-image-grid.bb-masonry {
    columns: 2;
    column-gap: 8px;
}
.bb-map-layout .bb-image-grid.bb-masonry .bb-grid-item {
    break-inside: avoid;
    margin: 0 0 8px 0;
}

.admin-bar .bb-map-layout {
    --bb-map-top-offset: 32px;
}

body.bb-has-side-map .site-wrapper {
    overflow: visible !important;
}

@media screen and (max-width: 782px) {
    .admin-bar .bb-map-layout {
        --bb-map-top-offset: 46px;
    }
}

/* ── Interaction highlights ─────────────────────────────────── */
.bb-grid-item.bb-highlight img {
    outline: 3px solid #d35d89;
    outline-offset: -3px;
}
.bb-pin-highlight .pin {
    background-color: rgba(211, 93, 137, 0.3);
    box-shadow: 0 0 0 3px rgba(211, 93, 137, 0.8), 0px 1px 3px rgba(0,0,0,0.3);
}

/* ── Responsive: stack on narrow screens ────────────────────── */
@media (max-width: 780px) {
    .bb-map-layout {
        grid-template-columns: 1fr;
    }
    .bb-map-layout .bb-map {
        grid-column: 1;
        grid-row: 1;
        position: relative !important;
        top: auto;
        height: 400px;
        min-height: 0;
    }
    .bb-map-layout .bb-image-grid {
        grid-column: 1;
        grid-row: 2;
    }
    .bb-map-layout .bb-image-grid.bb-masonry {
        columns: 3;
    }
}
