/* =====================================================
   ADVANCED FILTER - ZOME-STYLE TOGGLE INTERFACE
  ===================================================== */

/* Filter Container (for admin mode only) */
.advanced-filter {
    width: 100%;
    margin: 2rem 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* Filter Header (for admin mode only) */
.filter-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #21808D 0%, #1A6873 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

/* Filter Bar - Horizontal Layout (Direct, No Wrapper for Public) */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1.5rem 0;
    background: transparent;
}

/* Filter Category Button */
.filter-category-btn {
    position: relative;
    padding: 0.75rem 1.5rem;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: #495057;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.filter-category-btn:hover {
    border-color: #21808D;
    color: #21808D;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 128, 141, 0.15);
}

.filter-category-btn.active {
    background: linear-gradient(135deg, #21808D 0%, #1A6873 100%);
    border-color: #21808D;
    color: white;
    box-shadow: 0 4px 12px rgba(33, 128, 141, 0.3);
}

/* Dropdown Arrow - Clean chevron */
.dropdown-arrow {
    font-size: 1.4rem;
    font-weight: 300;
    transition: transform 0.3s ease;
    margin-left: auto;
    line-height: 1;
}

.filter-category-btn.active .dropdown-arrow {
    transform: rotate(90deg);
}

/* Badge for active filter count */
.filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #dc3545;
    color: white;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-right: 0.25rem;
}

.filter-category-btn.active .filter-badge {
    background: white;
    color: #21808D;
}

/* Filter Dropdown Panel */
.filter-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    min-width: 280px;
    max-width: 400px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 1rem;
    z-index: 1000;
    display: none;
    animation: slideDown 0.3s ease;
}

.filter-dropdown.show {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Filter Dropdown Content */
.filter-dropdown-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Toggle Chips */
.toggle-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.toggle-chip {
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: #495057;
    transition: all 0.2s ease;
    user-select: none;
}

.toggle-chip:hover {
    border-color: #21808D;
    color: #21808D;
    background: #f0f2ff;
}

.toggle-chip.active {
    background: linear-gradient(135deg, #21808D 0%, #1A6873 100%);
    border-color: #21808D;
    color: white;
    box-shadow: 0 2px 8px rgba(33, 128, 141, 0.3);
}

.toggle-chip.active:hover {
    transform: scale(1.05);
}

/* Input Fields in Dropdown */
.filter-input-field {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.filter-input-field:focus {
    outline: none;
    border-color: #21808D;
    box-shadow: 0 0 0 3px rgba(33, 128, 141, 0.1);
}

/* Price Range Inputs */
.price-range-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.price-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.price-input-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #6c757d;
}

/* Toggle Checkboxes (for "Outros") */
.toggle-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toggle-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-checkbox-item:hover {
    background: #e9ecef;
}

.toggle-checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #21808D;
}

.toggle-checkbox-item label {
    cursor: pointer;
    font-size: 0.95rem;
    color: #495057;
    flex: 1;
}

/* Apply Button inside Dropdown */
.filter-apply-btn {
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, #21808D 0%, #1A6873 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-apply-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 128, 141, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    .filter-bar {
        flex-direction: column;
        gap: 0.5rem;
    }

    .filter-category-btn {
        width: 100%;
        justify-content: space-between;
    }

    .filter-dropdown {
        position: fixed;
        top: auto;
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        max-width: none;
        max-height: 70vh;
        overflow-y: auto;
    }

    .price-range-inputs {
        grid-template-columns: 1fr;
    }
}

/* Collapsed State */
.advanced-filter.collapsed .filter-bar,
.advanced-filter.collapsed .filter-actions {
    display: none;
}

/* Filter Toggle Button */
.filter-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.filter-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
}

.filter-toggle .icon {
    transition: transform 0.3s ease;
}

.filter-toggle.expanded .icon {
    transform: rotate(180deg);
}

/* Animation for filter chips */
@keyframes chipPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.toggle-chip.active {
    animation: chipPop 0.3s ease;
}

/* Results and Sort Bar */
.results-sort-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.results-count {
    font-size: 1rem;
    color: #374151;
}

.results-count .count-number {
    font-weight: 600;
    color: #21808D;
}

.sort-dropdown {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-dropdown label {
    font-size: 0.9rem;
    color: #6b7280;
}

.sort-select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: white;
    font-size: 0.9rem;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23374151' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
}

.sort-select:hover {
    border-color: #21808D;
}

.sort-select:focus {
    outline: none;
    border-color: #21808D;
    box-shadow: 0 0 0 3px rgba(33, 128, 141, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .results-sort-bar {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .sort-dropdown {
        width: 100%;
    }

    .sort-select {
        flex: 1;
    }
}

/* ============================================
   MOBILE FILTER/SORT BUTTONS AND MODALS
   ============================================ */

/* Mobile Buttons - Hidden on Desktop */
.mobile-filter-buttons {
    display: none;
    gap: 0.75rem;
    margin-top: 1rem;
    margin-bottom: 2rem;
    /* Spacing before property cards */
}

@media (max-width: 768px) {

    /* Hide desktop filter bar and sort dropdown on mobile */
    .filter-bar {
        display: none !important;
    }

    .results-sort-bar .sort-dropdown {
        display: none !important;
    }

    /* Show mobile buttons */
    .mobile-filter-buttons {
        display: flex !important;
    }
}

.mobile-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    font-size: 1rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-btn:hover {
    border-color: #21808D;
    background: #f9fafb;
}

.mobile-btn svg {
    flex-shrink: 0;
}

/* Mobile Modal */
.mobile-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
}

.mobile-modal.active {
    display: block;
}

.mobile-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: mobileFadeIn 0.2s ease;
}

.mobile-modal-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 85vh;
    background: white;
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    animation: mobileSlideUp 0.3s ease;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.mobile-modal.closing .mobile-modal-content {
    animation: mobileSlideDown 0.3s ease;
}

.mobile-modal.closing .mobile-modal-overlay {
    animation: mobileFadeOut 0.3s ease;
    will-change: opacity;
}

/* Prevent layout shifts during animation */
.mobile-modal {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@keyframes mobileFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes mobileFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes mobileSlideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes mobileSlideDown {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(100%);
    }
}

.mobile-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.mobile-modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.mobile-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.mobile-modal-close:hover {
    background: #e5e7eb;
}

.mobile-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.mobile-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.75rem;
}

/* Mobile Sort Options */
.mobile-sort-option {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background 0.2s ease;
}

.mobile-sort-option:hover {
    background: #f9fafb;
}

.mobile-sort-option input[type="radio"] {
    width: 20px;
    height: 20px;
    margin: 0;
    margin-right: 0.875rem;
    cursor: pointer;
    accent-color: #21808D;
}

.mobile-sort-option span {
    font-size: 1rem;
    color: #374151;
}

/* Mobile Filter Sections */
.mobile-filter-section {
    margin-bottom: 2rem;
}

.mobile-filter-section h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 1rem 0;
}

.mobile-toggle-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mobile-toggle {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-toggle:hover {
    border-color: #21808D;
    background: #f0f9fa;
}

.mobile-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    margin-right: 0.875rem;
    cursor: pointer;
    accent-color: #21808D;
}

.mobile-toggle input[type="checkbox"]:checked+span {
    color: #21808D;
    font-weight: 500;
}

.mobile-toggle span {
    font-size: 1rem;
    color: #374151;
}

.mobile-filter-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    color: #374151;
    transition: all 0.2s ease;
}

.mobile-filter-input:focus {
    outline: none;
    border-color: #21808D;
    box-shadow: 0 0 0 3px rgba(33, 128, 141, 0.1);
}

.mobile-price-inputs {
    display: flex;
    gap: 0.75rem;
}

.mobile-price-group {
    flex: 1;
}

.mobile-price-group label {
    display: block;
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

/* Modal Buttons */
.mobile-apply-btn,
.mobile-clear-btn {
    flex: 1;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-apply-btn {
    background: #21808D;
    color: white;
}

.mobile-apply-btn:hover {
    background: #1a6570;
}

.mobile-clear-btn {
    background: #f3f4f6;
    color: #6b7280;
}

.mobile-clear-btn:hover {
    background: #e5e7eb;
}

/* Add spacing between toggle checkboxes when stacked */
.mobile-filter-section>.mobile-toggle+.mobile-toggle {
    margin-top: 0.75rem;
}