/* Reset & Full Screen Layout */
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    display: flex;
    flex-direction: column;
}

/* Map Header */
#map-header {
    background: #ffffff;
    padding: 12px 20px;
    border-bottom: 2px solid #333333;
    z-index: 1000;
}

#map-header h1 {
    margin: 0;
    font-size: 20px;
    color: #222222;
    line-height: 1.2;
}

/* Main Map Area */
#map {
    flex-grow: 1;
    width: 100%;
    z-index: 1; 
}

/* Map Footer Source Line */
#map-footer {
    background: #f8f9fa;
    padding: 8px 15px;
    font-size: 11px;
    color: #555555;
    border-top: 1px solid #cccccc;
    z-index: 1000;
}

/* Floating UI Panel (Desktop View) */
#ui-container {
    position: absolute;
    top: 80px;
    left: 60px; /* Positioned on top left, cleared for zoom controls */
    background: #ffffff;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000; 
    width: 250px;
    transition: all 0.3s ease;
}

/* Toggle button hidden on desktop */
#legend-toggle {
    display: none;
}

label {
    display: block;
    font-size: 13px;
    margin-bottom: 8px;
    color: #333333;
}

select {
    width: 100%;
    padding: 6px;
    font-size: 13px;
    margin-bottom: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Legend Styling */
.legend div {
    margin-bottom: 6px;
    font-size: 12px;
    display: flex;
    align-items: center;
    color: #444444;
}

.legend span {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-right: 8px;
    border: 1px solid #bbbbbb;
    border-radius: 2px;
}

/* ==========================================
   MOBILE RESPONSIVE BREAKPOINT
   ========================================== */
@media (max-width: 768px) {
    #map-header {
        padding: 10px 15px;
    }
    
    #map-header h1 {
        font-size: 16px;
    }

    #ui-container {
        top: 65px;
        left: 10px;
        width: calc(100% - 70px);
        max-width: 260px;
        padding: 10px;
        background: rgba(255, 255, 255, 0.95);
    }

    /* Show Toggle Button on Mobile */
    #legend-toggle {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        background: none;
        border: none;
        font-size: 13px;
        font-weight: bold;
        color: #333;
        padding: 0 0 5px 0;
        cursor: pointer;
    }

    /* Collapsed state behavior on Mobile */
    #ui-container.collapsed #ui-content {
        display: none;
    }

    label {
        font-size: 12px;
        margin-top: 5px;
        margin-bottom: 4px;
    }

    select {
        margin-bottom: 8px;
        padding: 4px;
    }

    .legend div {
        font-size: 11px;
        margin-bottom: 4px;
    }

    .legend span {
        width: 14px;
        height: 14px;
    }
}