/* Autocomplétion de la barre de recherche (27/09/2026)
   JS : /assets/js/search-autocomplete.js — markup généré, rien dans la vue.
   Mise en page d'après apercu_47 : grande vignette encadrée, titre avec la
   saisie en gras, extrait de description en dessous. */

.sac-form { position: relative; }

/* ── Croix « effacer », logée entre le champ et le bouton loupe ─────── */
.sac-form input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }

/* Posée PAR-DESSUS le champ (et non entre champ et bouton) : la barre
   garde exactement sa largeur d'origine, que la croix soit visible ou non. */
.sac-form .input-group { position: relative; }
/* Pas de padding-right sur le champ : il élargirait la barre (266 → 289 px). */

.sac-clear {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 42px;                   /* largeur du bouton loupe */
    z-index: 6;
    display: inline-flex;
    align-items: center;
    margin: 0 !important;          /* annule le -1px de .input-group > :not(:first-child) */
    padding: 0 10px;
    border: 0;
    background: transparent;
    color: #555;
    font-size: .8rem;
}
.sac-clear:hover { color: #1a1a1a; }
.sac-clear[hidden] { display: none; }
.sac-clear:focus-visible { outline: 2px solid #e905ed; outline-offset: -2px; }

/* ── Panneau ──────────────────────────────────────────────────────────── */
.sac-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    /* Plus large que la barre (266 px) : les vignettes et l'extrait ont
       besoin de place. Borné par la fenêtre sur petit écran. */
    width: 560px;
    max-width: calc(100vw - 24px);
    z-index: 1060;                 /* au-dessus du mega menu et des dropdowns Bootstrap */
    max-height: min(75vh, 620px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(26, 26, 26, .16);
    text-align: left;
    animation: sacIn .12s ease-out;
}
.sac-panel[hidden] { display: none; }

.sac-list { list-style: none; margin: 0; padding: 0; }

.sac-opt {
    display: flex;
    align-items: flex-start;
    gap: 28px;
    padding: 16px;
    border-radius: 10px;
    color: #4a4a4a;
    text-decoration: none;
}
.sac-list li + li .sac-opt { margin-top: 4px; }
.sac-opt:hover, .sac-opt.is-active { background: #f7f6f9; color: #4a4a4a; }

.sac-thumb {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 130px;
    aspect-ratio: 1 / 1;
    border: 1px solid #dcdcdc;
    background: #fff;
    overflow: hidden;
    color: #c4c1ca;
    font-size: 1.6rem;
}
.sac-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }

.sac-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; padding-top: 2px; }

.sac-name {
    font-size: 1.2rem;
    font-weight: 400;
    line-height: 1.3;
    color: #4a4a4a;
}
.sac-opt.is-active .sac-name, .sac-opt:hover .sac-name { color: #1a1a1a; }

.sac-excerpt {
    font-size: .95rem;
    line-height: 1.6;
    color: #5a5a5a;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* La partie tapée ressort en gras, sans fond jaune */
.sac-panel mark {
    padding: 0;
    background: none;
    color: inherit;
    font-weight: 700;
}

.sac-empty { margin: 0; padding: 14px 10px; color: #6b6b76; font-size: .95rem; }

/* petit indicateur pendant la requête, dans la loupe du bouton */
.sac-form.sac-loading .bi-search { animation: sacPulse .8s ease-in-out infinite alternate; }

@keyframes sacIn    { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes sacPulse { from { opacity: 1; } to { opacity: .35; } }

@media (max-width: 767.98px) {
    .sac-panel { padding: 6px; }
    .sac-opt { gap: 14px; padding: 10px; }
    .sac-thumb { width: 76px; }
    .sac-name { font-size: 1.02rem; }
    .sac-excerpt { font-size: .85rem; -webkit-line-clamp: 2; }
    .sac-text { gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
    .sac-panel, .sac-form.sac-loading .bi-search { animation: none; }
}
