/* ==========================================================================
   1. ESTRUTURA PRINCIPAL DA PÁGINA DE BUSCA
   ========================================================================== */

.search-results {
    display: flex;
    gap: 20px;
    width: 100%;
    max-width: 1280px; /* Largura máxima do conteúdo */
    margin: 1.25rem auto; /* Centraliza na tela */
    padding: 0 20px; /* Espaçamento lateral para não grudar nas bordas */
}

.search-results-content {
    flex: 1; /* Faz esta área ocupar todo o espaço disponível */
    min-width: 0; /* Impede que elementos flexíveis causem overflow */
}

/* ==========================================================================
   2. PAINEL DE FILTROS (Lateral Esquerda)
   ========================================================================== */

.filtro {
    flex: 0 0 240px; /* Largura fixa de 240px em telas grandes */
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    height: fit-content; /* Altura se ajusta ao conteúdo */
    position: sticky; /* Efeito "grudento" ao rolar a página */
    top: 20px;
}

.filtro h3 {
    margin-top: 0;
    font-size: 1rem;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.8rem;
    margin-bottom: 1.5rem;
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 0.8rem;
}

/* ==========================================================================
   3. CABEÇALHO DOS RESULTADOS (Tag, Classificação, Paginação)
   ========================================================================== */

.search-tag {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 1rem;
    padding: 0 5px;
}

.search-classify {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Permite que os itens quebrem linha em telas menores */
    gap: 15px;
    background-color: var(--color-muted, #f5f5f5); /* Usa sua variável ou um fallback */
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.classification-options {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 14px;
}

.classify-btn {
    padding: 0 15px;
    height: 38px;
    background-color: var(--color-white, #fff);
    color: var(--color-text, #333);
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.classify-btn:hover {
    background-color: #f0f0f0;
    border-color: #bbb;
}

.classify-btn.active {
    background-color: var(--color-urgent-red, #ee4d2d);
    color: var(--color-white, #fff);
    border-color: var(--color-urgent-red, #ee4d2d);
    font-weight: bold;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pagination button {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 38px;
    height: 38px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination button:hover:not(:disabled) {
    background-color: var(--color-urgent-red, #ee4d2d);
    color: var(--color-white, #fff);
    border-color: var(--color-urgent-red, #ee4d2d);
}

.pagination button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.pagination span {
    font-size: 14px;
    font-weight: bold;
}

/* ==========================================================================
   4. COMPONENTE SELECT CUSTOMIZADO (para Preço e Categorias)
   ========================================================================== */

.custom-select-container {
    position: relative;
    width: 100%; /* Largura flexível para caber no filtro */
}

.select-display {
    width: 100%;
    background-color: var(--color-white, #fff);
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.2s ease;
}

.select-display.active {
    border-color: var(--color-urgent-red, #ee4d2d);
    color: var(--color-urgent-red, #ee4d2d);
    font-weight: bold;
}

.select-display::after {
    content: '▼';
    font-size: 12px;
    color: #888;
}

.select-options {
    position: absolute;
    background-color: var(--color-white, #fff);
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 100;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
}

.select-options.hidden {
    display: none;
}

.select-options div { /* Estilo de cada opção */
    padding: 10px 12px;
    cursor: pointer;
}

.select-options div:hover {
    background-color: var(--color-urgent-red, #ee4d2d);
    color: var(--color-white, #fff);
}


/* ==========================================================================
   5. MEDIA QUERIES PARA RESPONSIVIDADE
   ========================================================================== */

/* Telas de Tablet (até 992px) */
@media (max-width: 992px) {
    .filtro {
        flex: 0 0 200px; /* Diminui a largura do filtro */
    }
}

/* Telas de Celular (até 768px) */
@media (max-width: 768px) {
    .search-results {
        flex-direction: column; /* Coloca o filtro em cima do conteúdo */
        gap: 25px;
    }

    .filtro {
        position: static; /* Remove o efeito "grudento" */
        width: 100%;
        height: auto;
    }
    
    .search-classify {
        flex-direction: column;
        align-items: stretch; /* Faz os itens ocuparem a largura toda */
    }
    
    .classification-options, .pagination {
        width: 100%;
        justify-content: center;
    }
}