/* Leaflet Overrides for Modern Look */
.leaflet-container {
    font-family: 'Inter', sans-serif !important;
}

/* Custom Marker CSS */
.custom-marker {
    background: transparent;
}

.marker-pin {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid white;
    box-sizing: border-box;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s;
}

.custom-marker:hover .marker-pin {
    transform: scale(1.2);
}

/* Marker Cluster Modernization */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-color: rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.marker-cluster div {
    background-color: #3b82f6 !important;
    /* Tailwind Blue-500 */
    color: white !important;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    border-radius: 50%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Popup Modernization */
.leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    color: #1f2937;
    /* Gray-800 */
    border-radius: 1rem !important;
    /* Rounded-2xl */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.leaflet-popup-content {
    margin: 16px !important;
    width: 240px !important;
}

.leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.95);
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
    border-radius: 0.75rem !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    background-color: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(4px);
    color: #374151 !important;
}

.leaflet-control-zoom a:hover {
    background-color: white !important;
}

/* Custom Scrollbar for sidebar */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 20px;
}

.custom-scrollbar:hover::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
}

/* Popup Content Styles */
.popup-content {
    font-family: 'Inter', sans-serif;
}

.popup-content h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #1f2937;
}

.popup-content .badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
}

.popup-content .popup-row {
    margin: 6px 0;
    font-size: 0.85rem;
    color: #4b5563;
}

.popup-content .popup-label {
    font-weight: 600;
    color: #6b7280;
}

/* Table styles */
table {
    border-collapse: separate;
    border-spacing: 0;
}

table thead th {
    background: linear-gradient(to bottom, #f9fafb, #f3f4f6);
    position: sticky;
    top: 0;
    z-index: 10;
}

table tbody tr {
    transition: background-color 0.15s;
}

/* Stats bars animation */
.stats-bar {
    transition: width 0.5s ease-out;
}

/* Measurement markers */
.leaflet-interactive {
    transition: all 0.2s;
}

.leaflet-interactive:hover {
    stroke-width: 3;
}

/* Sliding Panels - Windy Style */
.sliding-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 50;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.sliding-panel.active {
    right: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.9), rgba(249, 250, 251, 0.9));
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.panel-content::-webkit-scrollbar {
    width: 4px;
}

.panel-content::-webkit-scrollbar-track {
    background: transparent;
}

.panel-content::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 20px;
}

.panel-content:hover::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
}

/* Menu Button Animations */
.menu-button {
    animation: slideInRight 0.3s ease-out;
}

.menu-button:hover {
    transform: translateX(-4px);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Panel Overlay */
.panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 25;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.panel-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile Toggle Pulse Animation */
@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }

    100% {
        transform: scale(0.8);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

.pulse-animation {
    animation: pulse-ring 2s infinite;
}

/* Help Button Pulse Animation */
@keyframes pulse-help {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(22, 163, 74, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0);
    }
}

.help-pulse {
    animation: pulse-help 2s ease-in-out infinite;
}

/* Mobile Fixes - Prevent buttons from opening when clicking near them */
@media (max-width: 768px) {

    /* Hide button labels completely on mobile to prevent accidental clicks */
    .group .bg-white\/90.backdrop-blur-md {
        display: none !important;
        pointer-events: none !important;
    }

    /* Ensure only the circular button is clickable */
    button.group {
        width: 56px !important;
        justify-content: center !important;
    }
}