/*
 * RoamEase Pro - Leaflet Map container styles
 * Keep this lightweight and conflict-free.
 */

.roamease-leaflet-map {
    width: 100%;
    height: var(--re-map-height, 420px);
    min-height: 260px;
    border-radius: 8px;
    overflow: hidden;
}

/* Leaflet requires the container to have an explicit height */
.roamease-leaflet-map .leaflet-container,
.roamease-leaflet-map.leaflet-container {
    width: 100%;
    height: 100%;
    background: transparent !important;
    background-image: none !important;
}

/* Some themes apply background images globally; ensure tiles don't inherit them */
.roamease-leaflet-map .leaflet-tile {
    background: transparent !important;
    background-image: none !important;
}

/* Also protect Leaflet panes/containers from inheriting backgrounds */
.roamease-leaflet-map .leaflet-pane,
.roamease-leaflet-map .leaflet-map-pane,
.roamease-leaflet-map .leaflet-tile-pane,
.roamease-leaflet-map .leaflet-overlay-pane,
.roamease-leaflet-map .leaflet-shadow-pane,
.roamease-leaflet-map .leaflet-marker-pane,
.roamease-leaflet-map .leaflet-tooltip-pane,
.roamease-leaflet-map .leaflet-popup-pane,
.roamease-leaflet-map .leaflet-tile-container {
    background: transparent !important;
    background-image: none !important;
}

/* Numbered circle markers (default when no iconUrl is provided) */
.roamease-leaflet-map .re-numbered-marker {
    background: transparent;
    border: none;
}

.roamease-leaflet-map .re-numbered-marker__bubble {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    /* Prefer Elementor Global Primary when available */
    background: var(--e-global-color-primary, var(--re-map-marker-bg, var(--re-btn-bg, var(--re-primary, #2C7BE5))));
    color: #ffffff;
    border: 2px solid rgba(255,255,255,.85);
    transition: transform 220ms cubic-bezier(.2,.8,.2,1), box-shadow 220ms ease, filter 160ms ease;
}

/* Active day marker (synced with itinerary scroll) */
.roamease-leaflet-map .re-numbered-marker--active .re-numbered-marker__bubble {
    transform: scale(1.08);
    filter: brightness(0.92);
    box-shadow: 0 6px 18px rgba(0,0,0,.12), 0 0 0 4px rgba(255,255,255,.48);
}

/* Balloon label (Leaflet tooltip) */
.roamease-leaflet-map .leaflet-tooltip.re-marker-tooltip {
    border-radius: 999px;
    border: 2px solid rgba(255,255,255,.85);
    box-shadow: 0 10px 22px rgba(0,0,0,.12);
    background: var(--e-global-color-primary, var(--re-map-marker-bg, var(--re-btn-bg, var(--re-primary, #2C7BE5))));
    color: #ffffff;
    padding: 6px 10px;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.02em;
}

.roamease-leaflet-map .leaflet-tooltip.re-marker-tooltip::before {
    border-top-color: rgba(255,255,255,.85);
}

/* Hover-label mode: small dot marker */
.roamease-leaflet-map .re-dot-marker {
    background: transparent;
    border: none;
}

.roamease-leaflet-map .re-dot-marker__dot {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--e-global-color-primary, var(--re-map-marker-bg, var(--re-btn-bg, var(--re-primary, #2C7BE5))));
    border: 2px solid rgba(255,255,255,.9);
    box-shadow: 0 8px 18px rgba(0,0,0,.10);
}

.roamease-leaflet-map .re-numbered-marker--active .re-dot-marker__dot {
    transform: scale(1.12);
    filter: brightness(0.95);
    box-shadow: 0 10px 22px rgba(0,0,0,.14), 0 0 0 4px rgba(255,255,255,.42);
}

.roamease-leaflet-map .re-numbered-marker__num {
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
}

/* Day label markers (v2): "Day 1", "Day 5-7" etc. */
.roamease-leaflet-map .re-day-label-marker {
    background: transparent;
    border: none;
}

.roamease-leaflet-map .re-day-label-marker__pin,
.roamease-leaflet-map .re-day-label-marker__connector {
    display: none;
}

.roamease-leaflet-map .re-day-label-marker__pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.02em;
    white-space: nowrap;
    box-sizing: border-box;
    /* Prefer Elementor Global Primary when available */
    background: var(--e-global-color-primary, var(--re-map-marker-bg, var(--re-btn-bg, var(--re-primary, #2C7BE5))));
    color: #ffffff;
    border: 2px solid rgba(255,255,255,.85);
    box-shadow: 0 8px 18px rgba(0,0,0,.10);
    transition: transform 220ms cubic-bezier(.2,.8,.2,1), box-shadow 220ms ease, filter 160ms ease;
}

/* Active day marker (synced with itinerary scroll) */
.roamease-leaflet-map .re-numbered-marker--active .re-day-label-marker__pill {
    transform: scale(1.04);
    filter: brightness(0.95);
    box-shadow: 0 10px 22px rgba(0,0,0,.14), 0 0 0 4px rgba(255,255,255,.42);
}

/* Itinerary pill markers: Day on top, Destination below (always visible) */
.roamease-leaflet-map .re-itinerary-pill-marker {
    background: transparent;
    border: none;
    opacity: 1;
    transition: transform 220ms cubic-bezier(.2,.8,.2,1), filter 160ms ease;
}

.roamease-leaflet-map .re-itinerary-pill {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 5px 8px;
    border-radius: 999px;
    font-weight: 700;
    line-height: 1.05;
    white-space: nowrap;
    box-sizing: border-box;
    background: var(--e-global-color-primary, var(--re-map-marker-bg, var(--re-btn-bg, var(--re-primary, #2C7BE5))));
    color: #ffffff;
    border: 2px solid rgba(255,255,255,.85);
    box-shadow: 0 10px 22px rgba(0,0,0,.12);
    transform: translate(-50%, calc(-100% - 10px));
}

.roamease-leaflet-map .re-itinerary-pill__day {
    font-size: 9px;
    letter-spacing: 0.02em;
    opacity: 0.95;
}

.roamease-leaflet-map .re-itinerary-pill__name {
    font-size: 10px;
    letter-spacing: 0.01em;
}

.roamease-leaflet-map .re-numbered-marker--active.re-itinerary-pill-marker .re-itinerary-pill {
    filter: brightness(0.95);
    transform: translate(-50%, calc(-100% - 10px)) scale(1.04);
    box-shadow: 0 12px 26px rgba(0,0,0,.14), 0 0 0 4px rgba(255,255,255,.42);
}

/* No-animation mode (v2 request) */
.roamease-leaflet-map.re-map-no-anim .re-numbered-marker__bubble,
.roamease-leaflet-map.re-map-no-anim .re-day-label-marker__pill,
.roamease-leaflet-map.re-map-no-anim .re-itinerary-pill {
    transition: none !important;
}

/* Disable Leaflet zoom/fade transitions when requested */
.roamease-leaflet-map.re-map-no-anim.leaflet-zoom-anim .leaflet-zoom-animated {
    transition: none !important;
}

.roamease-leaflet-map.re-map-no-anim.leaflet-fade-anim .leaflet-tile,
.roamease-leaflet-map.re-map-no-anim.leaflet-fade-anim .leaflet-popup {
    transition: none !important;
}

/* Admin: Location Map table interactions */
#re-tour-location-map-table tbody tr {
    cursor: pointer;
}

#re-tour-location-map-table tbody tr.re-selected td {
    font-weight: 600;
}

@media (max-width: 782px) {
    .roamease-leaflet-map {
        min-height: 240px;
    }
}

/* Mountain trekking map: align with Single Tour v2 map framing */
body.roamease-single-mountain #route-map .roamease-leaflet-map,
.smgv2-route-map .roamease-leaflet-map {
    --re-map-height: 720px;
    min-height: 420px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border-radius: 22px;
    border: 1px solid rgba(199, 147, 117, 0.22);
    box-shadow: 0 22px 44px rgba(42, 33, 24, 0.12);
    background: rgba(255, 255, 255, 0.96);
}

/* Keep the basemap quiet/clean like Single Tour v2 */
body.roamease-single-mountain #route-map .roamease-leaflet-map .leaflet-tile-pane,
.smgv2-route-map .roamease-leaflet-map .leaflet-tile-pane {
    filter: saturate(88%) contrast(90%) brightness(1.04);
}

body.roamease-single-mountain #route-map .roamease-leaflet-map .leaflet-control-container,
.smgv2-route-map .roamease-leaflet-map .leaflet-control-container {
    opacity: 1;
}

body.roamease-single-mountain #route-map .roamease-leaflet-map .leaflet-control-zoom {
    border: 1px solid rgba(199, 147, 117, 0.24);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(42, 33, 24, 0.12);
}

body.roamease-single-mountain #route-map .roamease-leaflet-map .leaflet-control-zoom a {
    width: 38px;
    height: 38px;
    line-height: 38px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--re-heading, #2A2118);
    border-bottom-color: rgba(199, 147, 117, 0.18);
}

body.roamease-single-mountain #route-map .roamease-leaflet-map .leaflet-control-zoom a:hover {
    background: rgba(244, 240, 236, 0.96);
    color: var(--e-global-color-primary, #C79375);
}

body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill-marker {
    background: transparent;
    border: none;
    width: 1px;
    height: 1px;
    overflow: visible;
    pointer-events: none;
}

body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill {
    position: absolute;
    left: 0;
    top: 0;
    --re-pill-shift-x: 0px;
    --re-pill-shift-y: 0px;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: none;
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid rgba(199, 147, 117, 0.28);
    background: rgba(255, 255, 255, 0.96);
    color: var(--re-heading, #2A2118);
    box-shadow: 0 14px 28px rgba(42, 33, 24, 0.14);
    transform: translate(calc(-50% + var(--re-pill-shift-x)), calc(-100% - 16px + var(--re-pill-shift-y)));
    overflow: visible;
    white-space: nowrap;
}

body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill::after {
    content: '';
    position: absolute;
    left: calc(50% - var(--re-pill-shift-x));
    top: calc(100% - 1px);
    width: 2px;
    height: calc(10px - var(--re-pill-shift-y));
    background: rgba(199, 147, 117, 0.74);
    transform: translateX(-50%);
}

body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill::before {
    content: '';
    position: absolute;
    left: calc(50% - var(--re-pill-shift-x));
    top: calc(100% + (9px - var(--re-pill-shift-y)));
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--e-global-color-primary, #C79375);
    border: 2px solid rgba(255, 255, 255, 0.96);
    box-shadow: 0 6px 14px rgba(42, 33, 24, 0.18);
    transform: translate(-50%, -50%);
}

body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill__day {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--e-global-color-primary, #C79375);
    color: var(--e-global-color-a1dac06, #FFFFFF);
    font-family: var(--e-global-typography-text-font-family, 'Poppins', sans-serif);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    flex: 0 0 auto;
}

body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill__name {
    font-family: var(--e-global-typography-text-font-family, 'Poppins', sans-serif);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0;
    color: var(--re-heading, #2A2118);
    text-align: left;
    white-space: nowrap;
}

body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill__name--short {
    display: none;
}

body.roamease-single-mountain #route-map .roamease-leaflet-map .re-numbered-marker--active.re-itinerary-pill-marker .re-itinerary-pill {
    transform: translate(calc(-50% + var(--re-pill-shift-x)), calc(-100% - 16px + var(--re-pill-shift-y))) scale(1.03);
    box-shadow: 0 18px 32px rgba(42, 33, 24, 0.18);
    border-color: rgba(199, 147, 117, 0.42);
}

body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill[data-role="start"] .re-itinerary-pill__day {
    background: var(--e-global-color-secondary, #333333);
}

body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill[data-role="summit"] .re-itinerary-pill__day {
    background: #b86a36;
}

body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill[data-role="exit"] .re-itinerary-pill__day {
    background: #7a6c60;
}

body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill[data-day="2"] {
    --re-pill-shift-x: -18px;
}

body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill[data-day="4"] {
    --re-pill-shift-x: -64px;
    --re-pill-shift-y: -14px;
}

body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill[data-day="5"] {
    --re-pill-shift-y: 16px;
}

body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill[data-day="6"] {
    --re-pill-shift-x: 64px;
    --re-pill-shift-y: -10px;
}

@media (max-width: 991px) {
    body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill {
        padding: 6px 8px;
        transform: translate(calc(-50% + var(--re-pill-shift-x)), calc(-100% - 14px + var(--re-pill-shift-y)));
    }

    body.roamease-single-mountain #route-map .roamease-leaflet-map .re-numbered-marker--active.re-itinerary-pill-marker .re-itinerary-pill {
        transform: translate(calc(-50% + var(--re-pill-shift-x)), calc(-100% - 14px + var(--re-pill-shift-y))) scale(1.03);
    }

    body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill__name {
        font-size: 10px;
    }
}

@media (max-width: 767px) {
    body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill {
        padding: 5px 7px;
        border-radius: 999px;
        transform: translate(calc(-50% + var(--re-pill-shift-x)), calc(-100% - 12px + var(--re-pill-shift-y)));
    }

    body.roamease-single-mountain #route-map .roamease-leaflet-map .re-numbered-marker--active.re-itinerary-pill-marker .re-itinerary-pill {
        transform: translate(calc(-50% + var(--re-pill-shift-x)), calc(-100% - 12px + var(--re-pill-shift-y))) scale(1.02);
    }

    body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill__day {
        font-size: 8px;
        padding: 3px 7px;
    }

    body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill__name--full {
        display: none;
    }

    body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill__name--short {
        display: inline;
        font-size: 9px;
    }

    body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill::after {
        height: calc(8px - var(--re-pill-shift-y));
    }

    body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill::before {
        top: calc(100% + (7px - var(--re-pill-shift-y)));
        width: 9px;
        height: 9px;
    }

    body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill[data-day="2"] {
        --re-pill-shift-x: -10px;
    }

    body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill[data-day="4"] {
        --re-pill-shift-x: -32px;
        --re-pill-shift-y: -10px;
    }

    body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill[data-day="5"] {
        --re-pill-shift-y: 10px;
    }

    body.roamease-single-mountain #route-map .roamease-leaflet-map .re-itinerary-pill[data-day="6"] {
        --re-pill-shift-x: 34px;
        --re-pill-shift-y: -8px;
    }
}

@media (max-width: 1199px) {
    body.roamease-single-mountain #route-map .roamease-leaflet-map,
    .smgv2-route-map .roamease-leaflet-map {
        --re-map-height: 640px;
    }
}

@media (max-width: 991px) {
    body.roamease-single-mountain #route-map .roamease-leaflet-map,
    .smgv2-route-map .roamease-leaflet-map {
        --re-map-height: 560px;
    }
}

@media (max-width: 767px) {
    body.roamease-single-mountain #route-map .roamease-leaflet-map,
    .smgv2-route-map .roamease-leaflet-map {
        --re-map-height: 480px;
        min-height: 360px;
    }
}

@media (max-width: 575px) {
    body.roamease-single-mountain #route-map .roamease-leaflet-map,
    .smgv2-route-map .roamease-leaflet-map {
        --re-map-height: 420px;
        min-height: 320px;
    }
}
