/* Подсказки поиска под строкой в шапке (static/js/search.js) */

/* Поиск панелью под шапкой (templates/search_bar.html): главный путь к товару.
   Стиль как у блока «3 способа найти» на главной: синий со скосом в темный, тень карточки, заголовок капсом */
.search-bar {
    position: relative;
    z-index: 50;
    padding: 20px 16px 0;
}

.search-bar-panel {
    display: flex;
    align-items: center;
    gap: 32px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 14px 14px 30px;
    box-sizing: border-box;
    /* Скос под тем же углом 38°, что в блоке «3 способа найти»: темный клин справа под кнопкой */
    background: linear-gradient(128deg, #075095 calc(100% - 300px), #2b2a28 calc(100% - 380px));
    box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.09), 3px 3px 1px -2px rgba(0, 0, 0, 0.09), 0 1px 5px 0 rgba(0, 0, 0, 0.1);
}

.search-bar-title {
    flex-shrink: 0;
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 2.8rem;
    font-weight: 200;
    line-height: 1;
    text-transform: uppercase;
}

.search-bar-title span {
    font-weight: 600;
}

.search-bar-form {
    /* Якорь #поиск стоит на форме: без отступа панель обрезается сверху по краю поля */
    scroll-margin-top: 34px;
    position: relative;
    display: flex;
    flex: 1;
    align-items: stretch;
    min-width: 0;
}

.search-bar-form input,
.search-bar-form button {
    box-sizing: border-box;
    height: 52px;
    margin: 0;
    border: none;
    border-radius: 0;
    font-family: inherit;
}

.search-bar-form input {
    flex: 1;
    min-width: 0;
    padding: 0 18px;
    background: white;
    color: #2b2a28;
    font-size: 1.8rem;
    outline: none;
}

.search-bar-form input::placeholder {
    color: #8a939c;
}

.search-bar-form button {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 8px;
    padding: 0 28px;
    background: #075095;
    color: white;
    font-size: 1.7rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

/* Своя лупа вместо значка шрифта: тот в кольце и смотрится кривым. Без aria-hidden: base.css прячет такие элементы */
.search-bar-icon {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
}

.search-bar-form button:hover {
    background: #1d5f9e;
}

/* Ширина как у строки с кнопкой, сразу под ней */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: white;
    color: #2b2a28;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    font-size: 1.4rem;
    text-align: left;
}

/* Прокрутки нет: товары, не влезшие до низа окна, скрываются, вместо них кнопка «Показать все» */
.search-suggestions[hidden],
.search-suggestion[hidden] {
    display: none;
}

.search-suggestions-group + .search-suggestions-group {
    border-top: 1px solid #d5dbe2;
}

.search-suggestions-title {
    margin: 0;
    padding: 10px 16px 4px;
    color: #8a939c;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.search-suggestion {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    color: #2b2a28;
    text-decoration: none;
}

.search-suggestion:hover,
.search-suggestion-active {
    background: #edf2f7;
}

.search-suggestion-link {
    justify-content: space-between;
}

.search-suggestion-count,
.search-suggestion-articul,
.search-suggestion-stock {
    color: #6b7a8c;
    font-size: 1.2rem;
}

.search-suggestion-part img {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.search-suggestion-name {
    flex: 1;
    min-width: 0;
}

.search-suggestion-articul,
.search-suggestion-stock {
    display: block;
}

.search-suggestion-price {
    flex-shrink: 0;
    text-align: right;
    font-weight: 600;
}

.search-suggestion-stock {
    font-weight: normal;
}

.search-suggestion-out {
    opacity: 0.6;
}

.search-suggestion-all {
    justify-content: center;
    border-top: 1px solid #d5dbe2;
    color: #075095;
    font-weight: 600;
}

@media (max-width: 767px) {
    /* Без поиска в темной полосе остались только крошки, а на телефоне они скрыты: полоса пустая */
    #header-bottom {
        display: none;
    }

    /* На телефоне панель во всю ширину без заголовка: место под строкой важнее */
    .search-bar {
        padding: 0;
    }

    .search-bar-panel {
        padding: 12px 16px;
        background: linear-gradient(128deg, #075095 66%, #2b2a28 66%);
        box-shadow: none;
    }

    .search-bar-title {
        display: none;
    }

    .search-bar-form input,
    .search-bar-form button {
        height: 44px;
    }

    .search-bar-form input {
        padding: 0 14px;
        font-size: 16px;  /* Меньше 16px iOS увеличивает страницу при фокусе */
    }

    .search-bar-form button {
        padding: 0 16px;
    }
}

@media (max-width: 575px) {
    .search-bar-form button span {
        display: none;
    }
}

/* Сброс поиска на странице результатов: фильтры остаются */
.search-reset {
    margin-left: 8px;
    color: inherit;
    text-decoration: none;
    opacity: 0.7;
}

.search-reset:hover {
    opacity: 1;
}

/* Возврат из карточки товара в выборку каталога (static/js/catalog_return.js) */
.catalog-return-bar {
    max-width: 1200px;
    margin: 0 auto;
}

/* Кнопкой на белом фоне, как карточка под ней: на узорном фоне страницы простая ссылка теряется */
.catalog-return {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding: 8px 18px;
    background: white;
    color: #075095;
    font-size: 1.6rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.09), 0 1px 5px 0 rgba(0, 0, 0, 0.1);
    transition: background 0.2s, color 0.2s;
}

.catalog-return[hidden] {
    display: none;
}

.catalog-return:hover {
    background: #075095;
    color: white;
}

/* Стрелка шрифта смотрит вправо, назад нужна влево */
.catalog-return i {
    display: inline-block;
    transform: rotate(180deg);
}

@media (max-width: 1231px) {
    .catalog-return-bar {
        padding: 0 16px;
    }
}
