/* PARTE 1: ESTILOS DO CABEÇALHO E FILTROS PRINCIPAIS */
.filtro-avancado-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    margin: 0;
    padding: 0;
    background: #ffffff;
}

/* Header Principal */
.filtro-header {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    padding: 40px calc(50vw - 50%);
    color: white;
    text-align: center;
    position: relative;
    box-shadow: 0 2px 10px rgba(255, 107, 53, 0.2);
    transition: background 0.5s ease, box-shadow 0.5s ease;
    margin-top: 0;
}

/* --- CLASSES DE COR PARA O HEADER --- */
.filtro-header.header-cupons {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    box-shadow: 0 2px 10px rgba(255, 107, 53, 0.2);
}
.filtro-header.header-aluguel {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    box-shadow: 0 2px 10px rgba(40, 167, 69, 0.2);
}
.filtro-header.header-anuncios {
    background: linear-gradient(135deg, #007bff 0%, #6610f2 100%);
    box-shadow: 0 2px 10px rgba(0, 123, 255, 0.2);
}

.filtro-titulo {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 25px 0;
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    animation: fadeIn 1s ease-in-out; /* Animação sutil de entrada */
}

@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Campo de Busca Principal */
.filtro-busca-principal {
    margin: 25px 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}
.filtro-busca-container {
    position: relative;
    display: flex;
    align-items: center;
}
.busca-icon {
    position: absolute;
    left: 15px; /* Ícone posicionado à esquerda */
    top: 50%;
    transform: translateY(-50%); /* Centraliza verticalmente */
    width: 16px; /* Tamanho reduzido para evitar invasão */
    height: 16px;
    color: #999;
    z-index: 2;
}
.filtro-input {
    width: 100%;
    padding: 15px 15px 15px 80px; /* Aumentado padding-left para evitar sobreposição */
    border: none;
    border-radius: 50px;
    font-size: 16px;
    background: white !important;
    color: #000 !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    text-align: left; /* Texto digitado alinhado à esquerda */
}
.filtro-input:focus {
    outline: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}
.filtro-input::placeholder {
    color: #999;
    text-align: center; /* Centraliza o placeholder */
    padding-left: 0; /* Remove qualquer padding extra no placeholder */
}

/* Ajuste para dispositivos móveis */
@media (max-width: 768px) {
    .filtro-titulo {
        font-size: 2rem;
        animation: fadeIn 0.8s ease-in-out; /* Animação mais rápida no mobile */
    }
    .filtro-input {
        padding: 12px 12px 12px 70px; /* Ajuste no padding para telas menores */
        font-size: 14px; /* Reduz a fonte para melhor legibilidade */
    }
    .busca-icon {
        left: 12px; /* Ajuste fino para mobile */
        width: 14px; /* Tamanho menor do ícone */
        height: 14px;
    }
}

/* Botões de Categoria (Tabs) */
.filtro-tabs { display: flex; justify-content: center; gap: 15px; margin-top: 25px; }
.filtro-tab { padding: 12px 24px; border: 2px solid white; background: transparent; color: white; border-radius: 25px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; }
.filtro-tab.active { background: white; }
.filtro-tab:hover { background: rgba(255, 255, 255, 0.1); }
.filtro-tab.active:hover { background: white; }

/* Ajusta a cor do texto do botão ativo para combinar com o fundo */
.filtro-header.header-cupons .filtro-tab.active { color: #ff6b35; }
.filtro-header.header-aluguel .filtro-tab.active { color: #28a745; }
.filtro-header.header-anuncios .filtro-tab.active { color: #007bff; }

/* PARTE 2: FILTROS AVANÇADOS E CATEGORIAS */
.filtros-container-geral {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

/* Toggle de Filtros */
.filtros-toggle-container { padding: 10px 20px 20px 20px; border-top: none; }
.filtros-toggle-btn { display: flex; align-items: center; justify-content: center; gap: 10px; background: #6c757d; color: white; border: none; padding: 12px 20px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.3s ease; margin: 0 auto; }
.filtros-toggle-btn:hover { background: #5a6268; }
.filtros-toggle-btn.active { background: #28a745; }
.filtros-toggle-btn .icon { width: 16px; height: 16px; }
.filtros-toggle-btn .toggle-arrow { width: 16px; height: 16px; transition: transform 0.3s ease; }
.filtros-toggle-btn.active .toggle-arrow { transform: rotate(180deg); }

/* Filtros Avançados (Contêiner que colapsa) */
.filtros-avancados { background: white; border-bottom: 1px solid #dee2e6; max-height: 0; overflow: hidden; transition: max-height 0.5s ease-out, padding 0.5s ease-out; display: flex; justify-content: center; width: 100%; padding: 0 10px; }
.filtros-avancados.show { max-height: 700px; padding: 20px 10px; }

/* Formulário de Filtros */
.filtro-form { display: flex; flex-wrap: wrap; gap: 15px; max-width: 1200px; width: 100%; margin: 0 auto; align-items: flex-end; }
.filtro-grupo { display: flex; flex-direction: column; flex: 1; min-width: 180px; }
.filtro-label { font-size: 14px; font-weight: 600; color: #495057; margin-bottom: 5px; display: block; }
.filtro-select-container { position: relative; width: 100%; }
.filtro-select { width: 100%; padding: 10px 30px 10px 10px; border: 1px solid #ced4da; border-radius: 4px; font-size: 14px; appearance: none; background-color: white; cursor: pointer; }
.filtro-select:focus { outline: none; border-color: #80bdff; box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); }
.select-arrow { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; pointer-events: none; color: #6c757d; }

/* Ações dos Filtros */
.filtro-acoes { display: flex; gap: 15px; justify-content: flex-start; flex-grow: 1; min-width: 200px; }
.filtro-btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border: none; border-radius: 4px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; text-decoration: none; flex-grow: 1; }
.filtro-btn-primary { background: #28a745; color: white; }
.filtro-btn-primary:hover { background: #218838; }
.filtro-btn-secondary { background: #6c757d; color: white; }
.filtro-btn-secondary:hover { background: #5a6268; }

/* PARTE 3: LAYOUT DOS CARDS - RESPONSIVIDADE APRIMORADA */
.filtro-content-all { background: white; padding: 0; }
.content-section { padding: 30px 20px; border-bottom: 1px solid #f0f0f0; }
.content-section:last-child { border-bottom: none; }

/* Títulos das Seções com Ícones */
.section-title { font-size: 1.8rem; font-weight: 700; margin: 0 0 20px 0; color: #2c3e50; display: flex; align-items: center; gap: 12px; }
.section-title svg { width: 28px; height: 28px; flex-shrink: 0; }
.cupons-title { color: #ff6b35; }
.cupons-title svg { fill: #ff6b35; }
.aluguel-title { color: #28a745; }
.aluguel-title svg { fill: #28a745; }
.anuncios-title { color: #007bff; }
.anuncios-title svg { fill: #007bff; }

/* === LAYOUT RESPONSIVO DOS CARDS === */

/* DESKTOP: Layout em Grid com 5 colunas */
@media (min-width: 1200px) {
    .trending-offers, .new-listings {
        overflow: visible; /* Remove o overflow para permitir quebra de linha */
        padding-bottom: 15px;
    }
    
    .trending-cards-horizontal, .listings-cards-horizontal {
        display: grid;
        grid-template-columns: repeat(5, 1fr); /* Exatamente 5 colunas */
        gap: 20px;
        padding: 10px 5px;
        min-width: auto; /* Remove a largura mínima que força linha única */
    }
}

/* DESKTOP MÉDIO: Layout em Grid com 4 colunas */
@media (min-width: 992px) and (max-width: 1199px) {
    .trending-offers, .new-listings {
        overflow: visible;
        padding-bottom: 15px;
    }
    
    .trending-cards-horizontal, .listings-cards-horizontal {
        display: grid;
        grid-template-columns: repeat(4, 1fr); /* 4 colunas para telas médias */
        gap: 20px;
        padding: 10px 5px;
        min-width: auto;
    }
}

/* TABLET: Layout em Grid com 3 colunas */
@media (min-width: 769px) and (max-width: 991px) {
    .trending-offers, .new-listings {
        overflow: visible;
        padding-bottom: 15px;
    }
    
    .trending-cards-horizontal, .listings-cards-horizontal {
        display: grid;
        grid-template-columns: repeat(3, 1fr); /* 3 colunas para tablets */
        gap: 15px;
        padding: 10px 5px;
        min-width: auto;
    }
}

/* MOBILE: Layout de Rolagem Horizontal */
@media (max-width: 768px) {
    .trending-offers, .new-listings {
        overflow-x: auto;
        padding-bottom: 15px;
        -webkit-overflow-scrolling: touch; /* Melhora a experiência de rolagem em iOS */
    }
    
    .trending-cards-horizontal, .listings-cards-horizontal {
        display: flex;
        gap: 15px;
        padding: 10px 5px; /* Adiciona um pequeno padding para não colar nas bordas */
        min-width: max-content; /* Essencial para manter a linha única */
    }
}

/* ANIMAÇÕES */
@keyframes slideInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes shimmer { 0% { background-position: -200px 0; } 100% { background-position: calc(200px + 100%) 0; } }

/* === LAYOUT DOS CARDS === */

/* Card principal - Estrutura Flex para alinhamento vertical */
.trending-card {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.07);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    flex-shrink: 0; /* Impede que o card encolha */
    position: relative;
    animation: slideInUp 0.6s ease-out;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

/* Ajuste para desktop - cards se ajustam ao grid */
@media (min-width: 769px) {
    .trending-card {
        width: 100%; /* Permite que o card se ajuste ao grid */
        height: auto; /* Altura automática */
    }
}

.trending-card:hover { transform: translateY(-8px) scale(1.02); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15); }

/* Imagem */
.trending-card .card-image-container {
    position: relative;
    width: 100%;
    flex-shrink: 0;
    overflow: hidden;
    background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}

/* Altura da imagem responsiva */
@media (min-width: 769px) {
    .trending-card .card-image-container {
        height: 140px; /* Altura maior no desktop */
    }
}

@media (max-width: 768px) {
    .trending-card .card-image-container {
        height: 100px; /* Altura menor no mobile para formato quadrado */
    }
}

.trending-card .card-image { width: 100%; height: 100%; object-fit: cover; object-position: center; transition: transform 0.4s ease; background: none; animation: none; }
.trending-card:hover .card-image { transform: scale(1.05); }

/* PLACEHOLDER DE IMAGEM */
.card-image-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%); color: #6c757d; }
.card-image-placeholder svg { width: 48px; height: 48px; opacity: 0.5; }

/* ESTADOS DE VALIDADE DOS CUPONS */
.trending-card.expired { opacity: 0.7; filter: grayscale(0.3); }
.trending-card.active { border: 1px solid rgba(40, 167, 69, 0.2); }

/* PARTE 4: CONTEÚDO DO CARD (COM FLEXBOX) */
.trending-card .card-content {
    padding: 12px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Evita que o conteúdo vaze */
}

/* Ajuste do conteúdo para mobile */
@media (max-width: 768px) {
    .trending-card .card-content {
        padding: 8px; /* Padding menor no mobile */
    }
}

.card-body-grid {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 8px;
}

/* Ajuste para mobile */
@media (max-width: 768px) {
    .card-body-grid {
        gap: 6px;
        margin-bottom: 6px;
    }
}

.card-info-col { flex: 1; min-width: 0; }
.card-discount-col { flex-shrink: 0; }

.card-title {
    font-size: 1rem;
    line-height: 1.3;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.card-location { font-size: 0.75rem; margin-bottom: 0; color: #6c757d; font-weight: 500; }

/* Ajuste da localização para mobile */
@media (max-width: 768px) {
    .card-location {
        font-size: 0.7rem; /* Fonte menor no mobile */
    }
}

.card-price { font-size: 1rem; font-weight: 700; color: #28a745; margin-top: 4px; }

.discount-badge {
    position: static;
    padding: 6px;
    border-radius: 6px;
    min-width: 45px;
    box-shadow: none;
    border: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    font-weight: 700;
}

/* Ajuste do badge para mobile */
@media (max-width: 768px) {
    .discount-badge {
        padding: 4px;
        min-width: 35px;
    }
}

.discount-value { font-size: 1.1rem; line-height: 1; margin-bottom: 2px; }
.discount-text { font-size: 0.6rem; font-weight: 600; opacity: 0.9; }

/* Ajuste dos valores para mobile */
@media (max-width: 768px) {
    .discount-value {
        font-size: 0.9rem;
    }
    .discount-text {
        font-size: 0.5rem;
    }
}

.discount-badge.desconto-roxo { background: linear-gradient(135deg, #6f42c1 0%, #8e44ad 100%); color: white; }
.discount-badge.desconto-azul { background: linear-gradient(135deg, #007bff 0%, #0056b3 100%); color: white; }
.discount-badge.desconto-amarelo { background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%); color: #212529; }
.discount-badge.desconto-vermelho { background: linear-gradient(135deg, #dc3545 0%, #c82333 100%); color: white; }

.validity-indicator { position: absolute; top: 8px; left: 8px; padding: 4px 8px; border-radius: 20px; font-size: 10px; font-weight: 600; display: flex; align-items: center; gap: 4px; z-index: 3; backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.2); }
.validity-indicator.active { background: rgba(40, 167, 69, 0.9); color: white; }
.validity-indicator.expiring-soon { background: rgba(255, 193, 7, 0.9); color: #212529; animation: pulse 2s infinite; }
.validity-indicator.expired { background: rgba(108, 117, 125, 0.9); color: white; }
.validity-indicator .status-icon { width: 12px; height: 12px; }

/* PARTE 5: ATRIBUTOS, CÓDIGO E BOTÕES (COM FLEXBOX) */
.card-attributes {
    margin: 6px 0;
    padding: 6px 0;
    gap: 4px;
    font-size: 11px;
    color: #6c757d;
    display: flex;
    flex-direction: column;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}

/* Ajuste dos atributos para mobile */
@media (max-width: 768px) {
    .card-attributes {
        margin: 4px 0;
        padding: 4px 0;
        font-size: 10px;
    }
}

.attribute-group { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; }
.card-attribute { display: flex; align-items: center; gap: 4px; font-weight: 500; }
.card-attribute svg { width: 10px; height: 10px; fill: currentColor; flex-shrink: 0; opacity: 0.7; }

.card-expiry { font-weight: 600; }
.card-expiry.active { color: #28a745; }
.card-expiry.expiring-soon { color: #ffc107; }
.card-expiry.expired { color: #6c757d; }
.expiry-icon { width: 10px; height: 10px; }

.coupon-code-section { margin: 6px 0; padding: 6px; background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%); border-radius: 6px; border: 1px solid #dee2e6; }

/* Ajuste da seção de código para mobile */
@media (max-width: 768px) {
    .coupon-code-section {
        margin: 4px 0;
        padding: 4px;
    }
}

.coupon-code-display { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.coupon-code-label { font-size: 9px; font-weight: 600; color: #6c757d; text-transform: uppercase; letter-spacing: 0.5px; }
.coupon-code-value { font-size: 11px; font-weight: 700; color: #2c3e50; font-family: 'Courier New', monospace; background: white; padding: 2px 4px; border-radius: 3px; border: 1px solid #dee2e6; flex-grow: 1; text-align: center; }
.copy-code-btn { background: #007bff; color: white; border: none; padding: 3px 5px; border-radius: 4px; cursor: pointer; transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; }
.copy-code-btn:hover { background: #0056b3; transform: scale(1.05); }
.copy-code-btn.copied { background: #28a745; animation: pulse 0.6s ease-out; }
.copy-icon { width: 12px; height: 12px; }

.card-actions { margin-top: auto; flex-shrink: 0; }
.card-actions .card-btn { width: 100%; padding: 6px 8px; font-size: 0.75rem; font-weight: 600; border-radius: 6px; text-align: center; text-decoration: none; display: block; transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); position: relative; overflow: hidden; letter-spacing: 0.02em; }

/* Ajuste do botão para mobile */
@media (max-width: 768px) {
    .card-actions .card-btn {
        padding: 4px 6px;
        font-size: 0.7rem;
    }
}

.card-actions .card-btn::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent); transition: left 0.5s; }
.card-actions .card-btn:hover::before { left: 100%; }

.listing-card { background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); transition: all 0.3s ease; width: 180px; flex-shrink: 0; }
.listing-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15); }
.listing-card .card-image-container { position: relative; width: 100%; height: 120px; }
.listing-card .card-image { width: 100%; height: 100%; object-fit: cover; }
.listing-card .card-content-small { padding: 15px; }
.listing-card .card-price { font-size: 14px; font-weight: 600; color: #2c3e50; margin: 0 0 10px 0; text-align: center; }
.card-btn-small { display: inline-block; padding: 8px 16px; border-radius: 6px; font-size: 12px; font-weight: 600; text-decoration: none; text-align: center; transition: all 0.3s ease; width: 100%; box-sizing: border-box; }

.cupons-btn { background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%); color: white; box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3); }
.cupons-btn:hover { background: linear-gradient(135deg, #e55a2b 0%, #e8851a 100%); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4); }
.aluguel-btn { background: linear-gradient(135deg, #28a745 0%, #20c997 100%); color: white; box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3); }
.aluguel-btn:hover { background: linear-gradient(135deg, #218838 0%, #1ba085 100%); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4); }
.anuncios-btn { background: linear-gradient(135deg, #007bff 0%, #6610f2 100%); color: white; box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3); }
.anuncios-btn:hover { background: linear-gradient(135deg, #0056b3 0%, #520dc2 100%); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4); }

/* PARTE 6: LOADING, RESPONSIVIDADE E FINALIZAÇÃO */
.filtro-loading { text-align: center; padding: 40px 20px; color: #6c757d; }
.loading-spinner { width: 40px; height: 40px; border: 4px solid #f3f3f3; border-top: 4px solid #ff6b35; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 20px auto; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.filtro-contador { text-align: center; padding: 20px; color: #6c757d; font-size: 14px; margin: 0; }
.filtro-no-results { text-align: center; padding: 60px 20px; color: #6c757d; }
.no-results-icon { margin-bottom: 20px; }
.no-results-icon svg { width: 60px; height: 60px; color: #dee2e6; }
.filtro-no-results h3 { font-size: 1.5rem; margin: 0 0 10px 0; color: #495057; }
.filtro-no-results p { font-size: 14px; margin: 0; }

/* Scrollbars customizadas - apenas para mobile */
@media (max-width: 768px) {
    .trending-offers::-webkit-scrollbar, .new-listings::-webkit-scrollbar, .filtro-anuncios-categorias-inner::-webkit-scrollbar { height: 8px; }
    .trending-offers::-webkit-scrollbar-track, .new-listings::-webkit-scrollbar-track, .filtro-anuncios-categorias-inner::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 4px; }
    .trending-offers::-webkit-scrollbar-thumb, .new-listings::-webkit-scrollbar-thumb, .filtro-anuncios-categorias-inner::-webkit-scrollbar-thumb { border-radius: 4px; }
    .trending-offers::-webkit-scrollbar-thumb:hover, .new-listings::-webkit-scrollbar-thumb:hover, .filtro-anuncios-categorias-inner::-webkit-scrollbar-thumb:hover { background: #a8a8a8; }
    .cupons-section .trending-offers::-webkit-scrollbar-thumb { background: #ff6b35; }
    .aluguel-section .new-listings::-webkit-scrollbar-thumb { background: #28a745; }
    .anuncios-section .trending-offers::-webkit-scrollbar-thumb { background: #007bff; }
    .scrollbar-cupons .filtro-anuncios-categorias-inner::-webkit-scrollbar-thumb { background: #ff6b35; }
    .scrollbar-anuncios .filtro-anuncios-categorias-inner::-webkit-scrollbar-thumb { background: #007bff; }
}

/* =================================================================== */
/* DESIGN PROFISSIONAL PARA A BARRA DE CATEGORIAS COM ROLAGEM          */
/* (SUBSTITUI O CÓDIGO ANTIGO)                                         */
/* =================================================================== */

/* --- Container da Rolagem --- */
.filtro-anuncios-categorias-wrapper {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    padding: 20px calc(50vw - 50%);
    box-sizing: border-box;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.filtro-anuncios-categorias-inner {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding-bottom: 10px; /* Espaço para a barra de rolagem não colar nos botões */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #ced4da #f8f9fa; /* Firefox */
}

/* --- Estilo da Barra de Rolagem (Chrome/Safari) --- */
.filtro-anuncios-categorias-inner::-webkit-scrollbar {
    height: 6px;
}
.filtro-anuncios-categorias-inner::-webkit-scrollbar-track {
    background: transparent;
}
.filtro-anuncios-categorias-inner::-webkit-scrollbar-thumb {
    background-color: #ced4da;
    border-radius: 10px;
    border: 2px solid #f8f9fa;
}

/* --- O Novo Botão de Categoria (Estilo "Pílula") --- */
.filtro-anuncios-categoria-btn {
    /* Estrutura Flex */
    display: inline-flex;
    align-items: center;
    gap: 8px;

    /* Aparência */
    flex-shrink: 0; /* Impede que encolha */
    white-space: nowrap;
    padding: 10px 16px;
    border: 1px solid #dee2e6;
    background: #ffffff;
    border-radius: 50px; /* A chave para o formato de pílula */
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    
    /* Transição Suave */
    transition: all 0.3s ease;
}

/* --- Wrapper do Ícone --- */
.categoria-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #e9ecef;
    transition: all 0.3s ease;
}

.categoria-icon-wrapper svg {
    width: 14px;
    height: 14px;
    color: #495057;
    transition: color 0.3s ease;
}

/* --- Efeito Hover (Passar o Mouse) --- */
.filtro-anuncios-categoria-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #adb5bd;
}

.filtro-anuncios-categoria-btn:hover .categoria-icon-wrapper {
    background-color: #007bff; /* Cor primária ao passar o mouse */
}

.filtro-anuncios-categoria-btn:hover .categoria-icon-wrapper svg {
    color: #ffffff;
}

/* --- Estado Ativo (Categoria Selecionada) --- */
.filtro-anuncios-categoria-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.filtro-anuncios-categoria-btn.active .categoria-icon-wrapper {
    background-color: #ffffff;
}

.filtro-anuncios-categoria-btn.active .categoria-icon-wrapper svg {
    color: #007bff;
}

/* --- Remove o hover persistente em telas de toque --- */
@media (hover: none) {
    .filtro-anuncios-categoria-btn:hover {
        transform: none;
        box-shadow: none;
        border-color: #dee2e6;
    }
    .filtro-anuncios-categoria-btn:hover .categoria-icon-wrapper {
        background-color: #e9ecef;
    }
    .filtro-anuncios-categoria-btn:hover .categoria-icon-wrapper svg {
        color: #495057;
    }
    .filtro-anuncios-categoria-btn.active:hover .categoria-icon-wrapper {
        background-color: #ffffff;
    }
    .filtro-anuncios-categoria-btn.active:hover .categoria-icon-wrapper svg {
        color: #007bff;
    }
}

/* RESPONSIVIDADE MELHORADA */
@media (max-width: 768px) {
    .filtro-header { padding: 20px 15px !important; }
    .filtro-titulo { font-size: 2rem; }
    /* .filtro-tabs { flex-wrap: wrap !important; gap: 10px !important; } */ /* Comentado para usar a regra mais específica abaixo */
    /* .filtro-tab { flex: 1 1 auto !important; min-width: 120px !important; text-align: center !important; } */ /* Comentado para usar a regra mais específica abaixo */
    .filtro-form { flex-direction: column !important; gap: 15px !important; align-items: stretch !important; }
    .filtro-grupo { max-width: 100% !important; }
    .filtro-acoes { justify-content: space-around; }
    
    .section-title { font-size: 1.5rem; }
    .content-section { padding: 20px 10px !important; }
}

/* ================================================= */
/* LAYOUT FINAL: GRADE DE ATRIBUTOS UNIFICADA        */
/* ================================================= */

.card-attributes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 8px;
    margin: 8px 0;
    padding: 8px 0;
    border-top: 1px solid #f0f0f0;
    min-height: 40px;
}

/* Ajuste da grade para mobile */
@media (max-width: 768px) {
    .card-attributes-grid {
        gap: 4px 6px;
        margin: 4px 0;
        padding: 4px 0;
        min-height: 30px;
    }
}

.card-attribute {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #495057;
    white-space: nowrap;
}

/* Ajuste dos atributos para mobile */
@media (max-width: 768px) {
    .card-attribute {
        font-size: 9px;
        gap: 3px;
    }
}

.card-attribute svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    fill: #28a745;
}

/* Ajuste dos ícones para mobile */
@media (max-width: 768px) {
    .card-attribute svg {
        width: 10px;
        height: 10px;
    }
}

.aluguel-card .card-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.aluguel-card .card-price-aluguel {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

/* Ajuste do preço para mobile */
@media (max-width: 768px) {
    .aluguel-card .card-price-aluguel {
        padding-top: 6px;
        font-size: 0.8rem;
    }
}

.card-attributes-grid:empty + .card-price-aluguel {
    border-top: none;
}
.card-attributes-grid:empty {
    display: none;
}

.card-bottom-wrapper {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

/* Ajuste do wrapper para mobile */
@media (max-width: 768px) {
    .card-bottom-wrapper {
        padding-top: 6px;
    }
}

.card-attributes-grid:empty + .card-bottom-wrapper {
    border-top: none;
}

.card-price-aluguel, .coupon-code-section {
    margin-bottom: 8px;
}

/* Ajuste das margens para mobile */
@media (max-width: 768px) {
    .card-price-aluguel, .coupon-code-section {
        margin-bottom: 6px;
    }
}

/* MICRO-INTERAÇÕES E FEEDBACK VISUAL */
.copy-feedback {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    z-index: 9999;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* OTIMIZAÇÕES DE PERFORMANCE */
.trending-card * {
    will-change: auto;
}

.trending-card:hover * {
    will-change: transform;
}
/* =================================================================== */
/* CORREÇÃO: AJUSTE DOS CARDS NO MOBILE PARA EVITAR CORTE DO BOTÃO   */
/* =================================================================== */

@media (max-width: 768px) {
    .trending-card {
        width: 180px; 
        height: auto; 
        display: flex;
        flex-direction: column; 
    }

    .trending-card .card-content {
        flex-grow: 1; 
        display: flex;
        flex-direction: column;
    }

    .card-bottom-wrapper {
        margin-top: auto; 
    }
}

@media (max-width: 768px) {
    .card-title {
        font-size: 0.85rem;
        line-height: 1.3; 
        -webkit-line-clamp: 2;
        min-height: 2.6em; 
        height: auto; 
    }
}
/* =================================================================== */
/* SOLUÇÃO DEFINITIVA: BOTÕES DO CABEÇALHO RESPONSIVOS                 */
/* =================================================================== */

@media (max-width: 768px) {
    .filtro-avancado-container .filtro-tabs {
        display: flex;
        flex-wrap: nowrap !important; 
        gap: 8px !important;          
    }

    .filtro-avancado-container .filtro-tab {
        flex-grow: 1 !important;     
        flex-shrink: 1 !important;   
        flex-basis: 0% !important;   
        min-width: 0 !important;     
        padding: 12px 8px !important;
        font-size: 14px !important;
        white-space: nowrap;         
    }
}
/* =================================================================== */
/* ESTILIZAÇÃO DOS ÍCONES NOS BOTÕES PRINCIPAIS (CUPONS, ETC. )         */
/* =================================================================== */

.filtro-tab {
    display: inline-flex !important; 
    align-items: center;             
    justify-content: center;         
    gap: 8px;                        
}

.filtro-tab-icon {
    width: 18px;   
    height: 18px;  
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .filtro-tab {
        gap: 5px; 
        padding: 12px 5px !important; 
    }

    .filtro-tab-icon {
        width: 16px;  
        height: 16px; 
    }
}
/* =================================================================== */
/* SOLUÇÃO FINAL: CORREÇÃO DE LARGURA (VW) E GRID NO MOBILE            */
/* =================================================================== */

@media (max-width: 768px) {
    /*
     * 1. CORREÇÃO DE LARGURA (A CAUSA RAIZ):
     * Força o contêiner dos filtros a ocupar 100% da largura da tela (viewport),
     * assim como seu elemento pai (.filtro-header). Isso elimina o conflito
     * de layout que estava causando o corte lateral.
     */
    .filtros-avancados {
        width: 100vw;
        margin-left: calc(-50vw + 50%);
        box-sizing: border-box; /* Garante que o padding seja calculado corretamente */
    }

    /*
     * 2. APLICAÇÃO DO PADDING:
     * Agora que a largura está correta, adicionamos o espaçamento
     * lateral de 15px com segurança.
     */
    .filtros-avancados.show {
        padding: 20px 15px;
    }

    /*
     * 3. GRID DE DUAS COLUNAS:
     * Mantém a estrutura de grid para os filtros.
     */
    .filtro-form {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        align-items: end;
    }

    /*
     * 4. BOTÕES NA LARGURA TOTAL:
     * Ajusta os botões para ocuparem a largura completa.
     */
    .filtro-acoes {
        grid-column: 1 / -1;
        display: flex;
        gap: 15px;
    }
}
/* =================================================================== */
/* SOLUÇÃO FINAL: ALINHAMENTO DE LARGURA TOTAL (DESKTOP E MOBILE)      */
/* =================================================================== */

/*
 * 1. APLICA O EFEITO DE LARGURA TOTAL APENAS ONDE É NECESSÁRIO:
 * Esta regra aplica a técnica de 'width: 100vw' (largura total da tela)
 * ao contêiner do botão "Filtros Avançados", fazendo com que ele se
 * comporte exatamente como o cabeçalho e a seção de categorias.
 */
.filtros-container-geral {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    box-sizing: border-box;
}

/*
 * 2. GARANTE O GRID DE DUAS COLUNAS NOS FILTROS (APENAS NO MOBILE):
 * Esta regra, que já estava funcionando, é mantida para organizar
 * os filtros em duas colunas em telas pequenas, garantindo uma boa
 * experiência no celular.
 */
@media (max-width: 768px) {
    .filtro-form {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        align-items: end;
    }

    .filtro-acoes {
        grid-column: 1 / -1;
        display: flex;
        gap: 15px;
    }
}
/* =================================================================== */
/* SOLUÇÃO: BOTÃO DE FILTROS INTEGRADO AOS BOTÕES PRINCIPAIS           */
/* =================================================================== */

/* 1. Estilo base para o novo botão de filtros */
.filtro-toggle-btn {
    gap: 8px; /* Espaçamento entre ícone e texto */
}

.filtro-toggle-btn .toggle-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
    margin-left: auto; /* Empurra a seta para a direita no mobile */
}

.filtro-toggle-btn.active .toggle-arrow {
    transform: rotate(180deg);
}

/* 2. Layout para DESKTOP (a partir de 769px) */
@media (min-width: 769px) {
    .filtro-tabs {
        display: flex;
        justify-content: center;
        align-items: center;
        flex-wrap: nowrap; /* Garante que fiquem na mesma linha */
        gap: 15px;
    }

    .filtro-tab {
        flex-grow: 0; /* Impede que os botões estiquem */
    }

    /* Esconde a seta de dropdown no desktop, pois não é necessária */
    .filtro-toggle-btn .toggle-arrow {
        display: none;
    }
}

/* 3. Layout para MOBILE (até 768px) */
@media (max-width: 768px) {
    .filtro-tabs {
        display: grid;
        grid-template-columns: repeat(3, 1fr); /* Cria um grid de 3 colunas */
        gap: 10px;
    }

    /* O botão de filtros avançados ocupa a largura total da linha de baixo */
    .filtro-toggle-btn {
        grid-column: 1 / -1; /* Faz o item ocupar todas as colunas do grid */
        width: 100%;
        justify-content: center; /* Centraliza o conteúdo do botão */
    }
    
    /* Garante que o ícone e o texto fiquem centralizados */
    .filtro-toggle-btn .icon {
        margin-right: 8px;
    }
    
    .filtro-toggle-btn .toggle-arrow {
        display: inline-block; /* Mostra a seta no mobile */
        margin-left: 8px;
    }
}

/* 4. Ajuste final de cor para o botão de filtros quando ativo */
.filtro-toggle-btn.active {
    background: white !important; /* Fundo branco como os outros botões ativos */
}

/* A cor do texto do botão de filtros ativo deve combinar com o header atual */
.filtro-header.header-cupons .filtro-toggle-btn.active { color: #ff6b35; }
.filtro-header.header-aluguel .filtro-toggle-btn.active { color: #28a745; }
.filtro-header.header-anuncios .filtro-toggle-btn.active { color: #007bff; }
/* =================================================================== */
/* SOLUÇÃO FINAL (V2): LAYOUT RESPONSIVO DOS BOTÕES DO CABEÇALHO       */
/* =================================================================== */

/* 1. LAYOUT PARA DESKTOP (A partir de 769px) - Sem alterações */
@media (min-width: 769px) {
    .filtro-tabs {
        display: flex;
        justify-content: center;
        align-items: center;
        flex-wrap: nowrap;
        gap: 15px;
    }
    .filtro-toggle-btn .toggle-arrow {
        display: none;
    }
}

/* 2. LAYOUT PARA MOBILE (Até 768px) - Regras reforçadas */
@media (max-width: 768px) {
    .filtro-tabs {
        display: grid !important; /* Força o layout de grade */
        grid-template-columns: 1fr 1fr 1fr !important; /* 3 colunas iguais */
        gap: 10px !important;
    }

    .filtro-toggle-btn {
        grid-column: 1 / 4 !important; /* Ocupa as 3 colunas */
        margin-top: 10px !important;
        justify-content: center !important;
    }
    
    .filtro-toggle-btn .toggle-arrow {
        display: inline-block !important;
    }
}

/* 3. CORES DOS BOTÕES ATIVOS - Sem alterações */
.filtro-tab.active { background: white !important; }
.filtro-header.header-cupons .filtro-tab.active { color: #ff6b35; }
.filtro-header.header-aluguel .filtro-tab.active { color: #28a745; }
.filtro-header.header-anuncios .filtro-tab.active { color: #007bff; }
.filtro-tab.active .filtro-tab-icon { color: currentColor; }