/* Controls Container */
/* Styles for the controls container, now potentially inside other elements */
.controls-container {
    /* Removed absolute positioning, top, left, transform, z-index */
    /* Removed background, padding, border-radius, box-shadow, max-width */
    display: flex;
    align-items: center;
    gap: 12px; /* Consistent spacing */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    justify-content: center;
    /* Styles moved from inline style in index.html */
    margin-bottom: 16px;
    border-bottom: 1px solid #f1f3f4;
    padding-bottom: 16px;
    width: 100%; /* Ensure it takes full width within its parent */
    box-sizing: border-box; /* Include padding in width calculation */
}

/* Styles for disabled sort options */
.disabled-sort-option {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Optional: Style for the container of disabled sort options */
.disabled-sort-container {
    /* You could add a general opacity or other styles here if needed */
    /* For example: opacity: 0.7; */
}

/* Search Options Accordion in Controls Container */
.search-options-accordion {
    width: 100%;
    /* max-width: 500px; */
    margin: 12px 0;
}

.search-options-accordion .accordion-item {
    border: 1px solid #f2f2f2;
    border-radius: 1px;
    overflow: hidden;
    box-shadow: 0px 8px 14px 2px rgba(0, 0, 0, 0.08);
    background-color: #f8fafc;
    padding: 1px;
    background-color: #9bbad4;
}

.search-options-accordion .accordion-header {
    background-color: #f8fafc;
    color: #334155;
    cursor: pointer;
    padding: 12px 16px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 0.85em;
    transition: background-color 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    border-top-left-radius: 7px; /* Match .accordion-item's radius, slightly less to avoid double thick */
    border-top-right-radius: 7px;
    /* Apply bottom radius by default (collapsed state) */
    border-bottom-left-radius: 7px;
    border-bottom-right-radius: 7px;
}

.search-options-accordion .accordion-header:hover {
    background-color: #f3f4f6;
}

.search-options-accordion .accordion-icon {
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.search-options-accordion .accordion-header[aria-expanded="true"] {
    border-bottom: 1px solid #e2e8f0;
    background-color: #f1f5f9;
    /* Remove bottom radius when expanded */
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.search-options-accordion .accordion-header[aria-expanded="true"] .accordion-icon {
    transform: rotate(180deg);
}

.search-options-accordion .accordion-content {
    background-color: #ffffff;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    max-height: 0;
    padding: 0 16px;
    border-top: 0;
}

.search-options-accordion .accordion-header[aria-expanded="true"] + .accordion-content {
    max-height: 1000px;
    padding: 16px;
    border-bottom: 2px solid #e2e8f0;
}

/* Advanced Search Options inside Accordion */
.advanced-search-options {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
    padding-bottom: 8px;
}

.filter-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 4px 0;
}

.filter-section label {
    white-space: nowrap;
}

/* Ensure the category filter has consistent styling */
.filter-section #category-filter {
    width: 100%;
    max-width: 300px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    background-color: white;
}

.filter-section #category-filter:focus {
    outline: none;
    border-color: #0078d7;
    box-shadow: 0 0 0 2px rgba(0,120,215,0.2);
}

/* Custom styling for radio buttons in the accordion */
.search-options-accordion .radio-group {
    min-height: 32px;
}

.search-options-accordion .filter-label {
    font-size: 0.9em;
    font-weight: 500;
    color: #4b5563;
}

/* Verification Status Container */
#verification-status-container {
    position: absolute;
    top: 130px; /* Position below the controls-container */
    width: 250px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    border-radius: 20px; /* Pill shape */
    padding: 6px 12px;
    height: 30px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

#verification-status-text {
    color: #c52222; /* Red color like the balance container */
    font-weight: 600;
    font-size: 0.8em;
}
.search-input-group {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
    /* max-width: 300px; */
}
#search-input {
    padding: 10px 10px;
    border: 1px solid #cbd5e1;
    border-right: none;
    border-radius: 6px 0 0 6px;
    flex-grow: 1; /* Allow input to take available space */
    font-size: 14px;
    height: 40px;
    box-sizing: border-box;
    background-color: #fff;
}
#clear-search-button {
    /* Removed absolute positioning */
    background-color: #0078d7; /* Match search button */
    color: white; /* Make 'x' visible on blue */
    border: 1px solid #0078d7; /* Match search button */
    border-right: none; /* Merge with search button */
    border-radius: 0; /* No radius, it's in the middle of the blue block */
    font-size: 22px; /* Keep font size or adjust as needed */
    cursor: pointer;
    padding: 0 10px; /* Adjusted padding */
    line-height: 1; /* Keep for vertical alignment of 'x' */
    display: none; /* Initially hidden - controlled by JS */
    height: 40px; /* Match other elements */
    box-sizing: border-box;
    /* Add flex properties to center 'x' if it's text content */
    display: flex;
    align-items: center;
    justify-content: center;
}
#clear-search-button:hover {
    color: #6b7280; /* Darker gray on hover */
}
#search-button { padding: 10px 15px; border: 1px solid #0078d7; background-color: #0078d7; color: white; border-radius: 0 6px 6px 0; cursor: pointer; font-size: 14px; height: 40px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; transition: background-color 0.2s ease; border-left: none; /* Merge with clear button */ }
#search-button:hover { background-color: #005a9e; border-color: #005a9e; }

/* Advanced Search Toggle Button */
#advanced-search-toggle-button {
    padding: 10px;
    border: 1px solid #0078d7;
    background-color: #0078d7;
    color: white;
    cursor: pointer;
    height: 40px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    border-left: none;
    border-right: none;
    border-radius: 0px 8px 8px 0px;
}

#advanced-search-toggle-button:hover {
    background-color: #005a9e;
    border-color: #005a9e;
}

#advanced-search-toggle-button img {
    width: 20px;
    height: 20px;
    filter: invert(1);
}

/* Modified Search Options Accordion */
.search-input-group .search-options-accordion {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10;
    display: none; /* Hidden by default */
}

.search-input-group .search-options-accordion.visible {
    display: block; /* Shown when .visible class is added */
}

/* Hide the original accordion header */
.search-input-group .search-options-accordion .accordion-header {
    display: none;
}

/* When the accordion is visible, expand its content */
.search-input-group .search-options-accordion.visible .accordion-content {
    max-height: 1000px; /* Or a sufficiently large value */
    padding: 16px;
    background-color: #ebf2f7;
    /* border-top: 1px solid #e2e8f0; */
}

/* Adjust search input to have a right border radius when the clear button is not visible */
#search-input:not(:focus) + #clear-search-button:not(:hover) + #advanced-search-toggle-button + #search-button {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
#search-input:focus { outline: none; border-color: #0078d7; box-shadow: 0 0 0 2px rgba(0,120,215,0.2); position: relative; z-index: 2; }
#category-filter { padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px; width: 160px; height: 40px; box-sizing: border-box; background-color: white; cursor: pointer; }
#category-filter:focus { outline: none; border-color: #0078d7; box-shadow: 0 0 0 2px rgba(0,120,215,0.2); }

/* --- Radius Control (Now in Bottom Floating Menu) --- */
.radius-options {
    display: flex;
    align-items: center;
    gap: 8px; /* Spacing between label, slider, value */
    /* flex-grow: 1; Removed flex-grow as it's not in controls-container anymore */
    min-width: 220px; /* Prevent it getting too small */
    height: 40px; /* Match height of other controls */
    box-sizing: border-box;
    /* padding: 0 5px; Optional padding within its own block */
}
/* Label styling might be inherited from .filter-label if kept, otherwise add: */
.radius-options .filter-label {
    font-size: 0.9em;
    color: #4b5563;
    font-weight: 500;
    flex-shrink: 0; /* Don't let label shrink */
    margin-right: 0; /* Gap handles spacing */
    /* white-space: nowrap; If label text could wrap */
}
/* Span styling might be inherited from .radius-value-display if kept, otherwise add: */
#main-radius-display {
    font-size: 0.9em;
    color: #374151;
    font-weight: 500;
    min-width: 60px; /* Ensure space for "50 km" or "No Limit" */
    text-align: right;
    flex-shrink: 0; /* Don't let value shrink */
}
/* --- End Radius Control --- */


/* --- Radius Slider Styles (Targets #main-radius-slider) --- */
#main-radius-slider {
    flex-grow: 1; /* Take up remaining space within .radius-options */
    height: 10px;
    cursor: pointer;
    min-width: 100px; /* Adjust minimum slider width */
    vertical-align: middle;
    background: #e5e7eb;
    border-radius: 5px;
    -webkit-appearance: none;
    appearance: none;
    margin-top: 0; /* Remove extra margin */
    margin-bottom: 0; /* Remove extra margin */
    outline: none;
    transition: background-color 0.2s ease;
}

/* Thumb Style for WebKit browsers */
#main-radius-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px; /* Slightly smaller thumb for top bar */
    height: 20px; /* Slightly smaller thumb for top bar */
    background: #0078d7;
    border-radius: 50%;
    cursor: grab;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    margin-top: -5px; /* Adjust vertical alignment for new height */
    transition: background-color 0.2s ease;
}

/* Thumb Style for Firefox */
#main-radius-slider::-moz-range-thumb {
    width: 20px; /* Slightly smaller thumb for top bar */
    height: 20px; /* Slightly smaller thumb for top bar */
    background: #0078d7;
    border-radius: 50%;
    cursor: grab;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: background-color 0.2s ease;
}

/* Active (Dragging) State */
#main-radius-slider:active::-webkit-slider-thumb {
    cursor: grabbing;
    background-color: #005a9e;
}
#main-radius-slider:active::-moz-range-thumb {
    cursor: grabbing;
    background-color: #005a9e;
}

/* Focus State */
#main-radius-slider:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4);
}
#main-radius-slider:focus::-moz-range-thumb {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4);
}

/* Disabled State (Will be controlled by JS based on location availability) */
#main-radius-slider:disabled {
    cursor: not-allowed;
    background-color: #f3f4f6;
}
#main-radius-slider:disabled::-webkit-slider-thumb {
    background-color: #bdc3c7;
    cursor: not-allowed;
    border-color: #e5e7eb;
    box-shadow: none;
}
#main-radius-slider:disabled::-moz-range-thumb {
    background-color: #bdc3c7;
    cursor: not-allowed;
    border-color: #e5e7eb;
    box-shadow: none;
}
/* --- End Radius Slider Styles --- */


/* ========================================== */
/* Location Picker Styles                     */
/* ========================================== */
#map-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;  /* Adjust size as needed */
    height: 30px; /* Adjust size as needed */
    transform: translate(-50%, -50%);
    border: 2px solid rgba(0, 0, 0, 0.7); /* Outer border */
    border-radius: 50%; /* Make it circular */
    background-color: rgba(255, 255, 255, 0.3); /* Semi-transparent background */
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    z-index: 999; /* Below controls/modals, above map tiles */
    pointer-events: none; /* Allow clicks/drags to pass through to the map */
    display: none; /* Initially hidden */
}
/* Inner crosshair lines */
#map-crosshair::before,
#map-crosshair::after {
    content: '';
    position: absolute;
    background-color: rgba(0, 0, 0, 0.7); /* Cross line color */
}
/* Horizontal line */
#map-crosshair::before {
    top: 50%;
    left: 2px;  /* Adjust based on border width */
    right: 2px; /* Adjust based on border width */
    height: 2px; /* Line thickness */
    transform: translateY(-50%);
}
/* Vertical line */
#map-crosshair::after {
    left: 50%;
    top: 2px;    /* Adjust based on border width */
    bottom: 2px; /* Adjust based on border width */
    width: 2px;  /* Line thickness */
    transform: translateX(-50%);
}

#set-location-button {
    position: absolute;
    top: calc(50% + 30px); /* Position below the crosshair */
    left: 50%;
    transform: translateX(-50%);
    z-index: 999; /* Same level as crosshair */
    padding: 10px 20px;
    font-size: 1em;
    font-weight: 600;
    color: white;
    background-color: #0078d7; /* Same blue as search button */
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: none; /* Initially hidden */
    /* Ensure centering is applied */
    left: 50%;
    transform: translateX(-50%);
}

#set-location-button:hover {
    background-color: #005a9e; /* Darker blue on hover */
}

/* Styling for the radius center pin marker */
.radius-center-pin {
    width: 100%; /* Fill the iconSize div */
    height: 100%;
    background-color: #3c6ae7; /* Example blue color, adjust as needed */
    border: 1px solid rgba(0, 0, 0, 0.6); /* Dark border */
    border-radius: 50%; /* Make it a circle */
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
}

/* Class added to body by JS to show the picker */
/* This class might be less crucial if JS directly sets display style */
body.location-picker-active #map-crosshair,
body.location-picker-active #set-location-button {
    /* display: block; */ /* Can keep for fallback, but JS sets display directly */
}
/* ========================================== */
/* END: Location Picker Styles                */
/* ========================================== */

/* --- Loading Indicator (Top Middle, Below Slider) --- */
#loading-indicator {
    position: fixed;
    top: 80px; /* Position from top, below radius slider */
    left: 50%; /* Center horizontally */
    transform: translateX(-50%); /* Ensure perfect centering */
    z-index: 1000; /* Same level as other action buttons */
    display: none; /* Hidden by default, shown by JS */
    align-items: center;
    gap: 8px; /* Space between spinner and text */
    background-color: #fff;
    padding: 8px 15px; /* Button-like padding */
    border: 1px solid #e0e0e0;
    border-radius: 20px; /* Pill shape */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-size: 0.9em;
    color: #555; /* Text color */
    cursor: default; /* Indicate non-interactive */
    margin-top: 10px; /* 10px padding from the radius slider */
}
#loading-indicator .spinner.small { margin-right: 0; }
#loading-indicator span { vertical-align: middle; }

/* ========================================== */
/* Radius Control above Bottom Sheet          */
/* ========================================== */
#bottom-sheet-radius-control {
    position: fixed;
    top: 15px; /* 15px gap from top */
    left: 50%; /* Center horizontally */
    transform: translateX(-50%); /* Perfect centering */
    z-index: 1000;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    border-radius: 20px; /* Pill shape */
    padding: 6px 12px;
    height: 38px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 10px;
}