/**
 * Tydrys Mapbox Single Post Map Styles
 * Extracted from MapboxShortcodeSingle.php inline styles
 */

/* Popup constraints */
.mapboxgl-popup {
    max-width: 300px;
}

.mapboxgl-popup-content {
    max-height: 55vh;
    max-height: 55dvh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    width: 275px;
}

.mapboxgl-popup-anchor-bottom {
    margin-bottom: 15px;
}

.mapboxgl-popup-close-button {
    font-size: 18px !important;
    color: #458c94 !important;
    opacity: 1 !important;
    z-index: 5;
    width: 28px !important;
    height: 28px !important;
    line-height: 28px !important;
    padding: 0 !important;
    background: #fff !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    border: none !important;
    right: 6px !important;
    top: 6px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
}

.mapboxgl-popup-close-button:hover {
    color: #333 !important;
    background: #f0f0f0 !important;
}

/* Waypoint info popup styling */
.tydrys-popup .mapboxgl-popup-content {
    border-radius: 10px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 3px 14px rgba(0,0,0,0.15);
}

.tydrys-popup .mapboxgl-popup-content .text-center {
    padding: 15px;
}

.tydrys-popup .mapboxgl-popup-content h3 {
    color: #458c94;
    margin: 0 0 8px 0;
    font-size: 16px;
}

.tydrys-popup .mapboxgl-popup-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.tydrys-popup .mapboxgl-popup-content .waypointlinks {
    color: #458c94;
    font-weight: 600;
    text-decoration: none;
}

.tydrys-popup .mapboxgl-popup-content a {
    color: #458c94;
    text-decoration: none;
    outline: none;
    border: none;
    box-shadow: none;
}

.tydrys-popup .mapboxgl-popup-content a:focus,
.tydrys-popup .mapboxgl-popup-content a:active {
    outline: none;
    border: none;
    box-shadow: none;
}

/* Map controls */
.mapboxgl-ctrl-zoom-out,
.mapboxgl-ctrl-zoom-in,
.mapboxgl-ctrl-fullscreen,
.custom-fs-control,
.mapboxgl-ctrl-shrink {
    height: 40px !important;
}

.mapboxgl-ctrl.mapboxgl-ctrl-group.custom-nav-control {
    height: 40px !important;
    width: 40px !important;
    border-radius: 50% !important;
    color: #FFF !important;
}

.mapboxgl-ctrl-group {
    border-radius: 20px !important;
    width: 40px !important;
    height: auto !important;
    color: #fff !important;
    overflow: hidden;
}

.mapboxgl-ctrl-icon,
.mapboxgl-ctrl-geolocate {
    border-radius: 50%;
    width: 40px !important;
    height: 40px !important;
    color: #fff !important;
}

.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon,
span.mapboxgl-ctrl-icon {
    filter: invert(1) !important;
}

.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon {
    filter: invert(0);
}

/* Category filter */
.filter-map {
    background: #468C94;
}

.selected-filter-map .category-item-icon {
    background: #44b9c6;
    border-radius: 50%;
}

.icon-container {
    display: flex;
    justify-content: space-evenly;
}

/* Map & cards */
#map {
    position: relative;
    width: 100%;
    height: min(500px, 65vh);
    height: min(500px, 65dvh);
}

.card {
    width: 200px;
}

.popup-inner {
    margin-top: 3rem;
}

.close-post-detail {
    position: absolute;
    right: 6px;
    top: 6px;
    color: #458c94;
    padding: 0;
    background: #fff;
    height: 26px;
    width: 26px;
    display: flex;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    cursor: pointer;
    font-size: 16px;
    border: none;
}

.close-post-detail:hover {
    background: #f0f0f0;
    color: #333;
}

.post-detail {
    position: fixed;
    bottom: 20px;
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    z-index: 1000;
    display: flex;
    align-items: center;
    width: 300px;
    max-width: calc(100vw - 40px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* ===== Mobile responsive ===== */
@media screen and (max-width: 480px) {
    .mapboxgl-popup-content {
        width: calc(100vw - 60px) !important;
        max-width: 275px !important;
    }

    .mapboxgl-popup {
        max-width: calc(100vw - 40px) !important;
    }

    .mapboxgl-ctrl-group,
    .mapboxgl-ctrl-icon,
    .mapboxgl-ctrl-geolocate {
        width: 44px !important;
        height: 44px !important;
    }

    #info-route-map {
        height: min(300px, 45vh) !important;
    }

    .close-post-detail {
        min-height: 44px;
        min-width: 44px;
        height: 28px;
        width: 28px;
    }
}

@media screen and (max-height: 500px) and (orientation: landscape) {
    #map {
        height: 80vh;
        height: 80dvh;
    }
}

/* Disable hover on touch */
@media (hover: none) and (pointer: coarse) {
    .mapboxgl-popup-close-button:hover {
        background: #fff;
        color: #458c94;
    }
    .close-post-detail:hover {
        background: #fff;
        color: #458c94;
    }
}

.stretched-link {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.form-group {
    margin-bottom: 20px;
}
