/* Câmara Filters — visual padrão (card branco com header azul). Sobrescreva via tema mudando as variáveis em :root. */

:root {
    --cf-card-bg: #ffffff;
    --cf-card-border: #e5e7eb;
    --cf-header-bg: #1f3461;
    --cf-header-text: #ffffff;
    --cf-header-muted: rgba(255, 255, 255, 0.85);
    --cf-header-icon-bg: rgba(255, 255, 255, 0.12);
    --cf-label-color: #1f3461;
    --cf-input-bg: #ffffff;
    --cf-input-text: #1f2937;
    --cf-input-border: #d1d5db;
    --cf-input-placeholder: #9ca3af;
    --cf-chip-bg: rgba(31, 52, 97, 0.08);
    --cf-chip-bg-hover: rgba(31, 52, 97, 0.14);
    --cf-chip-remove-bg: rgba(31, 52, 97, 0.15);
    --cf-divider: #e5e7eb;
    --cf-radius: 8px;
    --cf-input-radius: 6px;
    --cf-pad-x: 1.5rem;
    --cf-pad-y: 1.25rem;
}

/* Wrapper que ocupa 100% da largura disponível na coluna do Elementor. */
.cf-filter-form {
    width: 100%;
    background: var(--cf-card-bg);
    border: 1px solid var(--cf-card-border);
    border-radius: var(--cf-radius);
    overflow: hidden;
    box-sizing: border-box;
    font-family: inherit;
    transition: opacity 0.2s ease;
}

.cf-filter-form.is-cf-loading {
    opacity: 0.7;
}

.cf-filter-form * {
    box-sizing: border-box;
}

/* ---------- Header ---------- */

.cf-filter-form__header {
    background: var(--cf-header-bg);
    color: var(--cf-header-text);
    padding: 1rem var(--cf-pad-x);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.cf-filter-form__header-icon {
    background: var(--cf-header-icon-bg);
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--cf-input-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.cf-filter-form__header-icon svg {
    width: 1.15rem;
    height: 1.15rem;
    stroke: currentColor;
    fill: none;
}

.cf-filter-form__header-label {
    color: var(--cf-header-muted);
    font-size: 0.95rem;
}

.cf-filter-form__header-date {
    color: var(--cf-header-text);
    font-weight: 700;
    font-size: 0.95rem;
    margin-left: 0.25rem;
}

/* ---------- Body ---------- */

.cf-filter-form__body {
    padding: var(--cf-pad-y) var(--cf-pad-x);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.cf-filter {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
    flex: 0 1 200px;
}

.cf-filter--search { flex: 1 1 320px; }
.cf-filter--number { flex: 0 1 180px; }
.cf-filter--year   { flex: 0 1 180px; }
.cf-filter--sort   { flex: 0 1 220px; }

.cf-filter__label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--cf-label-color);
    letter-spacing: 0.05em;
}

.cf-filter__select,
.cf-filter__input {
    background: var(--cf-input-bg);
    color: var(--cf-input-text);
    border: 1px solid var(--cf-input-border);
    border-radius: var(--cf-input-radius);
    padding: 0.7rem 0.85rem;
    font-size: 0.95rem;
    width: 100%;
    line-height: 1.4;
    appearance: auto;
}

.cf-filter__input::placeholder {
    color: var(--cf-input-placeholder);
}

.cf-filter__select:focus,
.cf-filter__input:focus {
    outline: 2px solid var(--cf-header-bg);
    outline-offset: 1px;
    border-color: var(--cf-header-bg);
}

.cf-filter__input-wrap {
    position: relative;
}

.cf-filter__input-wrap .cf-filter__icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: var(--cf-input-placeholder);
    pointer-events: none;
    stroke: currentColor;
    fill: none;
}

.cf-filter__input-wrap .cf-filter__input {
    padding-left: 2.4rem;
}

/* ---------- Barra de filtros ativos: "Filtrando por: [chip] [chip] · Limpar tudo" ---------- */

.cf-filter__active {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.85rem;
    margin-top: 0.25rem;
    border-top: 1px solid var(--cf-divider);
}

.cf-filter__active-prefix {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--cf-label-color);
    margin-right: 0.25rem;
}

.cf-filter__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--cf-chip-bg);
    color: var(--cf-label-color);
    border-radius: 999px;
    padding: 0.35rem 0.4rem 0.35rem 0.85rem;
    font-size: 0.85rem;
    line-height: 1;
    transition: background 0.15s;
}

.cf-filter__chip:hover { background: var(--cf-chip-bg-hover); }

.cf-filter__chip-label { font-weight: 500; }

.cf-filter__chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 999px;
    background: var(--cf-chip-remove-bg);
    color: var(--cf-label-color);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.cf-filter__chip-remove svg {
    width: 0.65rem;
    height: 0.65rem;
    stroke: currentColor;
    fill: none;
}

.cf-filter__chip-remove:hover {
    background: var(--cf-label-color);
    color: #fff;
}

/* "Limpar tudo" dentro da barra de ativos. */
.cf-filter__active .cf-filter__clear {
    margin-left: auto;
    color: var(--cf-label-color);
    font-size: 0.85rem;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    background: transparent;
    border: 0;
    padding: 0.35rem 0;
}

.cf-filter__active .cf-filter__clear:hover {
    text-decoration: none;
    opacity: 0.75;
}

/* "Limpar Filtros" standalone (quando usado [cf_filter_clear] solto) — vira botão pill outline. */
.cf-filter__clear--standalone {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    align-self: flex-end;
    padding: 0.65rem 1rem;
    border: 1px solid var(--cf-input-border);
    border-radius: 999px;
    color: var(--cf-label-color);
    background: transparent;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    flex: 0 0 auto;
}

.cf-filter__clear--standalone:hover {
    background: var(--cf-label-color);
    color: var(--cf-header-text);
    border-color: var(--cf-label-color);
}

.cf-filter__clear-icon {
    width: 0.95rem;
    height: 0.95rem;
    stroke: currentColor;
    fill: none;
}

/* ---------- Loading skeleton no listing ---------- */

.is-cf-loading {
    position: relative;
    pointer-events: none;
}

.is-cf-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.55);
    z-index: 5;
    pointer-events: none;
    animation: cf-pulse 1.4s ease-in-out infinite;
}

@keyframes cf-pulse {
    0%, 100% { opacity: 0.55; }
    50%      { opacity: 0.25; }
}

/* ---------- Responsivo ---------- */

@media (max-width: 900px) {
    :root {
        --cf-pad-x: 1.1rem;
        --cf-pad-y: 1rem;
    }
    .cf-filter--search { flex: 1 1 100%; }
}

@media (max-width: 600px) {
    .cf-filter-form__header {
        padding: 0.85rem 1rem;
    }
    .cf-filter-form__header-label,
    .cf-filter-form__header-date {
        font-size: 0.85rem;
    }
    .cf-filter-form__body {
        flex-direction: column;
        align-items: stretch;
    }
    .cf-filter,
    .cf-filter--search,
    .cf-filter--year,
    .cf-filter--sort,
    .cf-filter--number {
        flex: 1 1 auto;
    }
    .cf-filter__active .cf-filter__clear {
        margin-left: 0;
    }
}
