/* ================================================
    1. GLOBAL DROPDOWN STYLES
    (Styles for all custom dropdowns)
    ================================================ */
:root {
    --slider-track-color-inactive: #e0e2e7;
    --slider-track-color-active: #9B51E0;
    --slider-thumb-border: #fff;
    --slider-thumb-fill: #9B51E0;
    --histogram-bar-inactive: #f0f2f5;
    --histogram-bar-active: #9B51E0;
}

form li.options-item input[type=checkbox],
form li.options-item input[type=radio],
form li.options-item-save-search input[type=radio] {
    display: none;
}

/* Wrapper to position dropdown correctly */
.custom-select-wrapper {
    position: relative;
    user-select: none;
    width: 100%;
    max-width: max-content;
}

/* Style for the visible select box */
.custom-select {
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px;
    background: var(--bg-primary);
    padding: var(--space-xl);
    gap: 8px;
}

.custom-select-wrapper.atikia-sort-select-wrapper .custom-options {
    min-width: max-content !important;
}

.custom-select-wrapper.atikia-sort-select-wrapper .options-list {
    flex-direction: column !important;
}

.custom-select-wrapper.atikia-sort-select-wrapper .options-item {
    width: 100% !important;
}

.custom-select-trigger {
    font-size: var(--text-s);
    line-height: normal;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Arrow icon styling */
.arrow {
    transform: rotate(0);
    transition: transform 0.3s ease;
    min-width: max-content;
}

.custom-select-wrapper.open .arrow {
    transform: rotate(180deg);
}

/* Dropdown container */
.custom-options {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    padding: var(--space-xl);
    background: var(--fg-white);
    border-radius: 12px;
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 350px;
    max-width: max-content;
}

/* Fix the dropdown at the bottom */
@media only screen and (max-width: 991px) {
    .custom-options {
        position: fixed;
        top: unset;
        bottom: 0;
        max-width: 100vw !important;
        transform: translateY(100%);
        transition: transform 0.3s ease-in-out;
        box-shadow: 0 -4px 8px -4px rgba(16, 24, 40, 0.18);
    }
}

.custom-select-wrapper.open .custom-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Footer (shared by all filters) */
.custom-options-footer {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 10px;
    margin-top: var(--space-xl);
}

/* Buttons (shared by all filters) */
.custom-select-btn {
    padding: 10px 12px;
    border-radius: 8px;
    box-shadow: 0 1px 2px 0 rgba(16, 24, 40, 0.05);
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    text-align: center;
}

.btn-done {
    background-color: var(--bg-primary-solid);
    color: var(--button-primary-fg);
    width: 100%;
}

.btn-done:hover {
    background-color: var(--brand-950);
    color: var(--button-primary-fg_hover);
}

.btn-reset {
    background-color: var(--bg-primary);
    color: var(--text-tertiary);
    border: 1px solid var(--border-primary);
    min-width: max-content;
}

.btn-reset:hover {
    background-color: var(--brand-950);
    color: var(--button-primary-fg_hover);
}


/* ================================================
    2. CHECKBOX FILTER STYLES
    (Specific to the checkbox dropdown)
    ================================================ */

/* This class on the wrapper sets a specific width */
/*
.checkbox-filter.custom-select-wrapper {
    width: 300px;
}
*/

/* Search box */
.search-box {
    width: 100%;
    border: none;
    padding: var(--space-xl);
    background-color: var(--bg-primary);
    border-radius: 10px;
    margin-bottom: 12px;
    box-sizing: border-box;
    color: var(--text-secondary);
    font-size: var(--text-m);
    line-height: 1.5em;
}

.search-box::placeholder {
    font-size: var(--text-m);
    color: var(--text-quarterary);
}

.search-box:focus {
    outline: none;
    box-shadow: 0 1px 2px 0 rgba(22, 0, 41, 0.05), 0 0 0 4px rgba(186, 107, 255, 0.24);
}

/* Checkbox list styling */
.options-list-wrapper {
    gap: var(--space-2xl);
}

.amenities-filter .options-list-wrapper {
    flex-direction: row;
    flex-wrap: nowrap;
}

.amenities-filter .custom-options {
    min-width: max-content;
}

.options-list-blk {
    gap: var(--space-lg);
}

.options-list-blk span {
    font-size: var(--text-xs);
    font-weight: 400;
    line-height: normal;
    text-transform: uppercase;
    color: var(--fg-tertiary);
}

.amenities-filter .options-list {
    flex-direction: column;
    overflow-y: auto;
    flex-wrap: nowrap;
    width: 100%;
}

.options-list {
    display: flex;
    flex-direction: row;
    gap: var(--space-lg);
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 350px;
    overflow-y: auto;
}

form li.options-item {
    padding: var(--space-xs);
    border: 1px solid var(--border-tertiary);
    border-radius: 10px;
    transition: background-color 0.2s ease-in-out, border 0.2s ease-in-out, color 0.2s ease-in-out;
    cursor: pointer;
    background-color: var(--bg-primary);
    width: max-content;
}

/* START: styling item that has the input displayed. */
form li.options-item-check {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.options-list:has(.options-item-check) {
    gap: var(--space-md);
}

form li.options-item-check label {
    color: var(--text-secondary);
    margin-bottom: 0;
    cursor: pointer;
}

form li.options-item-check input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    width: 20px;
    height: 20px;
    padding: 3px;
    /* 5. Optional: Improve usability. */
    position: relative;
    /* Needed to position the checkmark */
    cursor: pointer;
    vertical-align: middle;
    /* Aligns the box with any label text */
    overflow: hidden;
    background-color: var(--fg-white);
    transition: 0.2s ease-in-out;
}

form li.options-item-check input:checked {
    background-color: var(--bg-brand-solid);
    border-color: var(--bg-brand-solid);
}

form li.options-item-check input:checked::after {
    content: '✓';
    /* You can use a checkmark character */
    font-size: 14px;
    font-weight: bold;
    color: var(--fg-white);

    /* This centers the checkmark inside the box */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* END: styling item that has the input displayed. */


/*****************************/


/* START: Styling the save search options item */
form li.options-item-save-search {
    display: flex;
    width: 100%;
    justify-content: center;
    padding: var(--space-lg);
    background-color: var(--bg-secondary);
    border-radius: 8px;
}

form li.options-item-save-search label {
    font-size: var(--text-s);
    font-style: normal;
    font-weight: 400;
    line-height: 1.14em;
    color: var(--button-seconddary-fg);
}

form li.options-item-save-search:has(input:checked) {
    background-color: var(--button-secondary-color-bg_hover);
}

form li.options-item-save-search:has(input:checked) label {
    color: var(--button-secondary-color-fg);
}

/* END: Styling the save search options item */


.custom-select-wrapper.radio-filter .custom-options {
    min-width: max-content;
    left: unset;
}

.custom-select-wrapper.radio-filter .options-list {
    flex-direction: column;
    width: 100%;
}

.option-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    border-radius: 8px;
    transition: background-color 0.2s;
    padding: var(--space-xs);
}

form li.options-item label {
    padding: var(--space-xs) var(--space-md);
    flex-grow: 1;
    color: var(--text-tertiary);
    font-size: var(--text-s);
    line-height: normal;
    margin-bottom: 0;
    cursor: pointer;
}

form li.options-item svg {
    background: var(--bg-secondary);
    padding: 10px;
    border-radius: 8px;
}

/* Input (hidden but used for :has) */
.option-content input[type="checkbox"],
.option-content input[type="radio"] {
    display: none;
}

/* Active state for Checkboxes & Radios (with manual class support) */
form li.options-item.manual-active,
form li.options-item:has(input:checked) {
    border-color: var(--border-brand);
}

form li.options-item.manual-active .option-content,
form li.options-item:has(input:checked) .option-content {
    background: var(--bg-brand-primary);
    color: var(--text-brand-primary);
}

form li.options-item.manual-active label,
form li.options-item:has(input:checked) label {
    color: var(--text-brand-primary);
}

form li.options-item.manual-active svg,
form li.options-item:has(input:checked) svg {
    background: linear-gradient(180deg, #C583FF 0%, #A064D5 100%);
}

form li.options-item.manual-active path,
form li.options-item:has(input:checked) path {
    fill: var(--fg-white);
}


/* ================================================
    3. PRICE FILTER STYLES
    (Specific to the price/range slider)
    ================================================ */

/* This class on the wrapper sets a specific width */
/*
.price-filter.custom-select-wrapper {
    width: 350px;
}
*/

/* The .custom-options in this filter needs a bit more gap */
.price-filter .custom-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- Histogram Styles --- */
.histogram-container {
    width: 100%;
    height: 100px;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.histogram {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.histogram-bar {
    fill: var(--histogram-bar-inactive, #f0f2f5);
    transition: fill 0.2s ease-in-out;
}

/* --- Range Slider Styles --- */
.range-slider-container {
    position: relative;
    height: 10px;
    width: 100%;
    display: flex;
    align-items: center;
}

.range-slider-container input[type="range"] {
    position: absolute;
    width: 100%;
    height: 10px;
    background: transparent;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    z-index: 2;
    margin: 0;
    padding: 0;
}

.range-slider-container input[type="range"]:focus {
    outline: none;
}

/* Custom Thumb (Chrome/Safari) */
.range-slider-container input[type="range"]::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    border: 3px solid var(--slider-thumb-border, #fff);
    border-radius: 50%;
    background: var(--slider-thumb-fill, #9B51E0);
    cursor: grab;
    pointer-events: all;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin-top: -5px;
    /* Center thumb on track */
}

/* Custom Thumb (Firefox) */
.range-slider-container input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border: 3px solid var(--slider-thumb-border, #fff);
    border-radius: 50%;
    background: var(--slider-thumb-fill, #9B51E0);
    cursor: grab;
    pointer-events: all;
    appearance: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Hide default tracks */
.range-slider-container input[type="range"]::-webkit-slider-runnable-track {
    background: transparent;
}

.range-slider-container input[type="range"]::-moz-range-track {
    background: transparent;
}

/* ▼▼▼ CLASS RENAMED HERE ▼▼▼ */
/* Custom Track (the bar itself) */
.range-slider-track {
    position: absolute;
    width: 100%;
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(to right,
            var(--slider-track-color-inactive, #e0e2e7) 0%,
            var(--slider-track-color-inactive, #e0e2e7) var(--track-fill-start, 0%),
            var(--slider-track-color-active, #9B51E0) var(--track-fill-start, 0%),
            var(--slider-track-color-active, #9B51E0) var(--track-fill-end, 100%),
            var(--slider-track-color-inactive, #e0e2e7) var(--track-fill-end, 100%),
            var(--slider-track-color-inactive, #e0e2e7) 100%);
    z-index: 1;
}

/* Range Labels (50K, 10M+) */
.range-labels {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
    font-size: var(--text-s);
    font-weight: 700;
    color: var(--text-tertiary);
    margin-top: -10px;
}

/* --- Price Input Fields --- */
.price-inputs {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    width: 100%;
    gap: 10px;
}

.price-inputs input[type="number"] {
    flex-grow: 1;
    padding: 12px;
    border-radius: 12px;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    font-family: 'Aeonik', sans-serif;
    font-size: var(--text-s);
    text-align: center;
    -moz-appearance: textfield;
    border: 1px solid var(--border-secondary);
    line-height: 1.55em;
    transition: 0.3s ease-in-out;
}

.price-inputs input[type="number"]::-webkit-outer-spin-button,
.price-inputs input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.price-inputs input[type="number"]:focus {
    outline: none;
    border-color: var(--slider-track-color-active, #9B51E0);
    background-color: var(--bg-primary);
}

.price-separator {
    color: var(--text-tertiary);
    font-size: 20px;
    font-weight: 500;
}


/* ================================================
    X. BUY/RENT TOGGLE STYLES
    ================================================ */

.buy-rent-toggle-wrapper {
    /* Container for the toggle if you need to position it */
    display: inline-block;
    padding: var(--space-md);
    /* Example padding */
    background-color: var(--bg-primary);
    border-radius: var(--radius-xl);
}

.buy-rent-toggle {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background-color: var(--bg-primary);
    /* Base background for the toggle container */
}

.buy-rent-toggle input[type="radio"] {
    display: none;
    /* Hide default radio buttons */
}


.buy-rent-toggle .toggle-option {
    position: relative;
    z-index: 2;
    padding: 10px var(--space-lg);
    font-size: var(--text-s);
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s ease-in-out;
    border-radius: var(--radius-l);
    text-align: center;
    margin-bottom: 0;
    line-height: 1.43em;
}

/* Manual active class support */
.buy-rent-toggle .buy-rent-item.active-selection .toggle-option,
.buy-rent-toggle .buy-rent-item:has(input:checked) .toggle-option {
    background-color: var(--bg-brand-primary);
    color: var(--text-brand-secondary);
}