@import url('https://fonts.googleapis.com/css2?family=PT+Serif:wght@400;700&family=Work+Sans:wght@400;500;600;700&display=swap');

:root {
    --color-primary: #e62735;
    --color-secondary: #022047;
    --font-heading: 'PT Serif', serif;
    --font-body: 'Work Sans', sans-serif;
}

.custom-leaflet-map-wrapper {
    display: flex;
    width: 100%;
    height: min(80vh, 800px);
    max-height: 800px;
    overflow: hidden;
    align-items: stretch;
    background: #ffffff;
}

.location-list {
    width: 40%;
    flex: 0 0 40%;
    padding: 20px;
    height: 100%;
    max-height: 100%;
    overflow-y: auto;
    min-height: 0;
    border-right: 1px solid rgba(2, 32, 71, 0.12);
    background: #f8f8f9;
    box-shadow: inset -1px 0 0 rgba(2, 32, 71, 0.06);
    scrollbar-width: thin;
    scrollbar-color: #e62735 rgba(2, 32, 71, 0.06);
    scrollbar-gutter: stable;
    direction: ltr;
}

.location-list .location-item {
    direction: ltr;
}

.custom-leaflet-map-wrapper .location-list::-webkit-scrollbar {
    width: 12px !important;
}

.custom-leaflet-map-wrapper .location-list::-webkit-scrollbar-track {
    background: rgba(2, 32, 71, 0.06) !important;
    border-left: 1px solid rgba(2, 32, 71, 0.08) !important;
}

.custom-leaflet-map-wrapper .location-list::-webkit-scrollbar-thumb {
    background: #e62735 !important;
    border-radius: 999px !important;
    border: 3px solid rgba(2, 32, 71, 0.06) !important;
}

.custom-leaflet-map-wrapper .location-list::-webkit-scrollbar-thumb:hover {
    background: #c91f2e !important;
}

.custom-leaflet-map-wrapper .location-list {
    scrollbar-width: thin !important;
    scrollbar-color: #e62735 rgba(2, 32, 71, 0.06) !important;
}

.map-panel {
    width: 60%;
    flex: 0 0 60%;
    position: relative;
    height: 100%;
    min-height: 0;
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.custom-leaflet-map {
    width: 100%;
    height: 100%;
    margin-top: 0 !important;
}

/* Fix white grid fallback: background matches Carto Light ocean/landmass colour.
   If JS pixel-rounding below doesn't cover an edge case, the gap colour matches.
   !important ensures theme rules don't override Leaflet's own background: #ddd. */
.custom-leaflet-map.leaflet-container {
    background: #f5f5f3 !important;
}

/* WordPress themes frequently set img { max-width:100%; height:auto; box-shadow:…; }
   with varying specificity. Reset every property that can alter tile geometry or add
   visible borders/shadows. No width/height/transform – Leaflet owns those inline. */
.custom-leaflet-map.leaflet-container img.leaflet-tile {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    max-width: none !important;
    max-height: none !important;
    background: transparent !important;
    box-sizing: content-box !important;
    aspect-ratio: auto !important;
    object-fit: fill !important;
}

.location-item {
    padding: 18px 16px;
    margin-bottom: 12px;
    border-left: 4px solid transparent;
    border: 1px solid rgba(2, 32, 71, 0.08);
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.location-item:hover {
    background-color: rgba(2, 32, 71, 0.02);
    box-shadow: 0 4px 14px rgba(2, 32, 71, 0.08);
}

.location-item.active {
    border-left-color: var(--color-primary);
    background-color: rgba(230, 39, 53, 0.04);
    box-shadow: 0 4px 14px rgba(230, 39, 53, 0.1);
}

.location-item h3 {
    margin: 0 0 8px;
    font-family: var(--font-heading);
    color: var(--color-secondary);
    font-size: 1.18rem;
    font-weight: 700;
    line-height: 1.3;
}

.location-item .location-description {
    margin: 0;
    font-family: var(--font-body);
    color: rgba(2, 32, 71, 0.86);
    font-size: 1.02rem;
    font-weight: 500;
    line-height: 1.4;
}

.location-item .location-description > :first-child {
    margin-top: 0;
}

.location-item .location-description > :last-child {
    margin-bottom: 0;
}

.custom-pin {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--color-secondary);
    border: 2px solid #ffffff;
    box-shadow: 0 3px 10px rgba(2, 32, 71, 0.2);
    position: relative;
    overflow: visible;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.custom-pin:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(2, 32, 71, 0.26);
}

.custom-pin.active-pin {
    width: 34px;
    height: 34px;
    background: var(--color-primary);
}

.custom-pin::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 1px solid rgba(2, 32, 71, 0.22);
    transform: scale(1);
    opacity: 0;
    animation: pin-pulse 2.8s ease-out infinite;
}

.custom-pin.active-pin::after {
    border-color: rgba(230, 39, 53, 0.3);
    animation-duration: 2.4s;
}

@keyframes pin-pulse {
    0% {
        transform: scale(1);
        opacity: 0;
    }
    25% {
        opacity: 0.32;
    }
    100% {
        transform: scale(1.55);
        opacity: 0;
    }
}

.custom-cluster {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(2, 32, 71, 0.82);
    border: 2px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 700;
}

.custom-cluster span {
    line-height: 1;
}

@media (max-width: 768px) {
    .custom-leaflet-map-wrapper {
        flex-direction: column-reverse;
        height: auto;
        max-height: none;
        overflow: visible;
        min-height: 0;
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    .map-panel,
    .location-list {
        width: 100%;
    }

    .map-panel {
        height: 52vh;
        position: sticky;
        top: 0;
        z-index: 5;
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    .custom-leaflet-map {
        height: 52vh;
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    .location-list {
        flex: 0 0 auto;
        height: auto;
        max-height: none;
        overflow: hidden;
        -webkit-overflow-scrolling: touch;
        position: relative;
        padding: 14px 12px;
        border-right: none;
        border-top: 1px solid rgba(2, 32, 71, 0.12);
    }

    .location-list.mobile-carousel-enabled {
        display: flex;
        align-items: center;
        gap: 3px;
    }

    .mobile-location-viewport {
        flex: 1;
        overflow: hidden;
    }

    .mobile-location-track {
        display: flex;
        transition: transform 0.24s ease;
        will-change: transform;
    }

    .mobile-location-track .location-item {
        flex: 0 0 100%;
        margin-bottom: 0;
        min-height: 108px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .mobile-carousel-nav {
        flex: 0 0 22px;
        width: 22px;
        height: 22px;
        border: none;
        background: transparent;
        color: #e62735;
        font-size: 30px;
        font-weight: 700;
        line-height: 1;
        padding: 0;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-carousel-nav:disabled {
        opacity: 0.38;
        cursor: default;
    }

    .location-list-scroll-indicator {
        position: absolute;
        top: 4px;
        right: 6px;
        width: 6px;
        border-radius: 999px;
        background: #e62735;
        opacity: 0.95;
        pointer-events: none;
        z-index: 3;
        transition: transform 0.12s linear;
    }
}
