/* ══════════════════════════════════════════════════════════════
   FILTRO INICIO — buscador en cascada con badges y dropdowns
   ══════════════════════════════════════════════════════════════ */

/* ── Contenedor ─────────────────────────────────────────────── */

.fi-widget {
    background: #fff;
    border-radius: 6px;
    padding: 24px 20px 20px;
    box-shadow: 0 2px 16px rgba(0,0,0,.10);
    max-width: 520px;
    margin: 0 auto;
}

.fi-titulo {
    font-size: 1rem;
    font-weight: 600;
    color: #222;
    margin: 0 0 18px;
    line-height: 1.4;
}

/* ── Pasos ──────────────────────────────────────────────────── */

.fi-pasos {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fi-paso {
    position: relative;
    border: 2px solid #00ae42;
    border-radius: 4px;
    background: #fff;
    transition: border-color .2s;
}

.fi-paso.fi-bloqueado {
    border-color: #e0e0e0;
    background: #fafafa;
}

/* El paso abierto flota sobre los demás */
.fi-paso.fi-open {
    z-index: 100;
}

/* ── Fila principal (clickable) ─────────────────────────────── */

.fi-campo-wrap {
    display: flex;
    align-items: center;
    padding: 13px 16px;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    min-height: 52px;
}

.fi-bloqueado .fi-campo-wrap {
    cursor: not-allowed;
}

/* ── Badge numérico ─────────────────────────────────────────── */

.fi-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #00ae42;
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .2s;
}

.fi-bloqueado .fi-badge {
    background: #c8c8c8;
}

/* ── Texto del valor / placeholder ─────────────────────────── */

.fi-valor {
    flex: 1;
    font-size: .95rem;
    color: #bbb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .15s;
}

.fi-valor.fi-seleccionado {
    color: #222;
    font-weight: 500;
}

/* ── Chevron ────────────────────────────────────────────────── */

.fi-chevron {
    color: #aaa;
    flex-shrink: 0;
    transition: transform .2s, color .2s;
}

.fi-paso:not(.fi-bloqueado) .fi-chevron {
    color: #00ae42;
}

.fi-paso.fi-open .fi-chevron {
    transform: rotate(180deg);
}

/* ── Dropdown ───────────────────────────────────────────────── */

.fi-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: -2px;
    right: -2px;
    background: #fff;
    border: 2px solid #00ae42;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 6px 16px rgba(0,0,0,.12);
    z-index: 9999;
}

.fi-paso.fi-open > .fi-dropdown {
    display: block;
}

/* ── Campo de búsqueda ──────────────────────────────────────── */

.fi-search-wrap {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
}

.fi-search {
    width: 100%;
    padding: 7px 10px;
    border: 1.5px solid #ddd;
    border-radius: 4px;
    font-size: .88rem;
    color: #333;
    outline: none;
    box-sizing: border-box;
    background: #fafafa;
}

.fi-search:focus {
    border-color: #00ae42;
    background: #fff;
}

/* ── Lista de opciones ──────────────────────────────────────── */

.fi-lista {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    max-height: 220px;
    overflow-y: auto;
}

.fi-option {
    padding: 9px 16px;
    cursor: pointer;
    font-size: .9rem;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background .08s;
}

.fi-option:hover {
    background: #f5f5f5;
}

.fi-option.fi-selected {
    background: #f0faf4;
    color: #00ae42;
    font-weight: 600;
}

.fi-opt-count {
    color: #bbb;
    font-size: .8em;
    margin-left: 4px;
    flex-shrink: 0;
}

/* ── Estados de lista ───────────────────────────────────────── */

.fi-loading,
.fi-no-results {
    padding: 12px 16px;
    color: #aaa;
    font-size: .88rem;
    text-align: center;
    cursor: default;
}

.fi-loading::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(0,0,0,.12);
    border-top-color: #00ae42;
    border-radius: 50%;
    animation: fi-spin .7s linear infinite;
    margin-right: 7px;
    vertical-align: middle;
}

/* ── Botón Buscar ───────────────────────────────────────────── */

.fi-btn-buscar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: .01em;
    transition: background .2s;
    margin-top: 2px;
}

.fi-btn-buscar:hover  { background: #333; }
.fi-btn-buscar:active { transform: scale(.99); }

.fi-btn-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: fi-spin .6s linear infinite;
}

.fi-btn-buscar.fi-cargando .fi-btn-texto   { display: none; }
.fi-btn-buscar.fi-cargando .fi-btn-spinner { display: inline-block; }

/* ── Animación ──────────────────────────────────────────────── */

@keyframes fi-spin {
    to { transform: rotate(360deg); }
}

/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 480px) {
    .fi-widget     { padding: 18px 14px; }
    .fi-campo-wrap { padding: 12px 14px; }
}
