/* ---------------------------------------------------------------
   Barre de recherche maison [hp_search] et panneau de suggestions.

   La barre reprend a l'identique l'apparence de l'ancienne barre du
   header (bloc de 64 px, pilule grise de 44 px, loupe a gauche, largeur
   maximale de 600 px centree).

   Cette feuille est chargee dans l'en-tete, AVANT le reset du theme Hello
   et le kit Elementor : chaque regle disputee utilise au moins deux
   classes (reset Hello : input[type=search] en 0,1,1 et :focus en 0,2,1 ;
   kit : .elementor-kit-9 button en 0,1,1 et :hover / :focus en 0,2,1).
--------------------------------------------------------------- */

.hp-search.hp-search {
    position: relative;
    display: block;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 10px;
    background: #fff;
    border-radius: 10px;
    box-sizing: border-box;
}

.hp-search .hp-search__input {
    display: block;
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 8px 16px 8px 48px;
    font-family: "Raleway", sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 24px;
    color: #1F2626;
    background: #eee;
    border: 2px solid #fff;
    border-radius: 30px;
    box-shadow: none;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.hp-search .hp-search__input::placeholder {
    color: #767676;
    opacity: 1;
}

.hp-search .hp-search__input:focus {
    border-color: #fff;
    box-shadow: 0 0 0 2px #2787C9;
    outline: none;
}

/* Croix native des champs de recherche : on garde la notre (Echap). */
.hp-search .hp-search__input::-webkit-search-cancel-button,
.hp-search .hp-search__input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}

.hp-search .hp-search__submit {
    position: absolute;
    top: 50%;
    left: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin: -17px 0 0;
    padding: 0;
    color: #111;
    background: transparent;
    border: 0;
    border-radius: 50%;
    box-shadow: none;
    cursor: pointer;
    line-height: 1;
}

.hp-search .hp-search__submit:hover,
.hp-search .hp-search__submit:focus {
    color: #2787C9;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.hp-search .hp-search__submit:focus-visible {
    outline: 2px solid #2787C9;
    outline-offset: 1px;
}

.hp-search .hp-search__submit svg {
    display: block;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ---------------------------------------------------------------
   Panneau de suggestions (un seul, rattache au body)
--------------------------------------------------------------- */

.hp-search-panel {
    position: fixed;
    z-index: 99990;
    top: 0;
    left: 0;
    width: 420px;
    max-height: min(70vh, 560px);
    display: flex;
    flex-direction: column;
    font-family: "Raleway", sans-serif;
    color: #1F2626;
    background: #fff;
    border: 1px solid #E2E8E2;
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(31, 38, 38, 0.14);
    box-sizing: border-box;
    overflow: hidden;
}

.hp-search-panel[hidden] {
    display: none;
}

.hp-search-panel.is-loading .hp-search-panel__body {
    opacity: 0.55;
}

.hp-search-panel .hp-search-panel__head {
    display: none;
}

.hp-search-panel .hp-search-panel__body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 6px 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    transition: opacity 0.12s;
}

.hp-search-panel .hp-search-panel__label {
    display: block;
    margin: 0;
    padding: 10px 16px 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #767676;
}

.hp-search-panel .hp-search-panel__empty,
.hp-search-panel .hp-search-panel__status {
    margin: 0;
    padding: 16px;
    font-size: 14px;
    color: #767676;
}

.hp-search-panel .hp-search-opt {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 8px 16px;
    color: #1F2626;
    text-decoration: none;
    background: transparent;
    cursor: pointer;
}

.hp-search-panel .hp-search-opt:hover,
.hp-search-panel .hp-search-opt.is-active {
    color: #1F2626;
    background: #e8f3fb;
    text-decoration: none;
}

.hp-search-panel .hp-search-opt__thumb {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    overflow: hidden;
    background: #F4F7F4;
    border-radius: 6px;
}

.hp-search-panel .hp-search-opt__thumb img {
    display: block;
    width: 44px;
    height: 44px;
    max-width: none;
    object-fit: contain;
}

.hp-search-panel .hp-search-opt__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.hp-search-panel .hp-search-opt__name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hp-search-panel .hp-search-opt__name mark {
    padding: 0;
    color: #2787C9;
    font-weight: 700;
    background: transparent;
}

.hp-search-panel .hp-search-opt__meta {
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.35;
    color: #767676;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hp-search-panel .hp-search-types {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 2px 16px 8px;
}

.hp-search-panel .hp-search-opt.hp-search-opt--type {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    color: #1F2626;
    background: #fff;
    border: 1px solid #E2E8E2;
    border-radius: 999px;
}

.hp-search-panel .hp-search-opt.hp-search-opt--type:hover,
.hp-search-panel .hp-search-opt.hp-search-opt--type.is-active {
    color: #1F2626;
    background: #e8f3fb;
    border-color: #2787C9;
}

.hp-search-panel .hp-search-opt__count {
    font-weight: 400;
    color: #767676;
}

.hp-search-panel .hp-search-opt--code .hp-search-opt__name {
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 13px;
    letter-spacing: 0.02em;
}

.hp-search-panel .hp-search-opt--all {
    justify-content: center;
    margin-top: 6px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 700;
    color: #2787C9;
    border-top: 1px solid #E2E8E2;
}

.hp-search-panel .hp-search-opt--all:hover,
.hp-search-panel .hp-search-opt--all.is-active {
    color: #2787C9;
}

/* ---------------------------------------------------------------
   Mobile : panneau en plein ecran sous la barre
--------------------------------------------------------------- */

@media (max-width: 767px) {
    .hp-search-panel {
        left: 0;
        right: 0;
        width: auto;
        max-height: none;
        border: 0;
        border-top: 1px solid #E2E8E2;
        border-radius: 0;
        box-shadow: none;
    }

    .hp-search-panel .hp-search-panel__head {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        padding: 4px 8px 0;
    }

    .hp-search-panel .hp-search-panel__close {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        width: auto;
        height: 36px;
        margin: 0;
        padding: 0 10px;
        font-family: "Raleway", sans-serif;
        font-size: 14px;
        font-weight: 600;
        line-height: 1;
        color: #1F2626;
        background: transparent;
        border: 0;
        border-radius: 8px;
        box-shadow: none;
        cursor: pointer;
    }

    .hp-search-panel .hp-search-panel__close:hover,
    .hp-search-panel .hp-search-panel__close:focus {
        color: #2787C9;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .hp-search-panel .hp-search-panel__close svg {
        flex-shrink: 0;
    }

    .hp-search-panel .hp-search-opt {
        padding: 10px 16px;
    }

    html.hp-search-lock,
    html.hp-search-lock body {
        overflow: hidden;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hp-search .hp-search__input,
    .hp-search-panel .hp-search-panel__body {
        transition: none;
    }
}
