/* General body and layout */
body {
    font-family: sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overscroll-behavior-y: contain;
    overflow: hidden; /* Prevent body scroll */
    background-color: #fff; /* Ensure body background */
}

/* Controls container */
.controls {
    padding: 10px 15px; /* Slightly more padding */
    background-color: #f4f4f4; /* Lighter grey */
    border-bottom: 1px solid #ccc;
    flex-shrink: 0;
    display: flex;
    align-items: center; /* Vertically center items by default */
    flex-wrap: wrap; /* Allow items to wrap */
    gap: 10px 15px; /* Consistent spacing (row gap, column gap) */
    font-size: 0.95em;
}

/* --- Language Select Styling --- */

/* Label for language select */
.controls label[for="language-select"] {
    font-weight: bold;
    margin-right: 5px; /* Space between label and select */
    white-space: nowrap;
    flex-shrink: 0;
}

/* Style the container Choices.js creates */
.choices {
    flex-grow: 1; /* Allow it to take available space */
    min-width: 200px; /* Minimum width before wrapping */
    max-width: 450px; /* Prevent it from becoming excessively wide */
    font-size: 1em; /* Match other control font sizes */
    z-index: 10; /* Ensure dropdown appears above other controls */
    cursor: pointer; /* Indicate interactivity */
}

/* Style the input field within Choices */
.choices__inner {
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 3px 7px;
    font-size: 1em;
    min-height: auto; /* Adjust default min-height */
}
.choices__input {
    font-size: 1em; /* Match parent */
    background-color: #fff; /* Ensure background color */
    margin-bottom: 0; /* Adjust default spacing */
}

/* Style selected items */
.choices__list--multiple .choices__item {
    background-color: #e1eefc; /* Lighter blue */
    border: 1px solid #c4dcf8;
    color: #333;
    border-radius: 3px;
    font-size: 0.9em;
    padding: 3px 8px;
    margin-right: 5px;
    margin-bottom: 3px; /* Adjust spacing for wrapped items */
}

/* Style the remove button on selected items */
.choices[data-type*="select-multiple"] .choices__button,
.choices[data-type*="text"] .choices__button {
     border-left: 1px solid #c4dcf8;
     margin-left: 6px;
     padding-left: 6px;
     opacity: 0.7;
     transition: opacity 0.15s ease;
}
.choices[data-type*="select-multiple"] .choices__button:hover,
.choices[data-type*="text"] .choices__button:hover {
    opacity: 1;
    background-image: url('data:image/svg+xml;utf8,<svg width="10" height="10" viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"><line x1="1" y1="1" x2="9" y2="9" stroke="%23666" stroke-width="1.5"/><line x1="9" y1="1" x2="1" y2="9" stroke="%23666" stroke-width="1.5"/></svg>');
}

/* Style the dropdown list */
.choices__list--dropdown {
    z-index: 11; /* Ensure dropdown is above map/legend */
    border: 1px solid #ccc;
    border-top: none; /* Attached feel */
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: #f2f2f2; /* Highlight color on hover */
}


/* --- Speaker type radios REMOVED --- */
/*
.speaker-label { ... }
.radio-group { ... }
.radio-group label { ... }
.radio-group input[type="radio"] { ... }
*/

/* Basemap toggle */
.toggle-group {
    display: inline-flex; /* Keep checkbox and label together */
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
}
.toggle-group input[type="checkbox"] {
    margin-right: 5px;
    cursor: pointer;
    accent-color: #4a90e2; /* Style checkbox color */
    vertical-align: middle; /* Better alignment */
    width: 15px;
    height: 15px;
}
.toggle-group label {
     vertical-align: middle;
     cursor: pointer;
     user-select: none; /* Prevent text selection on label click */
}


/* Loading indicator */
#loading-indicator {
    margin-left: auto; /* Push loading indicator to the far right */
    color: #555; /* Darker grey */
    font-size: 0.9em;
    padding-left: 15px; /* Ensure some space if controls wrap */
    white-space: nowrap;
    flex-shrink: 0;
}


/* Map container */
#map {
    height: 100%; /* Fill remaining height */
    width: 100%;
    flex-grow: 1; /* Allow map to grow */
    background-color: #e8e8e8; /* Slightly darker subtle background when basemap is off */
    cursor: grab;
    z-index: 1; /* Ensure map is below dropdowns */
}
#map:active {
    cursor: grabbing;
}


/* Legend styles */
#legend {
    position: absolute;
    bottom: 15px; /* Position from bottom */
    right: 15px; /* Position from right */
    background-color: rgba(255, 255, 255, 0.9); /* Slightly more opaque */
    padding: 10px; /* More padding */
    border-radius: 5px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.2); /* Softer shadow */
    z-index: 1000;
    max-height: 200px; /* Max height before scroll */
    overflow-y: auto;
    font-size: 0.85em; /* Slightly larger legend font */
    max-width: 220px;
    line-height: 1.5; /* Improve readability */
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 3px; /* Spacing */
}

.legend-color {
    width: 15px; /* Slightly larger color box */
    height: 15px;
    margin-right: 6px;
    border: 1px solid #aaa; /* Grey border */
    flex-shrink: 0;
}

/* --- Mobile Adjustments --- */
@media (max-width: 768px) {
    .controls {
        padding: 8px 10px;
        gap: 8px 10px; /* Tighter gap */
        font-size: 0.9em;
        /* align-items: center; /* Already default */
    }

    /* Ensure Choices input behaves well on mobile */
    .choices {
       min-width: 180px; /* Adjust mobile min-width */
    }

    #legend {
        right: 10px;
        bottom: 10px;
        font-size: 0.8em;
        max-height: 150px;
        max-width: 180px;
        padding: 8px;
    }

     /* Make Leaflet attribution slightly less intrusive */
    .leaflet-control-attribution {
        font-size: 10px !important;
    }
}

/* Further adjustments for very small screens */
@media (max-width: 480px) {
    .controls {
        font-size: 0.85em;
        gap: 6px 8px;
         /* When wrapping, might look better aligned left */
         /* justify-content: flex-start; */
    }
    .choices {
        min-width: 150px;
        max-width: 100%; /* Allow full width if needed */
    }
    #loading-indicator {
        margin-left: 0; /* Don't push right on small screens if wrapped */
        width: 100%; /* Take full width if it wraps to its own line */
        text-align: right; /* Align text right */
        padding-left: 0;
        padding-right: 5px;
    }
    #legend {
        max-width: 150px;
        max-height: 120px;
        font-size: 0.75em;
        right: 5px;
        bottom: 5px;
        padding: 6px;
    }
    .legend-color {
        width: 12px;
        height: 12px;
    }
}