body, html {
    height: 100%;
    margin: 0;
    padding: 0;
}

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

.map-container {
    position: relative; 
    width: 100vw;
    height: 100vh;
}

.dropdown-container {
    position: absolute; 
    top: 10px;
    left: 50px;  
    background-color: rgba(255, 255, 255, 0.8); 
    padding: 5px;
    border-radius: 5px;
    z-index: 1000; 
    font: 14px/16px Arial, Helvetica, sans-serif; 
}

.menu-toggle {
    display: none;
    width: 100%;
    padding: 8px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 10px;
    font-size: 16px;
}

.menu-icon {
    margin-right: 8px;
}

@media (max-width: 768px) {
    .dropdown-container {
        top: 0;
        left: 10px;
        right: 10px;
        width: auto;
    }

    .leaflet-top.leaflet-left {
        top: 50px;
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .menu-content {
        display: none;
    }

    .menu-content.show {
        display: block;
    }

    .dropdown-container select,
    .dropdown-container input[type="range"] {
        width: 100%;
        max-width: none;
        box-sizing: border-box;
    }

    /* Mobile combobox styles */
    .combobox-wrapper {
        width: 100%;
        margin: 0;
    }

    .combobox-input {
        width: 100%;
        padding: 12px;
        font-size: 16px; /* Prevent iOS zoom */
    }

    .multi-select-tags {
        flex-wrap: wrap;
        gap: 5px;
        margin: 5px 0;
    }

    .options-list {
        position: fixed;
        left: 0;
        right: 0;
        max-height: 50vh;
        width: auto;
        margin: 0 15px;
    }

    .options-list div {
        padding: 12px 8px;
    }
}

.info { 
    padding: 6px 8px; 
    font: 14px/16px Arial, Helvetica, sans-serif; 
    background: white; 
    background: rgba(255,255,255,0.8); 
    box-shadow: 0 0 15px rgba(0,0,0,0.2); 
    border-radius: 5px; 
}

@media (max-width: 768px) {
  .info {
    margin-top: 60px !important;
    margin-left: 50px !important;
    max-height: 55vh;
    /* A column so only the content scrolls and the toggle stays pinned to the
       bottom of the box. */
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* min-height: 0 so a flex item is actually allowed to shrink and scroll. */
  .info > .info-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
  }

}


.info h4 { 
    margin: 0 0 5px; 
    color: #777; 
}

.legend { 
    text-align: left; 
    line-height: 18px; 
    color: #555; 
}

.legend i { 
    width: 18px; 
    height: 18px; 
    float: left; 
    margin-right: 8px; 
    opacity: 0.7; 
}

@media (max-width: 768px) {
  .legend {
    margin-left: 20px !important
  }
}

.info-box {
    position: absolute;
    top: 50px; 
    left: 20px; 
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    z-index: 1000; 
    font: 14px/16px Arial, Helvetica, sans-serif; 
}

.leaflet-popup-content {
    width: auto;
}

.combobox-wrapper {
    position: relative;
    width: 100%;
    max-width: 250px;
    box-sizing: border-box;
}

.combobox-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    box-sizing: border-box;
}

.options-list {
    display: none;
    position: absolute;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ccc;
    border-top: none;
    background-color: white;
    z-index: 1000;
}

.options-list.visible {
    display: block;
}

.options-list div {
    padding: 8px;
    cursor: pointer;
}

.options-list div:hover {
    background-color: #f0f0f0;
}

.options-list div.selected {
    background-color: #e0e0e0;
}

.multi-select-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}

.multi-select-tag {
    background-color: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.multi-select-tag-remove {
    cursor: pointer;
    color: red;
}

/* Which boundary file the map is drawing, under the menu's controls. */
.layer-info {
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.4;
    color: #666;
    max-width: 250px;
}

.layer-info a {
    color: #1c5da0;
}

.layer-info .inherited {
    color: #b2182b;
}

/* Expands the resting infobox on a phone, where the full breakdown would
   otherwise cover the map. */
.details-toggle {
    display: none;
    width: 100%;
    margin-top: 6px;
    padding: 6px;
    background: #f1f5f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

@media (max-width: 768px) {
    .details-toggle {
        display: block;
        /* Outside the scroll area, so it never scrolls out of reach. */
        flex: 0 0 auto;
    }
}
