/* ==========================================================================
   [omnicasa_filters] — Filter bar
   ========================================================================== */

.oc-filters-wrap {
    display: flex;
    flex-direction: column;
}

.oc-filters__reset-bar {
    margin-bottom: 8px;
}

.oc-filters__reset {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.oc-filters__reset:hover {
    text-decoration: underline;
    color: #111;
}

.oc-filters {
    margin: 0;
    padding: 0;
}

/* Override theme/Elementor global button & form styles */
.oc-filters select,
.oc-filters button,
.oc-filters input,
.oc-filters select:hover,
.oc-filters button:hover,
.oc-filters input:hover,
.oc-filters select:focus,
.oc-filters button:focus,
.oc-filters input:focus,
.oc-filters select:active,
.oc-filters button:active,
.oc-filters input:active {
    outline: none !important;
    box-shadow: none !important;
    border-width: 0 !important;
    border-color: transparent !important;
    border-style: solid !important;
}

/* Prevent theme from overriding text/background colors */
.oc-filters .oc-multiselect__toggle,
.oc-filters .oc-multiselect__toggle:hover,
.oc-filters .oc-multiselect__toggle:focus,
.oc-filters .oc-multiselect__toggle:active {
    background-color: transparent !important;
    color: #333 !important;
}

.oc-filters .oc-filters__search,
.oc-filters .oc-filters__search:hover,
.oc-filters .oc-filters__search:focus,
.oc-filters .oc-filters__search:active {
    background-color: #6CA837 !important;
    color: #333 !important;
}

.oc-filters .oc-filters__search:hover {
    background-color: #6CA837 !important;
}

.oc-filters__bar {
    display: flex;
    align-items: stretch;
    gap: 20px;
}

/* --- Field containers --- */

.oc-filters__field {
    position: relative;
    display: flex;
    align-items: center;
}

.oc-filters__field--property_type {
    flex: 0 !important;
}

/* Border only on light fields (city, price/surface range, sort) */
.oc-filters__field--multiselect,
.oc-filters__field--range,
.oc-filters__field--sort {
    border: 1px solid #e0e0e0 !important;
    border-radius: 5px;
}

.oc-filters__field--range {
    overflow: hidden;
}

.oc-filters__field:last-of-type {
    border-right: none;
}

/* --- Selects (taxonomy, bedrooms, sort) --- */

.oc-filters__field--select select,
.oc-filters__field--sort select {
    appearance: none;
    -webkit-appearance: none;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 10px 40px 10px 20px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    min-width: 150px;
    max-width: 200px;
    height: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23fff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.oc-filters__field--select select:hover,
.oc-filters__field--select select:focus,
.oc-filters__field--select select:active,
.oc-filters__field--sort select:hover,
.oc-filters__field--sort select:focus,
.oc-filters__field--sort select:active {
    outline: none;
}

.oc-filters__field--select select:hover,
.oc-filters__field--select select:focus,
.oc-filters__field--select select:active {
    background-color: #444;
}

.oc-filters__field--select select option,
.oc-filters__field--sort select option {
    background: #fff;
    color: #333;
}

/* --- Sort: lighter style --- */

.oc-filters__field--sort select {
    background-color: transparent;
    color: #333;
    font-weight: 400;
    font-size: 1rem;
    min-width: 180px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23333' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* --- Multiselect dropdown (city) --- */

.oc-filters__field--multiselect {
    position: relative;
    flex: 1;
}

.oc-multiselect__toggle {
    appearance: none;
    border: none;
    background: transparent;
    width: 100%;
    padding: 10px 40px 10px 40px !important;
    font-size: 1rem;
    color: #333;
    cursor: pointer;
    min-width: 200px !important;
    width: 100% !important;
    height: 100%;
    text-align: left !important;
    white-space: nowrap;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0'/%3E%3Cpath d='M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23333' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat, no-repeat;
    background-position: left 14px center, right 16px center;
}

.oc-multiselect__toggle:focus {
    outline: none;
}

.oc-multiselect__label {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.oc-multiselect__dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 100%;
    max-height: 250px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.oc-filters__field--multiselect.is-open .oc-multiselect__dropdown {
    display: block;
}

.oc-multiselect__search {
    display: block;
    width: 100%;
    padding: 8px 16px;
    font-size: 14px;
    border: none !important;
    border-bottom: 1px solid #eee !important;
    outline: none;
    box-sizing: border-box;
    border-radius: 0;
}

.oc-multiselect__search::placeholder {
    color: #999;
}

.oc-multiselect__clear {
    display: block;
    width: 100%;
    padding: 8px 16px;
    font-size: .9rem !important;
    color: #999 !important;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    border-bottom: 1px solid #eee !important;
    padding: 8px 16px !important;
    cursor: pointer;
    text-align: left;
}

.oc-multiselect__clear:hover,
.oc-multiselect__clear:focus,
.oc-multiselect__clear:active {
    color: #333 !important;
    background-color: #f5f5f5 !important;
    outline: none;
    box-shadow: none;
}

.oc-multiselect__option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 1rem;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
}

.oc-multiselect__option:hover {
    background: #f5f5f5;
}

.oc-multiselect__option input[type="checkbox"] {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1.5px solid #ccc !important;
    border-radius: 3px !important;
    background: #fff !important;
    background-color: #fff !important;
    box-shadow: none !important;
    outline: none !important;
    cursor: pointer;
    position: relative;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.oc-multiselect__option input[type="checkbox"]:checked {
    background: #6CA837 !important;
    background-color: #6CA837 !important;
    border-color: #6CA837 !important;
}

.oc-multiselect__option input[type="checkbox"]:checked::after {
    content: '' !important;
    position: absolute !important;
    left: 4.5px !important;
    top: 1.5px !important;
    width: 4px !important;
    height: 8px !important;
    border: solid #fff !important;
    border-width: 0 2px 2px 0 !important;
    transform: rotate(45deg) !important;
}

/* --- Range inputs (price, surface) --- */

.oc-filters__field--range {
    display: flex;
    gap: 0;
}

.oc-filters__field--range input,
.oc-filters__field--range input:hover,
.oc-filters__field--range input:focus,
.oc-filters__field--range input:active {
    border: none !important;
    border-right: 1px solid #e0e0e0 !important;
    background: transparent;
    padding: 10px 16px;
    font-size: 1rem;
    color: #333;
    width: 120px;
    height: 100%;
    border-radius: 0 !important;
}

.oc-filters__field--range input:last-child,
.oc-filters__field--range input:last-child:hover,
.oc-filters__field--range input:last-child:focus,
.oc-filters__field--range input:last-child:active {
    border-right: none !important;
}

.oc-filters__field--range input::placeholder {
    color: #999;
}

.oc-filters__field--range input:focus {
    outline: none;
    background: #fff;
}

/* Hide number input spinners */
.oc-filters__field--range input::-webkit-outer-spin-button,
.oc-filters__field--range input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.oc-filters__field--range input[type="number"] {
    -moz-appearance: textfield;
}

/* --- Search button --- */

.oc-filters__search {
    appearance: none;
    border: none !important;
    border-color: transparent !important;
    border-radius: 5px !important;
    background: #6CA837;
    color: #333;
    padding: 10px 14px !important;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.oc-filters__search:hover {
    background: #6CA837 !important;
}

/* Icon-only search button (inline/non-redirect mode) */
.oc-filters__search--icon {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.oc-filters__search--icon svg {
    display: block;
}

.oc-filters__search-label {
    display: none;
}

/* --- Mobile filter toggle (inline mode only) --- */

.oc-filters__mobile-toggle {
    display: none !important;
}

/* --- Responsive --- */

@media (max-width: 1024px) {
    .oc-filters__bar {
        flex-wrap: wrap;
    }

    .oc-filters__field {
        flex: 1 1 auto;
        min-width: 45%;
    }

    .oc-filters__field--select select,
    .oc-filters__field--sort select,
    .oc-filters__field--city input {
        width: 100%;
    }

    .oc-filters__search {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 1024px) {
    /* Show toggle button, hide inline form */
    .oc-filters-wrap:has(.oc-filters--inline) .oc-filters__mobile-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        padding: 12px 20px;
        font-size: 15px;
        font-weight: 600;
        color: #fff;
        background: #333 !important;
        background-color: #333 !important;
        border: none !important;
        border-radius: 5px !important;
        cursor: pointer;
        box-shadow: none !important;
        outline: none !important;
        appearance: none !important;
    }

    /* Hide sort inside popup, show mobile sort outside */
    .oc-filters-wrap:has(.oc-filters--inline) .oc-filters--inline .oc-filters__field--sort {
        display: none !important;
    }

    .oc-filters-wrap:has(.oc-filters--inline) .oc-filters__mobile-sort {
        display: block;
        margin-top: 25px;
    }

    .oc-filters__mobile-sort .oc-filters__field--sort {
        border: 1px solid #e0e0e0 !important;
        width: 100%;
    }

    .oc-filters__mobile-sort .oc-filters__field--sort select {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
    }

    .oc-filters-wrap:has(.oc-filters--inline) .oc-filters--inline {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9999;
        background: #fff;
        overflow-y: auto;
        padding: 60px 20px 20px;
        margin: 0;
        transform: translateX(100%);
        visibility: hidden;
        transition: transform 0.3s ease, visibility 0.3s ease;
    }

    .oc-filters-wrap:has(.oc-filters--inline).oc-mobile-open .oc-filters--inline {
        transform: translateX(0);
        visibility: visible;
    }

    .oc-filters-wrap:has(.oc-filters--inline).oc-mobile-open .oc-filters__bar {
        flex-direction: column;
        gap: 20px;
    }

    .oc-filters-wrap:has(.oc-filters--inline).oc-mobile-open .oc-filters__field {
        min-width: 100% !important;
        border-right: none;
    }

    .oc-filters-wrap:has(.oc-filters--inline).oc-mobile-open .oc-filters__field--select select {
        width: 100%;
        max-width: 100%;
    }

    .oc-filters-wrap:has(.oc-filters--inline).oc-mobile-open .oc-multiselect__toggle {
        min-width: 100% !important;
    }

    .oc-filters-wrap:has(.oc-filters--inline).oc-mobile-open .oc-filters__field--range input {
        flex: 1;
    }

    .oc-filters-wrap:has(.oc-filters--inline).oc-mobile-open .oc-filters__search {
        width: 100%;
        justify-content: center;
        padding: 14px 28px;
    }

    .oc-filters-wrap:has(.oc-filters--inline).oc-mobile-open .oc-filters__search-label {
        display: inline;
    }

    /* Close button at top of mobile pane */
    .oc-filters__mobile-close {
        display: none;
    }

    .oc-filters-wrap:has(.oc-filters--inline).oc-mobile-open .oc-filters__mobile-close {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 12px;
        right: 12px;
        z-index: 10000;
        width: 36px;
        height: 36px;
        background: none !important;
        background-color: transparent !important;
        border: none !important;
        cursor: pointer;
        color: #333;
        padding: 0 !important;
        box-shadow: none !important;
        outline: none !important;
    }
}

@media (min-width: 1025px) {
    .oc-filters__mobile-close {
        display: none !important;
    }

    .oc-filters__mobile-sort {
        display: none !important;
    }
}

@media (max-width: 640px) {
    .oc-filters__field {
        min-width: 100%;
        border-right: none;
    }

    .oc-filters__field--range input {
        flex: 1;
    }
}

/* --- Redirect mode on mobile: stack filters full-width --- */
@media (max-width: 1024px) {
    .oc-filters--redirect .oc-filters__bar {
        flex-direction: column;
        gap: 20px;
    }

    .oc-filters--redirect .oc-filters__field,
    .oc-filters--redirect .oc-filters__search {
        width: 100%;
        min-width: 0;
    }

    .oc-filters--redirect .oc-filters__field--property_type {
        flex: 1 !important;
    }

    .oc-filters--redirect .oc-filters__field--select select,
    .oc-filters--redirect .oc-filters__field--sort select,
    .oc-filters--redirect .oc-multiselect__toggle,
    .oc-filters--redirect .oc-multiselect__label {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .oc-filters--redirect .oc-filters__field--range input {
        flex: 1;
        width: auto !important;
    }

    .oc-filters--redirect .oc-filters__search {
        justify-content: center;
    }
}
