/*
 * H&O AI Search — styles minimalistes.
 *
 * Ce fichier herite volontairement des polices, couleurs et bordures du
 * theme actif partout ou possible (font: inherit, color: inherit) plutot
 * que d'imposer une charte graphique. Seules les proprietes structurelles
 * strictement necessaires au fonctionnement du dropdown (position,
 * z-index, overflow) sont fixees.
 *
 * Toutes les classes sont prefixees "ho-ai-search" pour eviter tout
 * conflit avec les styles existants du theme.
 */

.ho-ai-search {
    position: relative;
    width: 100%;
}

.ho-ai-search__field {
    position: relative;
    display: flex;
    align-items: center;
}

.ho-ai-search__input {
    width: 100%;
    box-sizing: border-box;
    font: inherit;
    color: inherit;
    padding: 0.55em 2.2em 0.55em 2.8em !important;
    border: 1px solid var(--color-brand-green);
    border-radius: 0.4rem !important;
    background: #fff;
    line-height: 48px;
   
}

.ho-ai-search__input:focus {
    outline: none;
    border-color: currentColor;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}

.ho-ai-search__submit {
    /*
     * Positionnee independamment du flux flex (position: absolute retire
     * un element de l'alignement flex de son parent), la loupe doit donc
     * etre recentree verticalement explicitement via top/transform plutot
     * que de compter sur "align-items: center" du conteneur, qui ne
     * s'applique pas a un enfant en position absolue. Sans cela, l'icone
     * reste alignee sur sa position statique (en haut du champ), ce qui la
     * fait paraitre au-dessus du texte au lieu d'etre centree avec lui.
     */
    position: absolute;
    top: 50%;
    left: 0.7em;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0.2em;
    margin: 0;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    line-height: 0;
}

.ho-ai-search__submit:hover,
.ho-ai-search__submit:focus {
    opacity: 1;
    outline: none;
}

.ho-ai-search__spinner {
    position: absolute;
    top: 50%;
    right: 0.7em;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-top-color: rgba(0, 0, 0, 0.55);
    border-radius: 50%;
    display: none;
    animation: ho-ai-search-spin 0.7s linear infinite;
}

.ho-ai-search.is-loading .ho-ai-search__spinner {
    display: block;
}

@keyframes ho-ai-search-spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

.ho-ai-search__panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    margin: 4px 0 0;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    max-height: min(420px, calc(100vh - 120px));
    overflow: hidden;
}

.ho-ai-search__panel[hidden] {
    display: none !important;
}

.ho-ai-search__results {
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    padding: 4px;
    list-style: none;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ho-ai-search__result {
    display: block;
    padding: 0;
    border-radius: 3px;
    color: inherit;
}

.ho-ai-search__result-link {
    display: flex;
    align-items: center;
    gap: 0.7em;
    width: 100%;
    box-sizing: border-box;
    padding: 0.5em;
    border-radius: 3px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.ho-ai-search__result:hover,
.ho-ai-search__result.is-active {
    background: rgba(0, 0, 0, 0.05);
}

.ho-ai-search__result-image {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.05);
}

.ho-ai-search__result-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ho-ai-search__result-name {
    font-size: 0.95em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ho-ai-search__result-price {
    font-size: 0.85em;
    opacity: 0.75;
}

.ho-ai-search__result-stock {
    font-size: 0.78em;
    color: #b32d2e;
}

.ho-ai-search__message {
    padding: 0.7em;
    font-size: 0.9em;
    opacity: 0.75;
    text-align: center;
}

.ho-ai-search__section-label {
    padding: 0.6em 0.5em 0.3em;
    font-size: 0.72em;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.55;
}

.ho-ai-search__section-label:first-child {
    padding-top: 0.3em;
}

.ho-ai-search__result--term .ho-ai-search__result-link {
    justify-content: space-between;
}

.ho-ai-search__term-name {
    font-size: 0.95em;
}

.ho-ai-search__term-count {
    font-size: 0.78em;
    opacity: 0.55;
}

.ho-ai-search__see-all {
    flex: 0 0 auto;
    display: block;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.7em;
    text-align: center;
    background: #fff;
    font-size: 0.9em;
    font-weight: 600;
    text-decoration: none;
    color: inherit;
}

.ho-ai-search__see-all:hover,
.ho-ai-search__see-all:focus {
    background: rgba(0, 0, 0, 0.05);
    outline: none;
}
