/* ========================================
   SISTEMA DE FILTROS UNIFICADO
======================================== */

/* Container principal dos filtros */
.filters-container {
    position: fixed;
    top: 120px;
    left: 0;
    width: 450px;
    height: calc(100vh - 120px);
    background: linear-gradient(180deg, #1a1a1a 0%, #000000 100%);
    border-right: 3px solid var(--tenant-accent, #d4af37);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    transition: transform 0.38s cubic-bezier(0.22, 0.61, 0.36, 1), box-shadow 0.28s ease;
    /* Garantir que o scroll funcione */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--tenant-accent, #d4af37) #333;
}

/* Customizar scrollbar */
.filters-container::-webkit-scrollbar {
    width: 8px;
}

.filters-container::-webkit-scrollbar-track {
    background: #333;
}

.filters-container::-webkit-scrollbar-thumb {
    background: var(--tenant-accent, #d4af37);
    border-radius: 4px;
}

.filters-container::-webkit-scrollbar-thumb:hover {
    background: #b8941f;
}

.filters-container.hidden {
    transform: translateX(-100%);
}

.filters-container.active {
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.35);
}

.filters-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 18, 0.42);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
    z-index: 95;
}

.filters-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Header dos filtros */
.filters-header {
    padding: 20px;
    border-bottom: 2px solid var(--tenant-accent, #d4af37);
    background: rgba(var(--tenant-accent-rgb, 212, 175, 55), 0.1);
}

.filters-title {
    color: var(--tenant-accent, #d4af37);
    font-size: 1.8rem;
    font-weight: bold;
    text-align: center;
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
}

.section-indicator {
    background: rgba(var(--tenant-accent-rgb, 212, 175, 55), 0.2);
    color: var(--tenant-accent, #d4af37);
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    text-align: center;
    margin-top: 10px;
    text-transform: uppercase;
    font-weight: bold;
}

/* Corpo dos filtros */
.filters-body {
    padding: 20px;
    padding-bottom: 40px; /* Espaço extra para o scroll */
}

/* Grupos de filtros */
.filter-group {
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(var(--tenant-accent-rgb, 212, 175, 55), 0.2);
    padding-bottom: 15px;
}

.filter-group:last-child {
    border-bottom: none;
    margin-bottom: 30px; /* Espaço extra no último grupo */
}

.filter-group h3 {
    color: var(--tenant-accent, #d4af37);
    font-size: 1.2rem;
    margin-bottom: 12px;
    font-weight: 600;
}

/* Labels e inputs */
.filter-label {
    display: flex;
    align-items: center;
    color: #e0e0e0;
    margin-bottom: 8px;
    cursor: pointer;
    transition: color 0.3s ease;
    line-height: 1.5;
    gap: 10px;
    font-size: 0.9rem;
    padding: 2px 0;
}

.filter-label:hover {
    color: var(--tenant-accent, #d4af37);
}

.filter-input {
    margin: 0;
    padding: 0;
    accent-color: var(--tenant-accent, #d4af37);
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    vertical-align: baseline;
    position: relative;
    top: 0;
}

/* Estilo específico para radio buttons */
.filter-input[type="radio"] {
    border-radius: 50%;
}

/* Estilo específico para checkboxes */
.filter-input[type="checkbox"] {
    border-radius: 3px;
}

/* Texto dos labels - garantir alinhamento */
.filter-label > *:not(.filter-input) {
    line-height: 1.2;
    vertical-align: middle;
    display: inline-block;
}

/* Inputs de texto e selects */
.filter-select,
.filter-text {
    width: 100%;
    padding: 10px;
    border: 2px solid #333;
    border-radius: 6px;
    background: #2a2a2a;
    color: #e0e0e0;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.filter-select:focus,
.filter-text:focus {
    outline: none;
    border-color: var(--tenant-accent, #d4af37);
    box-shadow: 0 0 5px rgba(var(--tenant-accent-rgb, 212, 175, 55), 0.3);
}

/* Range inputs */
.price-range-container {
    margin-top: 10px;
}

.price-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: #333;
    border-radius: 3px;
    outline: none;
    margin: 10px 0;
}

.price-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--tenant-accent, #d4af37);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s ease;
}

.price-range::-webkit-slider-thumb:hover {
    background: #b38b30;
}

.price-display {
    color: var(--tenant-accent, #d4af37);
    font-weight: bold;
    text-align: center;
    margin-top: 5px;
    font-size: 14px;
}

/* ========================================
   FILTRO DE CARACTERÍSTICAS (FEATURES)
======================================== */
.filter-features-group h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-features-group h3 i {
    font-size: 0.85rem;
}

.filter-features-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 180px;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.filter-features-group.expanded .filter-features-list {
    max-height: 600px;
}

.filter-feature-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    font-size: 0.78rem;
    color: #ccc;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    background: rgba(255, 255, 255, 0.03);
    white-space: nowrap;
}

.filter-feature-tag:hover {
    border-color: var(--tenant-accent, #d4af37);
    color: #fff;
    background: rgba(var(--tenant-accent-rgb, 212, 175, 55), 0.08);
}

.filter-feature-tag input[type="checkbox"] {
    display: none;
}

.filter-feature-tag:has(input:checked) {
    background: var(--tenant-accent, #d4af37);
    color: #000;
    border-color: var(--tenant-accent, #d4af37);
    font-weight: 600;
}

.filter-feature-tag:has(input:checked) i {
    color: #000;
}

.filter-feature-tag i {
    font-size: 0.72rem;
    color: var(--tenant-accent, #d4af37);
}

.filter-features-toggle {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 6px;
    background: none;
    border: none;
    color: var(--tenant-accent, #d4af37);
    font-size: 0.78rem;
    cursor: pointer;
    text-align: center;
    transition: opacity 0.2s;
}

.filter-features-toggle:hover {
    opacity: 0.8;
}

.filter-features-toggle .show-less {
    display: none;
}

.filter-features-group.expanded .filter-features-toggle .show-more {
    display: none;
}

.filter-features-group.expanded .filter-features-toggle .show-less {
    display: inline;
}

/* Botões de ação */
.filter-actions {
    padding: 20px;
    padding-bottom: 30px; /* Espaço extra para scroll */
    border-top: 2px solid var(--tenant-accent, #d4af37);
    background: rgba(var(--tenant-accent-rgb, 212, 175, 55), 0.05);
    margin-bottom: 20px; /* Margem inferior adicional */
}

.filter-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
    font-size: 14px;
}

.filter-btn.primary {
    background: var(--tenant-accent, #d4af37);
    color: #000;
}

.filter-btn.primary:hover {
    background: #b38b30;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(var(--tenant-accent-rgb, 212, 175, 55), 0.3);
}

.filter-btn.secondary {
    background: transparent;
    color: var(--tenant-accent, #d4af37);
    border: 2px solid var(--tenant-accent, #d4af37);
}

.filter-btn.secondary:hover {
    background: var(--tenant-accent, #d4af37);
    color: #000;
}

/* Garantir que os botões tenham tamanho consistente */
.filter-actions .filter-btn {
    width: 100% !important;
    flex: none !important;
    display: block !important;
}

/* Toggle para mobile */
.filter-toggle {
    display: none;
    position: fixed;
    top: 140px;
    left: 20px;
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    min-height: 52px !important;
    aspect-ratio: 1 / 1;
    background: var(--tenant-accent, #d4af37);
    color: #000;
    border: none;
    padding: 0 !important;
    border-radius: 999px !important;
    font-size: 18px;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.filter-toggle:hover {
    transform: scale(1.1);
}

/* Área de conteúdo principal */
.main-content {
    margin-left: 450px;
    padding: 140px 20px 20px;
    min-height: 100vh;
    background: #f8f9fa;
    transition: margin-left 0.38s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* Recolher filtros no desktop — o painel some e o conteúdo ocupa o espaço */
@media (min-width: 769px) {
    .filter-toggle {
        display: inline-flex !important;
        top: 140px;
        left: 470px;
        transition: left 0.38s cubic-bezier(0.22, 0.61, 0.36, 1);
    }

    .filters-container.desktop-collapsed {
        transform: translateX(-100%);
    }

    .filter-toggle.desktop-collapsed {
        left: 20px;
    }

    .main-content.desktop-collapsed {
        margin-left: 0;
    }
}

/* Container para os cards */
.properties-container {
    max-width: 1200px;
    margin: 0 auto;
}

.properties-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.section-title-main {
    font-size: 2.5rem;
    color: var(--tenant-section-title, #d4af37);
    font-family: "Space Grotesk", sans-serif;
    margin: 0;
}

.properties-count {
    color: #666;
    font-size: 1.1rem;
}

/* Grid dos cards */
.properties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

/* Responsividade */
@media (max-width: 768px) {
    .filters-container {
        transform: translateX(-100%);
        width: min(90vw, 420px);
        touch-action: pan-y;
    }

    .filters-container.active {
        transform: translateX(0);
    }

    .filter-toggle {
        display: inline-flex !important;
    }
    
    .main-content {
        margin-left: 0;
        padding: 140px 10px 20px;
    }
    
    .properties-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .properties-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* Bloquear scroll do body quando filtros estão abertos */
body.filters-open {
    overflow: hidden;
}

/* Loading state */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: var(--tenant-accent, #d4af37);
    font-size: 1.2rem;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--tenant-accent, #d4af37);
    border-top: 2px solid transparent;
    border-radius: 50%;
    margin-left: 10px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.empty-state h3 {
    color: #666;
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.empty-state p {
    color: #999;
    font-size: 1rem;
}
