/* Main layout styles */
body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: #f0f8ff; /* Baby blue background */
}

#header {
    background-color: #800080; /* Purple header */
    color: white;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#map {
    height: 85vh;
    width: 100%;
    z-index: 1; /* Ensure map is beneath controls */
}

/* Controls container (for organization) */
#controls-container {
    position: absolute;
    z-index: 1000;
    width: 100%;
    pointer-events: none; /* Allow clicks to pass through to map */
}

/* Control panel styles */
.control-panel {
    background-color: white;
    padding: 12px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    margin: 10px;
    max-width: 250px;
    pointer-events: auto; /* Re-enable clicks on controls */
}

/* Search control styles */
#search-control {
    position: absolute;
    top: 10px;
    left: 50px;
}

#search-control input {
    padding: 8px;
    width: 150px;
    margin-right: 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

#search-control button {
    background-color: #800080;
    color: white;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 3px;
    transition: background-color 0.3s;
}

#search-control button:hover {
    background-color: #9370DB;
}

.search-options {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

/* Legend styles */
#legends-control {
    position: absolute;
    top: 10px;
    right: 10px;
    max-height: 500px;
    overflow-y: auto;
}

.legend h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #800080;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.legend-section {
    margin: 8px 0;
}

.legend-item {
    margin-bottom: 5px;
    cursor: pointer;
    padding: 3px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.legend-item:hover {
    background-color: #f0f0f0;
}

.color-box {
    display: inline-block;
    width: 15px;
    height: 15px;
    margin-right: 5px;
    border: 1px solid #ccc;
    vertical-align: middle;
}

.legend-reset {
    margin-top: 12px;
    text-align: center;
}

/* Volume filter styles */
#volume-control {
    position: absolute;
    bottom: 10px;
    left: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.filter-item {
    margin-bottom: 8px;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.filter-item:hover {
    background-color: #f0f0f0;
}

.bracket-name {
    font-weight: bold;
    color: #800080;
}

.bracket-range {
    font-size: 12px;
    color: #666;
}

/* View toggle styles */
#view-toggle-control {
    position: absolute;
    bottom: 10px;
    right: 10px;
}

.view-toggle h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #800080;
}

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

.toggle-checkbox {
    height: 0;
    width: 0;
    visibility: hidden;
    position: absolute;
}

.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    width: 50px;
    height: 24px;
    background: #d0d0d0;
    border-radius: 24px;
    position: relative;
    transition: background-color 0.2s;
    margin-right: 10px;
}

.toggle-label:after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 20px;
    transition: 0.2s;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
}

.toggle-checkbox:checked + .toggle-label {
    background: #800080;
}

.toggle-checkbox:checked + .toggle-label:after {
    left: calc(100% - 2px);
    transform: translateX(-100%);
}

#view-mode-label {
    font-size: 13px;
    font-weight: bold;
}

.view-info p {
    font-size: 12px;
    color: #666;
    margin: 5px 0;
}

/* Popup styles */
.leaflet-popup-content {
    max-width: 300px;
    max-height: 400px;
    overflow-y: auto;
}

.info-panel {
    font-size: 13px;
}

.info-tabs {
    display: flex;
    margin-bottom: 8px;
}

.tab {
    padding: 5px 10px;
    background-color: #f2f2f2;
    border: 1px solid #ddd;
    cursor: pointer;
    margin-right: 5px;
    border-radius: 3px 3px 0 0;
    font-size: 12px;
}

.tab.active {
    background-color: #800080;
    color: white;
    border-color: #800080;
}

table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 10px;
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
    font-size: 12px;
}

th {
    background-color: #800080;
    color: white;
}

tr:nth-child(even) {
    background-color: #f2f2f2;
}

/* Button styles */
button {
    background-color: #800080;
    color: white;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 12px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #9370DB;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .control-panel {
        max-width: 200px;
    }
    
    #search-control input {
        width: 120px;
    }
    
    .legend h4, .volume-filter h4, .view-toggle h4 {
        font-size: 12px;
    }
    
    .legend-item, .filter-item {
        font-size: 11px;
    }
    
    .bracket-range {
        font-size: 10px;
    }
    
    button {
        padding: 6px 10px;
        font-size: 11px;
    }
}