/* SMART SEARCH START */

.smart-search-field {
    position: relative;
    width: 100%;
    min-width: 0;
}

.smart-search-field > input {
    width: 100% !important;
    min-width: 0;
}

.smart-search-dropdown {
    position: absolute;
    z-index: 12000;
    top: calc(100% + 9px);
    left: 0;
    width: min(680px, 92vw);
    max-height: min(560px, 68vh);
    overflow-x: hidden;
    overflow-y: auto;
    border:
        1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    background:
        rgba(4, 12, 24, 0.985);
    box-shadow:
        0 28px 80px rgba(0, 0, 0, 0.62),
        0 0 0 1px rgba(117, 182, 223, 0.05);
    backdrop-filter: blur(18px);
}

.smart-search-dropdown[hidden] {
    display: none !important;
}

.smart-search-item {
    display: grid;
    grid-template-columns:
        64px
        minmax(0, 1fr)
        auto;
    gap: 13px;
    align-items: center;
    min-height: 82px;
    padding: 10px 13px;
    color: #ffffff;
    border-bottom:
        1px solid rgba(255, 255, 255, 0.07);
    text-decoration: none;
    transition:
        background 0.15s ease,
        transform 0.15s ease;
}

.smart-search-item:hover,
.smart-search-item.is-active {
    color: #ffffff;
    background:
        rgba(117, 182, 223, 0.11);
}

.smart-search-item__media {
    display: flex;
    width: 64px;
    height: 58px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #71869a;
    border-radius: 9px;
    background: #ffffff;
    font-size: 9px;
    font-weight: 900;
}

.smart-search-item__media img {
    display: block;
    width: 100%;
    height: 100%;
    padding: 3px;
    object-fit: contain;
    background: #ffffff;
}

.smart-search-item__content {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.smart-search-item__content strong {
    display: -webkit-box;
    overflow: hidden;
    color: #ffffff;
    line-height: 1.32;
    font-size: 14px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.smart-search-item__content span {
    overflow: hidden;
    color: #8fa5b8;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
}

.smart-search-item__side {
    display: grid;
    min-width: 92px;
    gap: 5px;
    text-align: right;
}

.smart-search-item__side strong {
    color: #ffffff;
    white-space: nowrap;
    font-size: 15px;
}

.smart-search-item__side small {
    white-space: nowrap;
    font-size: 10px;
    font-weight: 800;
}

.smart-search-item__side .is-stock {
    color: #83dfa0;
}

.smart-search-item__side .is-order {
    color: #efa09a;
}

.smart-search-all {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    color: #ffffff;
    background:
        rgba(228, 72, 61, 0.13);
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
}

.smart-search-all:hover {
    color: #ffffff;
    background:
        rgba(228, 72, 61, 0.23);
}

.smart-search-empty {
    padding: 22px;
    color: #aebdcc;
    text-align: center;
    font-size: 13px;
}

.search-overlay .smart-search-field {
    width: 100%;
}

.search-overlay .smart-search-dropdown {
    width: 100%;
}

.catalog-search .smart-search-field {
    min-width: 0;
}

@media (max-width: 650px) {
    .smart-search-dropdown {
        width: 100%;
        max-height: 62vh;
        border-radius: 13px;
    }

    .smart-search-item {
        grid-template-columns:
            54px
            minmax(0, 1fr);
        min-height: 75px;
        padding: 9px;
    }

    .smart-search-item__media {
        width: 54px;
        height: 52px;
    }

    .smart-search-item__side {
        display: none;
    }

    .smart-search-item__content strong {
        font-size: 13px;
    }
}

/* SMART SEARCH END */

/* SMART SEARCH LAYER FIX START */

/*
 * В основном CSS у первого экрана задано
 * overflow: hidden. Это обрезало выпадающий
 * список на границе следующего раздела.
 *
 * Выпускаем содержимое наружу только тогда,
 * когда поиск активен.
 */
.hero:focus-within,
.hero:has(
    .smart-search-dropdown:not([hidden])
) {
    position: relative;
    z-index: 20;
    overflow: visible !important;
}

/*
 * Все промежуточные контейнеры также не должны
 * обрезать выпадающий список.
 */
.hero:focus-within .hero__grid,
.hero:focus-within .hero__copy,
.hero:focus-within .hero-search,
.hero:focus-within .smart-search-field,
.hero:has(
    .smart-search-dropdown:not([hidden])
) .hero__grid,
.hero:has(
    .smart-search-dropdown:not([hidden])
) .hero__copy,
.hero:has(
    .smart-search-dropdown:not([hidden])
) .hero-search,
.hero:has(
    .smart-search-dropdown:not([hidden])
) .smart-search-field {
    overflow: visible !important;
}

/*
 * Левая часть первого экрана с поиском должна
 * находиться над декоративной частью справа.
 */
.hero .hero__copy {
    position: relative;
    z-index: 3;
}

.hero .hero__visual {
    position: relative;
    z-index: 1;
}

/*
 * Форма и список находятся выше следующих
 * блоков страницы, но ниже фиксированной шапки,
 * у которой z-index равен 50.
 */
.hero .hero-search {
    position: relative;
    z-index: 24;
}

.hero .smart-search-field {
    position: relative;
    z-index: 25;
}

.hero .smart-search-dropdown {
    z-index: 26 !important;
}

/*
 * На странице каталога поднимаем активную форму
 * над карточками и боковыми фильтрами.
 */
.catalog-search:focus-within,
.catalog-toolbar:focus-within {
    position: relative;
    z-index: 30;
    overflow: visible !important;
}

.catalog-search:focus-within
.smart-search-field,
.catalog-toolbar:focus-within
.smart-search-field {
    z-index: 31;
}

.catalog-search
.smart-search-dropdown,
.catalog-toolbar
.smart-search-dropdown {
    z-index: 32 !important;
}

/*
 * Полноэкранный поиск уже является отдельным
 * фиксированным слоем. Его подсказки размещаем
 * выше внутреннего содержимого окна.
 */
.search-overlay .smart-search-field {
    position: relative;
    z-index: 3;
    overflow: visible !important;
}

.search-overlay .smart-search-dropdown {
    z-index: 4 !important;
}

/* SMART SEARCH LAYER FIX END */
