/* Reset and update stacking context */
.floorplan-container {
    position: relative;
    width: 100%;
    z-index: 1;
}

.floorplan-container.filters-active {
    z-index: 1060;
}

/* Filter container styles */
.filter-container {
    position: relative;
    z-index: 1050;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.5rem;
    width: 100%;
    background: white;
}

/* Dropdown container styles */
.dropdown-container {
    position: relative;
    display: inline-block;
    z-index: 1;
}

/* Dropdown menu styles */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: none;
    z-index: 1000;
    margin-top: 0.5rem;
}

.dropdown-menu.show {
    display: block;
}

/* Results container */
#floorplan-results {
    position: relative;
    z-index: 1040;
}

/* Mobile styles */
@media (max-width: 768px) {
    .filter-container {
        overflow-x: auto;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        padding: 0.5rem;
    }

    .dropdown-container {
        flex: 0 0 auto;
    }

    .dropdown-menu {
        position: absolute;
        width: 100%;
        max-height: 300px;
        overflow-y: auto;
    }

    .dropdown-container:first-child .dropdown-menu {
        left: 0;
        transform: none;
    }

    .dropdown-container:last-child .dropdown-menu {
        left: auto;
        right: 0;
        transform: none;
    }
}

/* Remove duplicate styles and keep only these core mobile adjustments */
@media (max-width: 480px) {
    .dropdown-container {
        min-width: 100px;
    }

    .dropdown-toggle {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
}

/* Mobile Filter Drawer */
.mobile-filter-drawer {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    z-index: 1070;
    border-top-left-radius: 1rem;
    border-top-right-radius: 1rem;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    max-height: 90vh;
    display: block;
    visibility: hidden;
}

.mobile-filter-drawer.show {
    transform: translateY(0);
    visibility: visible;
}

.mobile-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.mobile-filter-content {
    padding: 1rem;
    max-height: 70vh;
    overflow-y: auto;
}

.mobile-filter-footer {
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
}

/* Mobile Filter Button */
.mobile-filter-button {
    display: none;
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1060;
    padding: 0.75rem 1.5rem;
    background: #3b82f6;
    color: white;
    border-radius: 9999px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    .mobile-filter-button {
        display: flex;
    }
    
    .mobile-filter-drawer {
        visibility: hidden;
    }
    
    .mobile-filter-drawer.show {
        visibility: visible;
    }
}

/* Mobile Specific Styles */
@media (max-width: 768px) {
    .filter-container {
        display: none; /* Hide desktop filters */
    }

    .mobile-filter-drawer {
        display: block;
    }

    .mobile-filter-button {
        display: flex;
        position: fixed;
        bottom: 1rem;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1060;
        padding: 0.75rem 1.5rem;
        background: #3b82f6;
        color: white;
        border-radius: 9999px;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        align-items: center;
        gap: 0.5rem;
    }

    /* Adjust dropdown styles for mobile drawer */
    .mobile-filter-content .dropdown-container {
        width: 100%;
        margin-bottom: 1rem;
    }

    .mobile-filter-content .dropdown-menu {
        position: static;
        display: block;
        box-shadow: none;
        border: none;
        margin-top: 0.5rem;
    }

    /* Adjust price slider for mobile */
    #price-slider {
        margin: 1rem 0;
    }
}

/* Overlay */
.mobile-filter-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1065;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.mobile-filter-overlay.show {
    opacity: 1;
}

/* Desktop Filters */
.desktop-filters {
    display: flex;
}

/* Mobile Filters */
.mobile-filters {
    display: none;
}

@media (max-width: 768px) {
    .desktop-filters {
        display: none;
    }

    .mobile-filters {
        display: flex;
    }

    .mobile-filter-content {
        padding: 1rem;
        max-height: 70vh;
        overflow-y: auto;
    }

    .mobile-filter-content .dropdown-container {
        width: 100%;
        margin-bottom: 1rem;
    }

    .mobile-filter-content .dropdown-menu {
        position: static;
        display: block;
        width: 100%;
        box-shadow: none;
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
        margin-top: 0.5rem;
    }

    /* Ensure price slider is visible and usable */
    .mobile-filter-content #price-slider {
        margin: 1rem 0;
        width: 100%;
    }

    /* Style mobile MFTE toggle */
    #mobile_mfte_toggle {
        width: 100%;
        text-align: left;
        margin-top: 1rem;
    }
}

/* Adjust drawer height for better visibility */
.mobile-filter-drawer {
    max-height: 90vh;
}

/* Ensure footer stays at bottom of drawer */
.mobile-filter-footer {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

/* Style the mobile filter buttons */
.mobile-filter-footer button {
    flex: 1;
    white-space: nowrap;
}

/* Mobile Filter Content Styles */
.filter-section {
    border-bottom: 1px solid #e5e7eb;
    width: 100%;
}

.filter-section:last-child {
    border-bottom: none;
}

.filter-section-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: none;
    border: none;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
}

.mfte-toggle-container {
    padding: 0.5rem 0;
    width: 100%;
}

#mobile_mfte_toggle {
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease-in-out;
    margin-bottom: 0.5rem;
}

#mobile_mfte_toggle[data-mfte-state="on"] {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

#mobile_mfte_toggle[data-mfte-state="off"] {
    background-color: #f3f4f6;
    color: #4b5563;
    border-color: #e5e7eb;
}

.filter-section-header i.fa-chevron-down {
    position: absolute;
    right: 1rem;
    transition: transform 0.3s ease;
}

.filter-section.active .filter-section-header i.fa-chevron-down {
    transform: rotate(180deg);
}

.filter-section-content {
    display: none;
    padding: 0 1rem 1rem;
}

.filter-section.active .filter-section-content {
    display: block;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* Price Slider Styles */
#mobile-price-slider {
    margin: 1.5rem 0.5rem;
}

.price-range-display {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-weight: 500;
}

/* Mobile Filter Footer */
.mobile-filter-footer {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
}

.mobile-filter-footer button {
    flex: 1;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-weight: 500;
}

.mobile-filter-footer .clear-filters {
    background: #f3f4f6;
    color: #4b5563;
}

.mobile-filter-footer .apply-filters {
    background: #3b82f6;
    color: white;
}

/* Mobile drawer specific styles */
@media (max-width: 768px) {
    .mobile-filter-drawer {
        height: auto;
        max-height: 90vh;
    }

    .mobile-filter-content {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .filter-section-header {
        position: relative;
        padding-right: 2.5rem;
    }

    .filter-section-header i.fa-chevron-down {
        position: absolute;
        right: 1rem;
        transition: transform 0.3s ease;
    }
}
