/* =========================
   Leaflet + OSM Map Preview
   ========================= */
.post__map-preview {
    position: relative;
    width: 100%;
    height: 200px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
}

.leaflet-map-preview {
    width: 100%;
    height: 100%;
}


/* =========================
   Glass Modal Overlay
   ========================= */
.map-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 20, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.map-modal.active {
    display: flex;
    animation: modalFadeIn 0.35s ease;
}

/* =========================
   Modal Content (Glass)
   ========================= */
.map-modal__content {
    width: 95%;
    max-width: 900px;
    height: 85vh;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    animation: modalSlideUp 0.4s ease;
}

/* =========================
   Leaflet Map
   ========================= */
#leafletMap {
    flex: 1;
    width: 100%;
    border-radius: 16px 16px 0 0;
}

/* =========================
   Floating Close Button
   ========================= */
.map-modal__close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 26px;
    border: none;
    cursor: pointer;
    display: grid;
    place-items: center;
    z-index: 9999 !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    transition: all 0.25s ease;
}

.map-modal__close:hover {
    transform: scale(1.08);
    background: rgba(0, 0, 0, 0.7);
}


/* =========================
   Footer (Glass Bar)
   ========================= */
.map-modal__footer {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    text-align: right;
}

.map-modal__footer a {
    color: #fff;
    font-weight: 500;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.35);
    transition: all 0.25s ease;
}

.map-modal__footer a:hover {
    background: rgba(0, 0, 0, 0.55);
}

/* =========================
   Trigger Button
   ========================= */
.open-map-btn {
    background: none;
    border: none;
    color: #0d6efd;
    cursor: pointer;
    padding: 0;
    font-weight: 500;
}

.open-map-btn:hover {
    text-decoration: underline;
}

/* =========================
   Animations
   ========================= */
@keyframes modalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes modalSlideUp {
    from {
        transform: translateY(30px) scale(0.98);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* =====================================================
   MAP MODAL CONTROLS (GLASS UI)
   ADD-ONLY — SAFE
   ===================================================== */

/* Ensure controls sit ABOVE the Leaflet map */
.map-modal__route-info,
.map-modal__footer {
    position: relative;
    z-index: 1001;
}

/* Keep map below controls */
#leafletMap {
    position: relative;
    z-index: 1;
}

/* -----------------------------
   Route mode group
----------------------------- */
.map-modal__route-modes {
    display: flex;
    gap: 8px;
}

/* Route mode buttons */
.route-btn {
    appearance: none;
    border: none;
    cursor: pointer;

    padding: 8px 14px;
    border-radius: 999px;

    font-size: 14px;
    font-weight: 500;

    color: #111;
    background: rgba(255, 255, 255, 0.35);

    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);

    transition: all 0.25s ease;
}

/* Hover effect */
.route-btn:hover {
    background: rgba(255, 255, 255, 0.55);
    transform: translateY(-1px);
}

/* Active route mode */
.route-btn.active {
    background: #111;
    color: #fff;
}

/* -----------------------------
   Center My Location button
----------------------------- */
.location-btn {
    appearance: none;
    border: none;
    cursor: pointer;

    padding: 8px 14px;
    border-radius: 999px;

    font-size: 14px;
    font-weight: 500;

    color: #fff;
    background: rgba(13, 110, 253, 0.9);

    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
    transition: all 0.25s ease;
}

/* Hover */
.location-btn:hover {
    background: rgba(13, 110, 253, 1);
    transform: translateY(-1px);
}

/* -----------------------------
   Route Info (Distance & ETA)
----------------------------- */
.map-modal__route-info {
    margin: 10px 14px;
    padding: 10px 14px;

    background: rgba(0, 0, 0, 0.65);
    color: #fff;

    border-radius: 14px;
    font-size: 13px;
    line-height: 1.6;

    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* -----------------------------
   Remove gap between map and footer
----------------------------- */
.map-modal__route-info:empty {
    display: none;
}


/* =====================================================
   FOOTER NAV BUTTONS (MATCH OSM LINK STYLE)
   ADD-ONLY — SAFE
   ===================================================== */

/* Footer layout for navigation */
.map-modal__footer--nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

/* Align footer navigation buttons to the LEFT */
.map-modal__footer--nav {
    justify-content: flex-start;
}

/* Footer buttons */
.footer-btn {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;

    font-weight: 500;
    font-size: 14px;

    padding: 8px 14px;
    border-radius: 14px;

    background:
        linear-gradient(
            135deg,
            rgba(0, 0, 0, 0.35),
            rgba(0, 0, 0, 0.55)
        ),
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.12),
            rgba(255, 255, 255, 0.05)
        );

    color: #fff;

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        0 8px 24px rgba(0, 0, 0, 0.35);

    text-decoration: none;
    transition: all 0.25s ease;
}

/* Hover effect */
.footer-btn {
    background:
        linear-gradient(
            135deg,
            rgba(0, 0, 0, 0.35),
            rgba(0, 0, 0, 0.55)
        ),
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.12),
            rgba(255, 255, 255, 0.05)
        );
    color: #fff;
    transition: 
        background 0.35s ease,
        transform 0.25s ease,
        box-shadow 0.25s ease;
}

.footer-btn:hover {
    background:
        linear-gradient(
            135deg,
            rgba(0, 0, 0, 0.55),
            rgba(0, 0, 0, 0.75)
        ),
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.18),
            rgba(255, 255, 255, 0.08)
        );
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
}


/* Active / selected route */
.footer-btn.active {
    background: rgba(0, 0, 0, 0.75);
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 10px 28px rgba(0, 0, 0, 0.55);
}

/* Primary button — My Location */
.footer-btn--primary {
    background: linear-gradient(
        135deg,
        rgba(13, 110, 253, 0.95),
        rgba(13, 110, 253, 0.75)
    );
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        0 12px 30px rgba(13, 110, 253, 0.55);
}

/* Primary hover */
.footer-btn--primary:hover {
    transform: translateY(-1px) scale(1.04);
    background: linear-gradient(
        135deg,
        rgba(13, 110, 253, 1),
        rgba(13, 110, 253, 0.85)
    );
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.45),
        0 16px 36px rgba(13, 110, 253, 0.65);
}


/* =========================
   Mobile Fullscreen
   ========================= */
@media (max-width: 768px) {
    .map-modal__content {
        width: 100%;
        height: 100%;
        border-radius: 0;

        /* place the map higher than single-post-model popup */
        z-index: 20000; 
        position: relative;
        inset: 0;

        isolation: isolate;
    }

    #leafletMap {
        border-radius: 0;
    }
}



/* =========================
   User Location (Blue Dot)
   ========================= */
.user-location {
    width: 18px;
    height: 18px;
    background: #1e90ff;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 0 6px rgba(30, 144, 255, 0.35);
}

/* Pulsing animation */
.user-location::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: rgba(30, 144, 255, 0.25);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.4); opacity: 1; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* =========================
   Heading / Direction Cone
   ========================= */
.user-heading {
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 28px solid rgba(30, 144, 255, 0.6);
    transform-origin: center bottom;
}


/* =========================
   User Marker Wrapper
   ========================= */
.user-wrapper {
    position: relative;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Center blue dot */
.user-wrapper .user-location {
    position: absolute;
    z-index: 2;
}

/* Center & rotate heading */
.user-wrapper .user-heading {
    position: absolute;
    bottom: 50%;
    transform-origin: center bottom;
    z-index: 1;
}

/* "North" reset button */
.leaflet-control-rotation button {
    width: 36px;
    height: 36px;
    font-size: 18px;
    background: #fff;
    border: none;
    cursor: pointer;
}

.leaflet-control-rotation button:hover {
    background: #f0f0f0;
}

/* Smooth rotation for Leaflet Routing line (Google Maps-like) */
.leaflet-routing-line {
    transition: transform 0.15s linear;
    transform-origin: center center;
}


