/* ES Autocomplete dropdown */
.es-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 6px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    /* Раскрываем по высоте контента; ограничение только от вьюпорта — чтобы
       на низких экранах оставался scroll. На обычном десктопе hit-list (5) +
       cats (3) + brands (3) + CTA помещаются без скролла. */
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    z-index: 9999;
    font-size: 14px;
    color: #222;
}
.es-autocomplete a { text-decoration: none; color: inherit; }

.es-ac__section { padding: 6px 0; border-bottom: 1px solid #f0f0f0; }
.es-ac__section:last-child { border-bottom: none; }

.es-ac__title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    font-weight: 600;
    padding: 6px 16px 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.es-ac__clear {
    background: none;
    border: none;
    color: #cf0c23;
    font-size: 11px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}
.es-ac__clear:hover, .es-ac__clear:active { background: #fbe9ec; }
.es-ac__sug--hist .es-ac__ico { font-size: 14px; }

/* Suggestions */
.es-ac__sug {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
}
.es-ac__sug:hover, .es-ac__sug.es-ac__active { background: #f7f7f8; }
.es-ac__sug .es-ac__ico { color: #aaa; font-size: 13px; }
.es-ac__sug b { color: #cf0c23; font-weight: 600; }

/* Products */
.es-ac__prod {
    display: flex;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    align-items: center;
}
.es-ac__prod:hover, .es-ac__prod.es-ac__active { background: #f7f7f8; }
.es-ac__prod-img {
    width: 48px; height: 48px; flex-shrink: 0;
    background: #f0f0f0; border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.es-ac__prod-img img { width: 100%; height: 100%; object-fit: cover; }
.es-ac__prod-img .es-ac__ph { font-size: 22px; color: #bbb; }
.es-ac__prod-body { flex: 1; min-width: 0; }
.es-ac__prod-title {
    font-size: 13px;
    line-height: 1.35;
    color: #222;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.es-ac__prod-title b { color: #cf0c23; font-weight: 600; }
.es-ac__prod-meta {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}
.es-ac__prod-price {
    font-size: 13px;
    font-weight: 600;
    color: #222;
    white-space: nowrap;
    align-self: center;
}

/* Categories / Brands */
.es-ac__tax {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 16px;
    cursor: pointer;
    font-size: 13px;
    color: #2a5885;
}
.es-ac__tax:hover, .es-ac__tax.es-ac__active { background: #f7f7f8; }
.es-ac__tax-name b { color: #cf0c23; font-weight: 600; }
.es-ac__tax-count {
    font-size: 11px;
    color: #888;
    background: #f0f0f0;
    padding: 1px 8px;
    border-radius: 10px;
}

/* CTA */
.es-ac__cta {
    display: block;
    padding: 12px 16px;
    text-align: center;
    background: #fafafa;
    font-size: 13px;
    color: #cf0c23;
    font-weight: 600;
    cursor: pointer;
    border-top: 1px solid #e5e5e5;
}
.es-ac__cta:hover, .es-ac__cta.es-ac__active { background: #f0f0f0; color: #8a0717; }

.es-ac__empty {
    padding: 16px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

/* Mobile — fullscreen */
@media (max-width: 900px) {
    .es-autocomplete {
        position: fixed;
        /* top устанавливается из JS = inputRect.bottom + 6, чтобы не перекрывать поле */
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        border-radius: 0;
        max-height: none;
        box-shadow: none;
        border-top: 1px solid #f0f0f0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        overflow-y: auto;
    }
    .es-ac__section { border-bottom: 8px solid #f5f6f8; padding: 10px 0; }
    .es-ac__sug { padding: 12px 16px; font-size: 15px; }
    .es-ac__prod { padding: 12px 16px; }
    .es-ac__prod-img { width: 56px; height: 56px; }
    .es-ac__prod-title { font-size: 14px; }
    .es-ac__tax { padding: 12px 16px; font-size: 14px; }
    .es-ac__cta { padding: 16px; font-size: 14px; }
}
