/* ==============================================
   FILTERS — Barra de filtros e busca
   Centralizado: todos os filtros/buscas da app.
   ============================================== */

/* ── Contêiner ── */
.filters-section {
    background: white;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

/* ── Cabeçalho interno ── */
.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.875rem;
}

/* ── Título (opcional) ── */
.filters-title {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.875rem;
}

.filters-header .filters-title {
    margin-bottom: 0;
}

.filters-title i {
    font-size: 0.7rem;
    color: var(--primary-color);
    opacity: 0.8;
}

/* ── Row de campos ── */
.filters-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

/* ── Wrapper de campo individual ── */
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 140px;
}

/* O filter-group que contém search-input cresce */
.filters-grid > .filter-group:has(.search-input) {
    flex: 1 1 220px;
}

/* ── Label acima do campo ── */
.filter-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

/* ─────────────────────────────────
   Inputs genéricos dentro de filter-group
   (date, number, text sem ícone)
   ───────────────────────────────── */
.filter-group input {
    width: 100%;
    height: 42px;
    padding: 0 0.9rem;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    background: #fafbfc;
    color: var(--body-text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.filter-group input:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(46, 134, 171, 0.08);
    outline: none;
}

/* ─────────────────────────────────
   Busca com ícone
   ───────────────────────────────── */
.search-input {
    position: relative;
}

.search-input > i {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
    pointer-events: none;
    transition: color 0.2s ease;
    z-index: 1;
}

.search-input:focus-within > i {
    color: var(--primary-color);
}

.search-input input {
    width: 100%;
    height: 42px;
    padding: 0 1rem 0 2.5rem;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    background: #fafbfc;
    color: var(--body-text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.search-input input:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(46, 134, 171, 0.08);
    outline: none;
}

.search-input input::placeholder {
    color: var(--text-placeholder);
    font-weight: 400;
}

/* ─────────────────────────────────
   Selects de filtro
   ───────────────────────────────── */
.filter-group select {
    height: 42px;
    padding: 0 2.25rem 0 0.9rem;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--body-text);
    background-color: #fafbfc;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 16px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.filter-group select:focus {
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(46, 134, 171, 0.08);
    outline: none;
}

/* ─────────────────────────────────
   Chips de especialidade
   ───────────────────────────────── */
.specialty-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.specialty-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.85rem;
    border: 1.5px solid var(--border-color);
    border-radius: 20px;
    background: white;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
    white-space: nowrap;
    line-height: 1;
}

.specialty-btn i {
    font-size: 0.75rem;
}

.specialty-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(46, 134, 171, 0.05);
}

.specialty-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.specialty-btn.active:hover {
    background: #267a9f;
    border-color: #267a9f;
    color: white;
}

/* ─────────────────────────────────
   Botão dentro da barra de filtros
   ───────────────────────────────── */
.filters-grid .btn {
    height: 42px;
    padding: 0 1.25rem;
    border: 1.5px solid transparent;
    border-radius: 10px;
    line-height: 1;
}

/* ─────────────────────────────────
   Responsive
   ───────────────────────────────── */
@media (max-width: 1024px) {
    .filters-grid {
        gap: 0.6rem;
    }
}

@media (max-width: 768px) {
    .filters-section {
        padding: 0.9rem 1rem;
    }

    .filters-grid {
        flex-direction: column;
        gap: 0.6rem;
    }

    .filter-group,
    .filters-grid > .filter-group:has(.search-input) {
        width: 100%;
        min-width: 0;
        flex: unset;
    }

    .filter-group select,
    .search-input input,
    .filter-group input {
        width: 100%;
    }
}
