/**
 * Tydrys Mapbox Main Map Styles
 * Extracted from MapboxShortcode.php inline styles
 */

#map {
    scroll-margin-top: -1120px;
    position: relative;
    width: 100%;
    height: min(500px, 65vh);
    height: min(500px, 65dvh);
}

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

.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;
}

/* 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-top-right .mapboxgl-ctrl {
    margin: 5px 0;
}

.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;
}

/* Cards & detail panel */
.card {
    width: 200px;
}

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

.close-post-detail {
    position: absolute;
    right: 0px;
    top: 0;
    color: #fff;
    padding: 5px;
    background: #458c94;
    height: 25px;
    width: 25px;
    display: flex;
    border-radius: 0px 4px 0px 4px;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.post-detail {
    cursor: pointer;
    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: max-content;
    max-width: min(400px, calc(100vw - 40px));
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

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

/* Buzz animation */
.buzz {
    animation: buzz 0.3s ease-in-out, flash 0.3s ease-in-out;
    animation-fill-mode: forwards;
    background-color: red;
}

.buzz button {
    background: #c90000 !important;
    color: white;
}

@keyframes buzz {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
}

@keyframes flash {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.8); }
}

/* ===== 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 {
        width: 44px !important;
        height: auto !important;
    }

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

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

@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;
    }
}
