/**
 * Property List Filters Modal Styles
 * 
 * Bottom sheet modal for mobile filters on property list page.
 * Similar to search page filter modals.
 */

/* Backdrop */
.property-list-filters-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.property-list-filters-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Modal */
.property-list-filters-modal {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    transform: translateY(100%) !important;
    border-radius: 24px 24px 0 0 !important;
    max-height: calc(100vh - var(--navbar-height-mobile, 50px) - 80px) !important;
    max-height: calc(100dvh - var(--navbar-height-mobile, 50px) - 80px) !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    background: var(--bg-primary, #fff) !important;
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.2) !important;
    z-index: 9999 !important;
    overflow: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    padding-bottom: env(safe-area-inset-bottom, 0) !important;
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1) !important;
    touch-action: pan-y;
}

.property-list-filters-modal.active {
    transform: translateY(0) !important;
}

/* Disable transition during drag */
.property-list-filters-modal.dragging {
    transition: none !important;
}

/* Desktop: Hide modal (use sidebar instead) */
@media (min-width: 992px) {
    .property-list-filters-modal,
    .property-list-filters-backdrop {
        display: none !important;
    }
}

/* Content structure */
.property-list-filters-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
}

/* Header - Drag Handle */
.property-list-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px 10px;
    border-bottom: 1px solid var(--border-light, #ebebeb);
    position: sticky;
    top: 0;
    background: var(--bg-primary, #fff);
    z-index: 10;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.property-list-filters-header:active {
    cursor: grabbing;
}

/* Drag handle indicator */
.property-list-filters-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--border-light, #ddd);
    border-radius: 2px;
}

@media (max-width: 768px) {
    .property-list-filters-header {
        padding: 10px 16px 8px;
    }
    
    .property-list-filters-header::before {
        top: 6px;
        width: 36px;
        height: 3px;
    }
}

.property-list-filters-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #222);
    margin: 0;
}

@media (max-width: 768px) {
    .property-list-filters-header h2 {
        font-size: 16px;
    }
}

.property-list-filters-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary, #222);
    font-size: 18px;
    transition: background 0.2s ease;
}

.property-list-filters-close:active {
    background: var(--bg-hover, #f7f7f7);
}

/* Body - Scrollable */
.property-list-filters-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 20px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    /* Allow scrolling but prevent drag when scrolling */
}

@media (max-width: 768px) {
    .property-list-filters-body {
        padding: 10px 16px;
    }
}

.property-list-filters-body .filter-group {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light, #ebebeb);
}

.property-list-filters-body .filter-group:last-of-type {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.property-list-filters-body .filter-group h5 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #222);
    margin-bottom: 8px;
}

@media (max-width: 768px) {
    .property-list-filters-body .filter-group {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }
    
    .property-list-filters-body .filter-group h5 {
        font-size: 13px;
        margin-bottom: 6px;
    }
}

.property-list-filters-body .form-select,
.property-list-filters-body .form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-light, #dddddd);
    border-radius: 10px;
    font-size: 15px;
    background: var(--bg-primary, #fff);
    color: var(--text-primary, #222);
    transition: border-color 0.2s ease;
}

@media (max-width: 768px) {
    .property-list-filters-body .form-select,
    .property-list-filters-body .form-control {
        padding: 8px 12px;
        font-size: 14px;
        border-radius: 8px;
    }
}

.property-list-filters-body .form-select:focus,
.property-list-filters-body .form-control:focus {
    outline: none;
    border-color: var(--accent-color, #d4af37);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.property-list-filters-body .amenities-list {
    max-height: 200px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.property-list-filters-body .form-check {
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.property-list-filters-body .form-check-input {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.property-list-filters-body .form-check-label {
    font-size: 14px;
    color: var(--text-primary, #222);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 768px) {
    .property-list-filters-body .form-check {
        padding: 6px 0;
        gap: 8px;
    }
    
    .property-list-filters-body .form-check-input {
        width: 16px;
        height: 16px;
    }
    
    .property-list-filters-body .form-check-label {
        font-size: 13px;
        gap: 5px;
    }
}

/* Footer */
.property-list-filters-footer {
    display: flex;
    gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-light, #ebebeb);
    position: sticky;
    bottom: 0;
    background: var(--bg-primary, #fff);
    z-index: 10;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
}

@media (max-width: 768px) {
    .property-list-filters-footer {
        gap: 8px;
        padding: 10px 16px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0));
    }
}

.filter-clear-all-btn,
.filter-show-btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

@media (max-width: 768px) {
    .filter-clear-all-btn,
    .filter-show-btn {
        padding: 10px 16px;
        font-size: 14px;
        border-radius: 8px;
    }
}

.filter-clear-all-btn {
    background: transparent;
    color: var(--text-primary, #222);
    border: 1px solid var(--border-light, #dddddd);
}

.filter-clear-all-btn:active {
    background: var(--bg-hover, #f7f7f7);
}

.filter-show-btn {
    background: linear-gradient(135deg, var(--accent-color, #d4af37) 0%, #b49225 100%);
    color: #000;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

.filter-show-btn:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(212, 175, 55, 0.3);
}

/* Filter count badge */
.filters-toggle-btn.has-filters {
    background: linear-gradient(135deg, var(--accent-color, #d4af37) 0%, #b49225 100%);
    color: #000;
    border-color: var(--accent-color, #d4af37);
}

.filters-toggle-btn .filter-count {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
    color: inherit;
}

/* Hide sidebar filters on mobile */
@media (max-width: 991px) {
    .filters-wrapper {
        display: none !important;
    }
}

/* Dark mode support */
[data-theme="dark"] .property-list-filters-modal {
    background: var(--bg-primary-dark, #1a1a1a) !important;
}

[data-theme="dark"] .property-list-filters-header,
[data-theme="dark"] .property-list-filters-footer {
    background: var(--bg-primary-dark, #1a1a1a);
    border-color: var(--border-dark, #333);
}

[data-theme="dark"] .property-list-filters-body .filter-group {
    border-color: var(--border-dark, #333);
}

[data-theme="dark"] .property-list-filters-body .form-select,
[data-theme="dark"] .property-list-filters-body .form-control {
    background: var(--bg-secondary-dark, #2a2a2a);
    border-color: var(--border-dark, #333);
    color: var(--text-primary-dark, #fff);
}

[data-theme="dark"] .property-list-filters-body .form-check-label {
    color: var(--text-primary-dark, #fff);
}

[data-theme="dark"] .filter-clear-all-btn {
    background: transparent;
    color: var(--text-primary-dark, #fff);
    border-color: var(--border-dark, #333);
}

[data-theme="dark"] .filter-clear-all-btn:active {
    background: var(--bg-hover-dark, #333);
}
