/* ============================================================================
   CrecyPlage — Filtres commerçants
   ---------------------------------------------------------------------------
   Remplace la nuée de pastilles. Principe : l'écran est VIDE tant que le
   visiteur n'a rien demandé. Une barre, des facettes repliées, et c'est tout.
   ========================================================================== */

.cfilters {
    margin: 0 0 2rem;
}

/* ------------------------------------------------------------ Barre unique */

.cfilters__searchbar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #fff;
    border: 2px solid var(--sable-doux, #F2E2B6);
    border-radius: 14px;
    padding: 0.15rem 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.cfilters__searchbar:focus-within {
    border-color: var(--eau-profonde, #1E5A7B);
    box-shadow: 0 4px 18px rgba(30, 90, 123, 0.12);
}

.cfilters__icon {
    font-size: 1.25rem;
    color: var(--sable-mouille, #B8956A);
    line-height: 1;
}

.cfilters__input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-size: 1rem;
    color: var(--nuit, #073B4C);
    padding: 0.85rem 0;
    min-width: 0;
}
.cfilters__input::placeholder {
    color: #9AA7B1;
}

.cfilters__clear {
    border: 0;
    background: transparent;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--sable-mouille, #B8956A);
    cursor: pointer;
    padding: 0 0.2rem;
}

/* ------------------------------------------------------------ Suggestions */

.cfilters__suggest {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 20;

    list-style: none;
    margin: 0;
    padding: 0.4rem 0;

    background: #fff;
    border: 1px solid var(--sable-doux, #F2E2B6);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(7, 59, 76, 0.14);

    max-height: 340px;
    overflow-y: auto;
}

.cfilters__suggest-groupe {
    padding: 0.5rem 1rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sable-mouille, #B8956A);
}

.cfilters__suggest-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    cursor: pointer;
    transition: background 0.12s;
}
.cfilters__suggest-item:hover,
.cfilters__suggest-item:focus {
    background: var(--sable-clair, #FBF3DD);
}

.cfilters__suggest-label {
    font-weight: 600;
    color: var(--eau-profonde, #1E5A7B);
}

/* Le mot de nuée qui a produit la correspondance. Sans lui, le visiteur ne
   comprend pas pourquoi « baguette » lui propose Boulangerie. */
.cfilters__suggest-via {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--sable-mouille, #B8956A);
}

.cfilters__suggest-count {
    margin-left: auto;
    font-size: 0.8rem;
    color: #8C9AA5;
    background: var(--sable-clair, #FBF3DD);
    border-radius: 20px;
    padding: 0.1rem 0.5rem;
}

/* --------------------------------------------------------- Filtres actifs */

.cfilters__actifs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.9rem;
}
.cfilters__actifs-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sable-mouille, #B8956A);
}
.cfilters__actifs-liste {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.cchip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 0;
    border-radius: 20px;
    padding: 0.35rem 0.75rem;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--eau-profonde, #1E5A7B);
    color: #fff;
    transition: filter 0.15s;
}
.cchip:hover { filter: brightness(1.12); }
.cchip--zone { background: var(--soleil, #F4A261); color: var(--nuit, #073B4C); }
.cchip--tag  { background: var(--corail, #E76F51); }
.cchip__x    { font-size: 1.05rem; line-height: 1; opacity: 0.85; }

.cfilters__reset {
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 0.85rem;
    text-decoration: underline;
    color: var(--sable-mouille, #B8956A);
    cursor: pointer;
}

/* --------------------------------------------------------- Facettes */

.cfilters__facettes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.9rem;
}

.cfacette {
    border: 1px solid var(--sable-doux, #F2E2B6);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    flex: 1 1 220px;
    min-width: 0;
}

.cfacette__titre {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    cursor: pointer;
    list-style: none;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sable-mouille, #B8956A);
    user-select: none;
}
.cfacette__titre::-webkit-details-marker { display: none; }
.cfacette__titre::after {
    content: "▾";
    margin-left: auto;
    font-size: 0.85rem;
    transition: transform 0.2s;
}
.cfacette[open] .cfacette__titre::after {
    transform: rotate(180deg);
}

.cfacette__compte {
    font-size: 0.72rem;
    background: var(--sable-clair, #FBF3DD);
    color: var(--nuit, #073B4C);
    border-radius: 20px;
    padding: 0.05rem 0.45rem;
}

.cfacette__valeurs {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.3rem;
    max-height: 260px;
    overflow-y: auto;
    border-top: 1px solid var(--sable-clair, #FBF3DD);
}

.cvaleur {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    border-radius: 8px;
    padding: 0.45rem 0.6rem;
    font: inherit;
    font-size: 0.92rem;
    color: var(--nuit, #073B4C);
    cursor: pointer;
    transition: background 0.12s;
}
.cvaleur:hover { background: var(--sable-clair, #FBF3DD); }
.cvaleur.is-active {
    background: var(--eau-profonde, #1E5A7B);
    color: #fff;
    font-weight: 600;
}
.cvaleur__nom { flex: 1; min-width: 0; }
.cvaleur__n {
    font-size: 0.78rem;
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------- Résultats */

#crecy-results.is-loading {
    opacity: 0.45;
    transition: opacity 0.15s;
    pointer-events: none;
}

.crecy-empty {
    padding: 2rem 0;
    text-align: center;
    color: var(--sable-mouille, #B8956A);
}

/* Repli sans JavaScript */
.cfilters__noscript {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.9rem;
}

/* --------------------------------------------------------- Mobile */

@media (max-width: 700px) {
    .cfilters__facettes {
        flex-direction: column;
    }
    .cfacette {
        flex: 1 1 auto;
    }
}
