/* Enhanced Mobile Responsiveness for Map Popups with Simple Iframe Scaling */
body,
html {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

#map {
    width: 100%;
    height: 100vh;
}

.legend {
    padding: 10px;
    background: white;
    border-radius: 5px;
    border: 1px solid #ccc;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
}

.legend h4 {
    margin: 0 0 10px;
    font-size: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.legend-color {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    border: 1px solid #999;
}

/* Popup container */
.popup-container {
    width: 100%;
    max-width: 280px;
}

.popup-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
}

.popup-tab {
    padding: 8px 12px;
    cursor: pointer;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-bottom: none;
    margin-right: 5px;
    border-radius: 5px 5px 0 0;
    font-size: 13px;
}

.popup-tab.active {
    background: white;
    border-bottom: 1px solid white;
    margin-bottom: -1px;
}

/* Responsive content area for visualization */
.popup-content {
    height: 30vh;
    width: 280px;

}

/* Iframe scaling wrapper */
.iframe-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Create a scaled view for the iframe content */
.iframe-scaler {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Vizframe style */
.viz-frame {
    width: 100%;
    height: 100%;
    border: none;
    transform-origin: 0 0;
}

/* Mobile optimizations */
@media only screen and (max-width: 600px) {
    .popup-content {
        height: 300px;
    }
    
    .leaflet-popup {
        width: 300px;
    
    }
    
    
    .leaflet-popup-content {
        margin: 8px !important;
        width: calc(95vw - 20px) !important;
        max-width: 100%;
    }
    
    .popup-container {
        width: 100%;
        max-width: 100%;
    }
    
    .popup-tab {
        padding: 5px 8px;
        font-size: 12px;
    }
    
    .popup-title {
        font-size: 13px;
    }
}

.tab-content {
    display: none;
    height: 100%;
    width: 100%;
}

.tab-content.active {
    display: block;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    font-size: 14px;
    color: #666;
}

.popup-title {
    margin: 5px 0;
    font-size: 14px;
    text-align: center;
}

/* Compact popup for small screens */
.compact-popup .leaflet-popup-content-wrapper {
    padding: 5px;
}

.compact-popup .leaflet-popup-content {
    margin: 5px;
}