* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

#map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
}

/* Layer Controls Panel */
#layer-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1;
    min-width: 200px;
}

#layer-controls h3 {
    margin-bottom: 15px;
    font-size: 16px;
    color: #333;
}

#layer-controls h4 {
    margin-bottom: 10px;
    font-size: 14px;
    color: #555;
}

.layer-toggle {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.layer-toggle input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.layer-toggle label {
    cursor: pointer;
    font-size: 14px;
    color: #555;
}

.layer-toggle input[type="checkbox"]:checked + label {
    color: #000;
    font-weight: 500;
}

.basemap-toggle {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.basemap-toggle input[type="radio"] {
    margin-right: 8px;
    cursor: pointer;
}

.basemap-toggle label {
    cursor: pointer;
    font-size: 14px;
    color: #555;
}

.basemap-toggle input[type="radio"]:checked + label {
    color: #000;
    font-weight: 500;
}

/* Info Panel */
#info-panel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1;
    max-width: 350px;
}

#info-panel h2 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #333;
}

#info-panel p {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

/* Mapbox Popup Styling */
.mapboxgl-popup-content {
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

/* Make close button larger and easier to click */
.mapboxgl-popup-close-button {
    font-size: 20px;
    width: 24px;
    height: 24px;
    line-height: 24px;
    padding: 0;
    color: #666;
    font-weight: bold;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.mapboxgl-popup-close-button:hover {
    background-color: #e53e3e;
    color: white;
    transform: scale(1.1);
}

.mapboxgl-popup-content h3 {
    margin-bottom: 8px;
    font-size: 16px;
    color: #333;
}

.mapboxgl-popup-content p {
    margin-bottom: 5px;
    font-size: 13px;
    color: #555;
}

.mapboxgl-popup-content p:last-child {
    margin-bottom: 0;
}

/* ============================================
   MOBILE PANEL CONTROLS
   ============================================ */

/* Toggle Buttons (Mobile Only) */
.panel-toggle-btn {
    display: none; /* Hidden on desktop */
    position: absolute;
    z-index: 10;
    background: white;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    padding: 12px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    transition: all 0.2s ease;
}

.panel-toggle-btn:active {
    transform: scale(0.95);
}

#toggle-layers-btn {
    top: 10px;
    right: 10px;
}

#toggle-info-btn {
    bottom: 10px;
    left: 10px;
}

/* Overlay for closing panels (Mobile Only) */
#panel-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* Close buttons inside panels (Mobile Only) */
.panel-close-btn {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f56565;
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    font-weight: bold;
    z-index: 1001;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.panel-close-btn:active {
    transform: scale(0.9);
}

/* ============================================
   MOBILE RESPONSIVE (≤ 768px)
   ============================================ */

@media (max-width: 768px) {
    
    /* Show toggle buttons */
    .panel-toggle-btn {
        display: block;
    }
    
    /* Show close buttons */
    .panel-close-btn {
        display: block;
    }
    
    /* Layer Controls - Slide in from right */
    #layer-controls {
        position: fixed;
        top: 0;
        right: -100%; /* Start off-screen */
        bottom: 0;
        width: 85%;
        max-width: 320px;
        padding: 60px 20px 20px 20px; /* Extra top padding for close button */
        border-radius: 0;
        z-index: 1000;
        overflow-y: auto;
        transition: right 0.3s ease;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
    }
    
    #layer-controls.active {
        right: 0; /* Slide in */
    }
    
    /* Info Panel - Slide up from bottom */
    #info-panel {
        position: fixed;
        bottom: -100%; /* Start off-screen */
        left: 0;
        right: 0;
        max-width: none;
        width: 100%;
        max-height: 80vh;
        padding: 60px 20px 20px 20px; /* Extra top padding for close button */
        border-radius: 12px 12px 0 0;
        z-index: 1000;
        overflow-y: auto;
        transition: bottom 0.3s ease;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    }
    
    #info-panel.active {
        bottom: 0; /* Slide up */
    }
    
    /* Make headings sticky in panels */
    #layer-controls h3,
    #info-panel h2 {
        position: sticky;
        top: 0;
        background: white;
        padding: 10px 0;
        z-index: 10;
        border-bottom: 2px solid #e2e8f0;
        margin-bottom: 15px;
    }
    
    /* Larger touch targets */
    .layer-toggle,
    .basemap-toggle {
        padding: 8px 0;
    }
    
    .layer-toggle label,
    .basemap-toggle label {
        font-size: 15px;
        padding: 4px 0;
    }
    
    .layer-toggle input[type="checkbox"],
    .basemap-toggle input[type="radio"] {
        width: 20px;
        height: 20px;
        margin-right: 12px;
    }
    
    /* Larger details/summary for easier tapping */
    details summary {
        padding: 10px 0;
        font-size: 14px;
    }
}

/* ============================================
   VERY SMALL SCREENS (≤ 480px)
   ============================================ */

@media (max-width: 480px) {
    #layer-controls {
        width: 100%;
        max-width: none;
    }
    
    .panel-toggle-btn {
        padding: 10px;
        font-size: 18px;
    }
}
