﻿
/* ✅ Base Styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
}

/* ✅ Map Container */
#map {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    overflow: hidden;
}

/* ✅ Enhanced Custom Marker with Pulsing Animation */
.custom-marker {
    width: 55px;
    height: 44px;
    /*background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);*/
    background: #1da1f2;
    border-radius: 30%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    border: 4px solid white;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
    transition: all 0.2s ease;
    font-weight: bold;
    color: white;
    font-size: 14px;
    animation: slideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

    /* ✅ Pulsing Glow Effect */
    .custom-marker::before {
        content: '';
        position: absolute;
        width: 44px;
        height: 44px;
        background: rgba(102, 126, 234, 0.3);
        border-radius: 50%;
        animation: pulse-glow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
        z-index: -1;
    }

@keyframes pulse-glow {
    0%, 100% {
        transform: scale(1);
        opacity: 0.3;
    }

    50% {
        transform: scale(1.4);
        opacity: 0.1;
    }
}

@keyframes slideIn {
    from {
        transform: scale(0) translateY(15px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* ✅ Hover Effects */
.custom-marker:hover {
    transform: scale(1.2);
    /* background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);*/
    background: #1da1f2;
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.6);
}

    .custom-marker:hover::before {
        animation-duration: 1s;
    }
/* ✅ CRITICAL: Mapbox Popup Z-index Override */
.mapboxgl-popup {
    z-index: 300 !important;
    max-width: none !important;
    pointer-events: auto !important;
}
/* ✅ Enhanced Popup Styling */
.custom-popup .mapboxgl-popup-content {
    padding: 0;
    min-width: 240px;
    max-width: 280px;
    width: 280px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0,0,0,.15);
    background: #fff;
}
/* Mobile */
@media (max-width: 768px) {
    .custom-marker {
        width: 60px;
        height: 60px;
        font-size: 16px;
    }

    .mapboxgl-popup-close-button {
        display: none;
    }

    .custom-marker::before {
        width: 60px;
        height: 60px;
    }

    .custom-popup {
        max-width: none !important;
    }

        .custom-popup .mapboxgl-popup-content {
            width: calc(100vw - 30px) !important;
            max-width: 360px !important;
            min-width: unset !important;
            max-height: 70vh;
            overflow-y: auto;
        }

    .popup-card img {
        height: 140px;
    }

    .popup-header h3 {
        font-size: 15px;
    }

    .popup-body p {
        font-size: 12px;
    }

        .popup-body p span:last-child {
            text-align: left;
        }
}


.popup-card {
    display: flex;
    flex-direction: column;
}

.popup-row {
    display: flex;
    gap: 8px;
    margin: 6px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #f3f3f3;
}

    .popup-row:last-child {
        border-bottom: none;
    }
/* ✅ Popup Image */
.popup-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

/* Compact header */
.popup-header {
    background: #1da1f2;
    padding: 8px 12px;
}

    .popup-header h3 {
        margin: 0;
        font-size: 14px;
        font-weight: 600;
        line-height: 1.4;
        color: #fff;
        /* Long names wrap properly */
        white-space: normal;
        word-break: break-word;
    }

/* Compact body */
.popup-body {
    padding: 10px 12px;
}

    /* Row Layout */
    .popup-body p {
        display: flex;
        align-items: flex-start;
        gap: 8px;
        margin: 6px 0;
        padding-bottom: 6px;
        border-bottom: 1px solid #f3f3f3;
        font-size: 12px;
    }

        .popup-body p:last-child {
            border-bottom: none;
        }

.popup-card .label {
    min-width: 85px;
    flex-shrink: 0;
    font-weight: 600;
    color: #1da1f2;
}

    .popup-card .label::after {
        content: ':';
    }

/* ✅ Popup Value */
.popup-body p span:last-child {
    flex: 1;
    text-align: left;
    font-size: 12px;
    color: #444;
    /* Important for long text */
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    font-family: inherit;
}

/* ✅ Custom Popup Tip */
.custom-popup .mapboxgl-popup-tip {
    border-top-color: white;
    box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.1);
}

/* ✅ Popup Close Button */
.mapboxgl-popup-close-button {
    display: none;
}

/* ✅ Mapbox Controls Enhancement */
.mapboxgl-ctrl {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
    margin: 10px;
}

.mapboxgl-ctrl-group > button {
    background-color: white;
    border-bottom: 1px solid #e0e0e0;
    color: #667eea;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .mapboxgl-ctrl-group > button:hover {
        background-color: #f8f9ff;
        color: #764ba2;
    }

    .mapboxgl-ctrl-group > button:first-child {
        border-radius: 8px 8px 0 0;
    }

    .mapboxgl-ctrl-group > button:last-child {
        border-bottom: none;
        border-radius: 0 0 8px 8px;
    }

/* ✅ Attribution Control */
.mapboxgl-ctrl-attrib {
    background-color: rgba(255, 255, 255, 0.85);
    font-size: 11px;
    border-radius: 4px;
    padding: 4px 6px;
}

    .mapboxgl-ctrl-attrib a {
        color: #667eea;
        text-decoration: none;
    }

        .mapboxgl-ctrl-attrib a:hover {
            color: #764ba2;
            text-decoration: underline;
        }

/* ✅ Scale Control */
.mapboxgl-ctrl-scale {
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #667eea;
    border-radius: 4px;
    color: #667eea;
    font-weight: 500;
}

/* ✅ Loading Indicator */
.map-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: none;
}

    .map-loader.active {
        display: flex;
    }

.spinner {
    border: 4px solid rgba(102, 126, 234, 0.1);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ✅ Toast Notification */
.map-toast {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 14px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    z-index: 1000;
    animation: slideInUp 0.3s ease;
    display: none;
}

    .map-toast.show {
        display: block;
    }

@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ✅ Responsive Design */
/*@media (max-width: 768px) {
            .custom-marker {
                width: 40px;
                height: 40px;
                border-width: 3px;
                font-size: 12px;
            }*/

.custom-marker::before {
    width: 40px;
    height: 40px;
}

.custom-popup .mapboxgl-popup-content {
    min-width: 260px;
    max-width: 350px;
}

.popup-card img {
    height: 160px;
}

.popup-body {
    padding: 10px;
}

.mapboxgl-ctrl {
    margin: 5px;
}

}

/* ✅ Scrollbar Styling */
.popup-body::-webkit-scrollbar {
    width: 6px;
}

.popup-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.popup-body::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

    .popup-body::-webkit-scrollbar-thumb:hover {
        background: #764ba2;
    }


.map-toast.success {
    background: #22c55e;
}

.map-toast.error {
    background: #ef4444;
}

.map-toast.warning {
    background: #f59e0b;
}

