/**
 * a4w_searchbar — barre compacte et panneau latéral.
 * Jetons du thème avec repli, aucune valeur de :root ; espacements en multiples de 8 ; cibles de
 * 44 px au moins. Voile et panneau au niveau du panneau de panier (a4w_cartflow : 10000 et 10001),
 * au-dessus de l'en-tête collant du thème (1040).
 *
 * @author    allforweb
 * @copyright allforweb
 * @license   Commercial
 */

.a4w-sb {
    position: relative;
}

.a4w-sb__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    /* Pas de couleur propre : celle des boutons d'icônes de l'en-tête du thème
       (.header-block__action-btn), que le mode transparent du megamenu passe en blanc. */
    cursor: pointer;
}

.a4w-sb__icon {
    flex-shrink: 0;
}

/* Centrée dans sa cible de 44 px : sans la marge droite que le thème donne aux icônes suivies
   d'un libellé. */
.a4w-sb__toggle .a4w-sb__icon {
    margin: 0;
}

.a4w-sb__input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--text-color, inherit);
    font: inherit;
    font-size: 1rem;
}

.a4w-sb__input:focus {
    outline: none;
}

.a4w-sb__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--border-color, #e8e8e8);
    border-radius: 50%;
    background: var(--background-color, #fff);
    color: var(--text-color, inherit);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

/* ------------------------------------------------------------------ compacte */

.a4w-sb__compact {
    position: absolute;
    top: 50%;
    right: 0;
    z-index: 30;
    width: min(420px, calc(100vw - 32px));
    transform: translateY(-50%);
}

.a4w-sb__form {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 0 0 16px;
    /* Encre d'accent : la couleur primaire est un fond (#FFF9F9 sur Gumuche), invisible en trait. */
    border: 1px solid var(--accent-ink-color, var(--primary-color, #593322));
    border-radius: var(--border-radius-round, 30px);
    background: var(--background-color, #fff);
}

.a4w-sb__form .a4w-sb__close {
    width: 40px;
    height: 40px;
    border: 0;
}

.a4w-sb__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    padding: 8px 0;
    border: 1px solid var(--border-color, #e8e8e8);
    border-radius: var(--border-radius, 10px);
    background: var(--background-color, #fff);
    box-shadow: var(--box-shadow, 0 8px 24px rgba(0, 0, 0, 0.12));
}

.a4w-sb__all {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 8px 16px;
    border: 0;
    background: transparent;
    color: var(--link-color, inherit);
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

/* ------------------------------------------------------------------ panneau */

.a4w-sb__overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    /* Voile transparent : il ne sert qu'à fermer le panneau au clic à côté, sans assombrir la page. */
    background: transparent;
}

.a4w-sb__panel {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 10001;
    width: min(440px, 100vw);
    background: var(--background-color, #fff);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.18);
    transform: translateX(-100%);
    transition: transform var(--a4w-transition, 0.28s ease);
}

.a4w-sb__panel--right {
    right: 0;
    left: auto;
    transform: translateX(100%);
}

.a4w-sb__panel.is-open {
    transform: translateX(0);
}

.a4w-sb__panel-form {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.a4w-sb__panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border-color, #e8e8e8);
}

.a4w-sb__panel-title {
    font-family: var(--font-title, inherit);
    font-size: var(--font-size-h3, 1.375rem);
    font-weight: 600;
    color: var(--h3-color, inherit);
}

.a4w-sb__panel-field {
    padding: 16px 24px;
}

.a4w-sb__field {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 52px;
    margin: 0;
    padding: 0 16px;
    border: 2px solid var(--accent-ink-color, var(--primary-color, #593322));
    border-radius: var(--btn-radius, 12px);
    color: var(--accent-ink-color, var(--primary-color, #593322));
}

.a4w-sb__panel-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 24px 16px;
}

.a4w-sb__heading {
    margin: 0 0 8px;
    font-size: var(--font-size-small, 0.875rem);
    font-weight: 600;
}

.a4w-sb__panel-foot {
    padding: 16px 24px 24px;
    border-top: 1px solid var(--border-color, #e8e8e8);
}

.a4w-sb__submit {
    width: 100%;
    min-height: 52px;
}

body.a4w-sb-locked {
    overflow: hidden;
}

/* ------------------------------------------------------------------ résultats */

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

.a4w-sb__result-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    color: var(--text-color, inherit);
    text-decoration: none;
}

.a4w-sb__panel .a4w-sb__result-link {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color-light, #eee);
}

.a4w-sb__result-link:hover,
.a4w-sb__result-link:focus-visible {
    background: var(--light-bg, #f7f7f7);
}

.a4w-sb__result-img {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: var(--border-radius, 10px);
    background: var(--light-bg, #f7f7f7);
    object-fit: cover;
}

.a4w-sb__compact .a4w-sb__result-img {
    width: 48px;
    height: 48px;
}

.a4w-sb__result-name {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
}

.a4w-sb__result-price {
    white-space: nowrap;
    font-weight: 600;
}

.a4w-sb__status {
    margin: 8px 16px;
    color: var(--medium-gray, #666);
    font-size: var(--font-size-small, 0.875rem);
}

.a4w-sb__panel .a4w-sb__status {
    margin: 8px 0;
}

.a4w-sb__status:empty {
    display: none;
}

@media (max-width: 575.98px) {
    .a4w-sb__panel {
        width: 100vw;
    }
}

@media (prefers-reduced-motion: reduce) {
    .a4w-sb__panel {
        transition: none;
    }
}
