
/* ========== Layout and styling ========== */

form#ajax-filter-form{
    padding: 25px 15px;
    background: #fff;
    border-radius: 25px;
}

.area-slider-wrapper{
    width: 100%;
}

.price-slider-wrapper{
    width: 100%;
}

.rh-filter-layout {
    display: flex;
    flex-wrap: nowrap;
    gap: 2.5rem;
    max-width: 1200px;
    margin: 0;
    padding: 1rem 0;
}

.filter-submit-btn {
    display: none;
}

/* Blur effect during AJAX load */
.loading-properties {
    width: 100%;
    filter: blur(3px);
    pointer-events: none;
}

.rh-filter-column {
    flex: 0 0 350px;
    position: static;
    transition: transform 0.3s ease;
    margin-right: 2rem;
}

.rh-properties-filter-container {
    background: var(--rh-global-color-primary-light);
    border-radius: 15px;
    padding: 20px 15px;
    height: auto;
}

.rh-properties-filter-container .filter-heading {
    margin-bottom: 1rem;
    color: var(--rh-global-color-primary);
    font-weight: bold;
}

.filter-form .filter-row {
    gap: 15px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1.5rem;
}

.filter-row.contener {
    display: flex;
    flex-wrap: wrap;
    gap: 0px;
}

.filter-row.contener .half-row {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
}

/* Basic field styles */
.filter-form select,
.filter-form input[type="number"] {
    flex: 1;
    min-width: 45%;
    padding: 1rem 2rem;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0px 0px 7px -2px rgba(var(--rh-global-color-primary-rgb), 0.5);
    border: none;
    color: var(--rh-global-color-text);
}

.filter-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: space-between;
}

.filter-submit-btn,
.filter-reset-btn {
    background: var(--rh-global-color-primary);
    color: #fff;
    border: none;
    border-radius: 15px;
    padding: 0.5rem 2.25rem;
    cursor: pointer;
    transition: background 0.2s;
}

.filter-submit-btn:hover{
    background: transparent;
    color: var(--rh-global-color-primary);
    border: 2px solid var(--rh-global-color-primary);
}

.filter-reset-btn {
    border: 2px solid var(--rh-global-color-primary);
    background: transparent;
    color: var(--rh-global-color-primary);
    width: 100%;
}

.filter-reset-btn:hover{
    background: var(--rh-global-color-primary);
    color: #fff;
}

.no-delivery-dates {
    font-size: 0.9rem;
    color: #777;
    margin: 1rem 0;
}

.load-more-btn {
    background: var(--rh-global-color-primary);
    color: #fff;
    border: none;
    border-radius: 15px;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: background 0.2s;
}

.rh-ultra-card-col-3 > div {
    width: 50%;
}

/* Fix for single property display */
.rh-ultra-card-col-3.single-property > div {
    width: 100%;
    max-width: 100%;
}

@media screen and (max-width: 768px) {
    .rh-ultra-card-col-3 > div {
        width: 100%;
    }
    .rh-ultra-page-title-area{
        flex-direction: row;
    }
}

/* Mobile filter toggle (off-canvas) */
.mobile-filter-toggle {
    display: none; /* hidden on desktop */
}

.mobile-filter-close {
    display: none; /* close button, hidden on desktop */
}

@media screen and (max-width: 768px) {
    .rh-filter-layout {
        flex-wrap: wrap;
    }

    .mobile-filter-toggle {
        display: inline-block;
        margin: 1rem;
        padding: 0.75rem 1.5rem;
        background: var(--rh-global-color-primary);
        color: #fff;
        border: none;
        border-radius: 15px;
        cursor: pointer;
        transition: background 0.2s;
    }

    .mobile-filter-toggle:hover {
        background: transparent;
        color: var(--rh-global-color-primary);
        border: 2px solid var(--rh-global-color-primary);
    }

    .mobile-filter-overlay {
        display: none;
    }

    .rh-filter-column {
        position: fixed;
        top: 0;
        left: 0;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        overflow-y: auto;
        background: var(--rh-global-color-primary-light);
        transform: translateX(-100%);
        z-index: 9999;
        transition: transform 0.3s ease; /* Added transition for slide-in effect */
    }
    .rh-filter-column.active {
        transform: translateX(0);
        z-index: 10000;
    }

    .mobile-filter-close {
        display: block;
        background: transparent;
        border: none;
        font-size: 3rem;
        font-weight: bold;
        color: var(--rh-global-color-primary);
        position: absolute;
        top: -5px;
        right: -5px;
        cursor: pointer;
    }

    .mobile-filter-overlay.active {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 9999;
    }

    .rh-filter-column {
        flex: none;
    }
}

/* Mobile Filter Sidebar Enhancements */
@media screen and (max-width: 768px) {
    .rh-properties-filter-container {
        position: relative;
        overflow: visible;
        height: auto;
    }

    .custom-dropdown {
        position: relative !important;
    }

    .dropdown-options {
        position: absolute !important;
        left: 0 !important;
        right: 0 !important;
        top: calc(100% + 5px) !important;
        width: 100% !important;
        max-height: 200px !important;
        overflow-y: auto !important;
        background: #fff !important;
        z-index: 10002 !important;
        margin-top: 0 !important;
        transform: none !important;
    }

    #filter-sidebar {
        overflow-x: hidden;
    }

    .filter-row {
        position: relative;
    }

    .mobile-filter-overlay.active + .rh-filter-column .dropdown-options {
        max-width: calc(100% - 20px) !important;
        margin: 0 10px !important;
    }
}

/* Mobile Filter Sidebar Enhancements */
@media screen and (max-width: 768px) {
    .rh-filter-column {
        padding: 20px;
        height: 100vh;
        overflow-y: auto;
    }

    #filter-sidebar .custom-dropdown {
        position: relative;
        z-index: 1;
    }

    #filter-sidebar .dropdown-options {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        z-index: 2;
        margin-top: 5px;
    }

    #filter-sidebar.active {
        z-index: 10000;
    }

    .custom-dropdown {
        position: relative;
    }

    .custom-dropdown.active {
        z-index: 10001;
    }

    .dropdown-selected {
        position: relative;
        z-index: 1;
    }

    /* Improve touch targets on mobile */
    .dropdown-selected,
    .dropdown-option {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Fix scrolling issues */
    .mobile-filter-overlay.active {
        z-index: 9999;
    }

    .rh-filter-column {
        -webkit-overflow-scrolling: touch;
    }

    /* Ensure dropdown options stay within viewport */
    .dropdown-options {
        max-height: 250px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: #fff;
        border: 2px solid var(--rh-global-color-primary);
        border-radius: 15px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }
}

/* Ensure dropdowns work in both desktop and mobile */
.custom-dropdown {
    position: relative;
    width: 100%;
    z-index: 1;
}

.custom-dropdown.active {
    z-index: 1001;
}

.dropdown-options {
    position: absolute;
    width: 100%;
    top: calc(100% + 5px);
    left: 0;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    z-index: 1002;
    display: none;
    overflow-y: auto;
}

.loading-properties {
    width: 100%;
}

.price-label {
    margin-bottom: 15px;
    color: #54595F;
    font-weight: 500;
}

.noUi-target {
    background: #f0f0f0;
    border-radius: 15px;
    border: none;
    box-shadow: none;
    height: 8px;
    margin-bottom: 2rem;
    width: 95%;
}

.noUi-connect {
    background: var(--rh-global-color-primary);
}

.noUi-handle {
    border: none;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    cursor: pointer;
    height: 20px !important;
    width: 20px !important;
    top: -7px !important;
}

.noUi-handle:before,
.noUi-handle:after {
    display: none;
}

#price-range-display {
    font-weight: bold;
    color: #54595F;
}

/* Custom styling for the visible slider inputs */
.price-inputs, .area-inputs {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    gap: 15px;
}

@media screen and (max-width: 768px) {
    .price-inputs, .area-inputs {
        flex-direction: column;
    }
}

.price-inputs input, .area-inputs input {
    width: 48%;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

/* Custom Select & Select2 Dropdown Icon Styles */
.filter-form select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231ea69a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px;
    padding-right: 3rem !important;
}

/* List Filter Styles */
.filter-list-wrapper {
    width: 100%;
}

.filter-list-wrapper h4 {
    color: var(--rh-global-color-primary);
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 500;
}

.filter-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-item {
    background: #fff;
    border-radius: 15px;
    padding: 8px 15px;
    cursor: pointer;
    box-shadow: 0px 0px 7px -2px rgba(var(--rh-global-color-primary-rgb), 0.5);
    transition: all 0.3s ease;
    font-size: 14px;
}

.filter-item:hover {
    background: var(--rh-global-color-primary);
    color: #fff;
}

.filter-item.active {
    background: var(--rh-global-color-primary);
    color: #fff;
}

/* Custom Dropdown Styles */
.custom-dropdown {
    position: relative;
    width: 100%;
    user-select: none;
    margin-bottom: 15px;
    z-index: 1000;
}

.custom-dropdown.active {
    z-index: 1001;
}

.dropdown-arrow {
    position: relative;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--rh-global-color-primary);
    border-bottom: 2px solid var(--rh-global-color-primary);
    transform: rotate(45deg);
    transition: transform 0.3s ease;
    margin-left: 10px;
}

.dropdown-bg{
    background: var(--rh-global-color-primary);
    border-radius: 25px;
}

.custom-dropdown.active .dropdown-arrow {
    transform: rotate(-135deg);
    margin-top: 3px;
}

.dropdown-selected {
    padding: 1rem 2rem;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0px 0px 7px -2px rgba(var(--rh-global-color-primary-rgb), 0.5);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
}

.dropdown-options {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    z-index: 1002;
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
    border: 2px solid var(--rh-global-color-primary);
    display: none;
    overflow-y: auto;
}

/* Fix spacing in container layout */
.filter-row.contener {
    gap: 0px;
    margin-bottom: 0;
}

.filter-row.contener .half-row {
    margin-bottom: 15px;
}

/* Mobile optimizations */
@media screen and (max-width: 768px) {
    .dropdown-selected {
        padding: 0.8rem 1.5rem;
    }
    
    .dropdown-option {
        padding: 0.7rem 1.2rem;
        margin: 2px;
    }

    .dropdown-options {
        max-height: 250px;
        padding: 5px;
    }
    
    #filter-sidebar .custom-dropdown {
        margin-bottom: 10px;
    }
}

/* Scrollbar styling refinements */
.dropdown-options::-webkit-scrollbar {
    width: 6px;
}

.dropdown-options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.dropdown-options::-webkit-scrollbar-thumb {
    background: var(--rh-global-color-primary);
    border-radius: 10px;
    border: 2px solid #f1f1f1;
}

/* Mobile optimizations */
@media screen and (max-width: 768px) {
    #filter-sidebar .dropdown-options {
        position: fixed;
        left: 20px;
        right: 20px;
        width: auto;
        max-width: calc(100% - 0px);
        z-index: 10002;
    }
    
    .mobile-filter-overlay.active {
        z-index: 9999;
    }
    
    #filter-sidebar.active {
        z-index: 10000;
    }
    
    .custom-dropdown.active {
        z-index: 10001;
    }
}

/* Fix Mobile Dropdown Positioning */
@media screen and (max-width: 768px) {
    .rh-filter-column {
        padding: 20px;
        height: 100vh;
        overflow-y: auto;
        position: fixed;
        top: 0;
        left: 0;
        width: 80%;
        max-width: 350px;
        /* The following transition ensures the sidebar slides in from the left */
        transform: translateX(-100%);
        z-index: 9999;
        transition: transform 0.3s ease;
    }

    .rh-filter-column.active {
        transform: translateX(0);
        z-index: 10000;
    }

    .custom-dropdown {
        position: relative !important;
    }

    .dropdown-options {
        position: absolute !important;
        top: calc(100% + 5px) !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-height: 250px !important;
        transform: none !important;
        background: #fff;
        z-index: 10002;
    }

    .custom-dropdown.active {
        z-index: 10001;
    }

    .dropdown-selected {
        position: relative;
        z-index: 2;
    }

    #filter-sidebar .rh-properties-filter-container {
        padding: 0px;
        height: auto;
        overflow: visible;
    }
    
    #filter-sidebar {
        overflow-x: hidden;
    }
}

/* Fix dropdown positioning and z-index in mobile */
@media screen and (max-width: 768px) {
    .rh-filter-column {
        z-index: 10000;
    }

    .custom-dropdown {
        isolation: isolate;
    }

    .filter-row {
        position: relative;
        isolation: isolate;
    }

    .custom-dropdown.active {
        z-index: 2;
    }

    .custom-dropdown.active .dropdown-options {
        position: absolute !important;
        z-index: 3;
        box-shadow: 0 5px 15px rgba(0,0,0,0.15);
        background: #fff;
    }
}

/* Ensure proper stacking context */
.rh-properties-filter-container {
    position: relative;
    isolation: isolate;
}

/* Mobile dropdown positioning fix */
@media screen and (max-width: 768px) {
    .rh-filter-column {
        padding: 20px;
        height: 100vh;
        overflow-y: auto;
    }
    
    .custom-dropdown {
        position: relative !important;
        width: 100%;
    }
    
    .dropdown-selected {
        position: relative;
        z-index: 1;
    }
    
    .dropdown-options {
        display: none;
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-height: 200px;
        background: #fff,
        border-radius: 15px,
        box-shadow: 0 5px 15px rgba(0,0,0,0.15);
        border: 2px solid var(--rh-global-color-primary);
        z-index: 2,
        margin-top: 5px !important,
        overflow-y: auto;
    }
    
    .custom-dropdown.active .dropdown-options {
        display: block;
    }
    
    #filter-sidebar {
        position: fixed,
        top: 0,
        left: 0,
        width: 80%,
        height: 100vh,
        overflow-y: auto,
        z-index: 10000,
        background: var(--rh-global-color-primary-light);
    }
    
    .filter-row:has(.custom-dropdown.active) {
        z-index: 10001;
    }
}

@media screen and (max-width: 768px) {
    .rh-properties-filter-container {
        position: relative,
        padding: 20px;
    }

    .filter-row {
        position: relative !important,
        margin-bottom: 15px;
    }

    .custom-dropdown {
        position: relative !important,
        width: 100%;
    }

    .dropdown-selected {
        position: relative,
        z-index: 1;
    }

    .dropdown-options {
        display: none;
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-height: 200px;
        background: #fff;
        border-radius: 15px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.15);
        border: 2px solid var(--rh-global-color-primary);
        z-index: 2;
        margin-top: 5px !important;
        overflow-y: auto;
    }

    .custom-dropdown.active .dropdown-options {
        display: block;
    }

    #filter-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 85%;
        height: 100vh;
        overflow-y: auto;
        z-index: 10000;
        background: var(--rh-global-color-primary-light);
    }

    .filter-row:has(.custom-dropdown.active) {
        z-index: 10001;
    }
}

/* Mobile dropdown positioning fix */
@media screen and (max-width: 768px) {
    .rh-filter-column {
        background: var(--rh-global-color-primary-light),
        position: fixed,
        top: 0,
        left: 0,
        width: 80%,
        height: 100vh,
        overflow-y: auto,
        z-index: 10000;
    }

    .filter-row {
        position: relative !important,
        margin-bottom: 15px;
    }

    .rh-properties-filter-container {
        padding: 20px,
        position: relative;
    }

    .custom-dropdown {
        position: relative !important;
    }

    .dropdown-selected {
        position: relative,
        z-index: 1;
    }

    .dropdown-options {
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-height: 200px !important;
        background: #fff !important;
        z-index: 10002 !important;
        border-radius: 15px !important;
        box-shadow: 0 5px 15px rgba(0,0,0,0.15) !important;
        margin-top: 5px !important;
        transform: none !important;
    }

    .custom-dropdown.active {
        z-index: 10001;
    }

    .mobile-filter-overlay.active {
        z-index: 9999;
    }
}

/* Loading Progress Bar Styles */
.loading-progress {
    width: 100%;
    max-width: 300px;
    margin: 20px auto;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #eee;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 30%;
    background: var(--rh-global-color-primary);
    animation: progress-animation 1.5s infinite ease-in-out;
}

.loading-text {
    margin-top: 10px;
    color: var(--rh-global-color-primary);
    font-size: 14px;
}

@keyframes progress-animation {
    0% {
        left: -30%;
    }
    100% {
        left: 100%;
    }
}

/* ========== Loading Placeholder Styles ========== */
.placeholder-card {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    height: 400px;
    animation: pulse 1.5s infinite;
}

.placeholder-image {
    width: 100%;
    height: 250px;
    background: #f0f0f0;
}

.placeholder-content {
    padding: 15px;
}

.placeholder-line {
    height: 12px;
    background: #f0f0f0;
    border-radius: 6px;
    margin-bottom: 10px;
}

.placeholder-line.title {
    width: 85%;
    height: 20px;
    margin-bottom: 15px;
}

.placeholder-line.price {
    width: 60%;
    height: 16px;
}

.placeholder-line.details {
    width: 75%;
}

.placeholder-line.location {
    width: 40%;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.loading-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    padding: 20px;
    width: 100%;
}

.loading-grid .placeholder-card {
    flex: 0 0 calc(50% - 15px); /* Two cards per row with 30px gap */
    margin: 0;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    height: 400px;
    animation: pulse 1.5s infinite;
    min-width: 300px; /* Ensure minimum width */
}

/* Mobile styles for loading grid */
@media screen and (max-width: 768px) {
    .loading-grid {
        gap: 20px;
    }
    
    .loading-grid .placeholder-card {
        flex: 0 0 100%; /* One card per row on mobile */
        min-width: 100%; /* Full width on mobile */
    }
}

/* Remove old loading styles */
.loading-properties .spinner,
#loading-progress {
    display: none !important;
}

/* Ensure proper container width */
#properties-container {
    width: 100%;
    max-width: 100%;
}

/* Ensure proper spacing between rows */
.loading-grid {
    margin-bottom: 20px;
}