/* Estilos para Páginas de Busca, Arquivo e Tag */

.search-filters-bar {
    background: transparent;
    padding: 20px 0;
    margin-bottom: 20px;
    border: none !important;
}

/* Linha principal dos filtros: todos os elementos na mesma linha e alinhados */
.filter-row {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    flex-wrap: nowrap !important;
}

/* Campo de busca: cresce para preencher o espaço disponível */
.search-input {
    position: relative !important;
    flex: 1 !important;
    min-width: 200px !important;
    display: flex !important;
    align-items: center !important;
}

.search-input input {
    width: 100% !important;
    padding-right: 35px !important;
}

.search-icon {
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #666 !important;
    pointer-events: none !important;
}

/* Container dos filtros secundários (data, categoria, ordem) */
.scroll-mobile {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    flex-wrap: nowrap !important;
    flex: 0 0 auto;
}

.scroll-mobile::-webkit-scrollbar {
    display: none;
}

.filter-item {
    flex: 0 0 auto;
}

/* Altura e aparência uniforme de todos os controles */
.filter-item select,
.filter-item input,
.date-filter input,
.search-input input,
.cs-dropdown-btn {
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    padding: 0 12px !important;
    border-radius: 6px !important;
    border: 1px solid #e6e6e6 !important;
    background-color: #fff !important;
    font-size: 14px !important;
    font-family: var(--font-content, inherit) !important;
    color: #666 !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    line-height: 42px !important;
    display: block !important;
    vertical-align: middle !important;
}

.filter-item input::placeholder,
.search-input input::placeholder {
    color: #666 !important;
}

.date-filter input {
    width: 160px !important;
    cursor: pointer !important;
}

.filter-item select {
    appearance: none;
    -webkit-appearance: none;
}

/* Ações: Limpar Filtros + Buscar — sempre à direita */
.filter-actions {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
    margin-left: auto !important;
    flex-shrink: 0 !important;
}

.clear-filters {
    font-size: 14px !important;
    color: #004666 !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    line-height: 1.1 !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 42px !important;
    min-height: 42px !important;
    margin: 0 !important;
    padding: 0 5px !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
}

.clear-filters:hover {
    text-decoration: underline;
}

.btn-buscar {
    background: #003366 !important;
    color: #fff !important;
    border: none !important;
    padding: 0 24px !important;
    height: 42px !important;
    min-height: 42px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
}

.btn-buscar:hover {
    background: #135e96 !important;
}

/* ── Dropdown Customizado (cs-dropdown) ── */
.cs-dropdown {
    position: relative;
    display: inline-block;
}

.cs-dropdown-btn {
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 12px !important;
    border-radius: 6px !important;
    border: 1px solid #e6e6e6 !important;
    background-color: #fff !important;
    font-size: 14px !important;
    font-family: var(--font-content, inherit) !important;
    cursor: pointer;
    white-space: nowrap;
    min-width: 160px;
    color: #666 !important;
    justify-content: space-between;
    transition: border-color 0.15s ease;
    box-sizing: border-box !important;
    line-height: 1 !important;
    margin: 0 !important;
}

.cs-dropdown-btn:hover {
    border-color: #aaa;
}

.cs-dropdown-label {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cs-chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    color: #555;
}

.cs-dropdown.is-open .cs-chevron {
    transform: rotate(180deg);
}

.cs-dropdown-list {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    max-height: 250px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    z-index: 999999 !important;
    list-style: none;
    margin: 0;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: #bbb #f0f0f0;
}

.cs-dropdown-list::-webkit-scrollbar { width: 6px; }
.cs-dropdown-list::-webkit-scrollbar-track { background: #f0f0f0; }
.cs-dropdown-list::-webkit-scrollbar-thumb { background: #bbb; border-radius: 3px; }

.cs-dropdown-option {
    padding: 10px 14px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.1s ease;
}

.cs-dropdown-option:hover { background: #f5f5f5; }

.cs-dropdown-option.is-selected {
    background: #1e3a5f;
    color: #fff;
    font-weight: 500;
}

.cs-dropdown-option.is-selected:hover { background: #16304f; }
/* ── Fim Dropdown Customizado ── */

/* Breadcrumb e contagem de resultados */
.breadcrumb,
.breadcrumb span,
.results-count {
    font-size: 16px;
}

.breadcrumb span { font-weight: 600; }
.results-count { font-weight: 400; }

.breadcrumb a { color: inherit; }

.page-title {
    font-size: 24px;
    margin-bottom: 0rem;
}

/* ── Mobile (≤ 768px) ── */
@media (max-width: 768px) {
    body.search .site-main.container {
        padding-left: 2.4rem !important;
        padding-right: 2.4rem !important;
    }

    .search-filter-form,
    .filter-row {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input,
    .search-input input {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    /* No mobile, scroll horizontal nos filtros secundários */
    .scroll-mobile {
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 260px !important; /* Espaço para dropdown abrir */
        margin-bottom: -250px !important; /* Compensa padding sem empurrar layout */
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .scroll-mobile .filter-item {
        flex: 0 0 auto;
        min-width: auto;
    }

    .filter-actions {
        width: 100%;
        margin-left: 0 !important;
        justify-content: center;
        flex-wrap: nowrap;
        margin-top: 15px;
    }

    .btn-buscar {
        min-width: 120px;
    }
}

/* ── Desktop (≥ 769px): sem scroll, tudo visível em linha ── */
@media (min-width: 769px) {
    .scroll-mobile {
        overflow: visible !important;
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }
}
