/* Живой поиск в шапке (reboot-child / inc/live-search.php + assets/live-search.js) */

.hs {
    position: relative;
    flex: 0 1 460px !important;
    min-width: 220px;
    margin: 0 auto 0 12px !important;
    font-family: 'Inter', sans-serif;
}
.hs-open.header-search { display: none !important; border: 0; background: none; padding: 0; }

/* поле */
.hs__form {
    position: relative;
    display: flex;
    align-items: center;
    margin: 0;
}
.hs__ico {
    position: absolute;
    left: 13px;
    top: 50%;
    margin-top: -9px;
    color: #8a8f98;
    pointer-events: none;
    transition: color .15s ease;
}
.site-header .hs__input,
.hs__input {
    box-sizing: border-box;
    width: 100% !important;
    height: 40px !important;
    margin: 0 !important;
    padding: 0 114px 0 40px !important;
    border: 1.5px solid transparent !important;
    border-radius: 12px !important;
    font: 400 15px/40px 'Inter', sans-serif !important;
    color: #111 !important;
    background: #f0f2f5 !important;
    box-shadow: none !important;
    outline: none !important;
    -webkit-appearance: none;
    appearance: none;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease !important;
}
.hs__input::placeholder { color: #8a8f98; opacity: 1; }
.hs__input::-webkit-search-cancel-button,
.hs__input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.hs__input:hover { background: #e9ecf0 !important; }
.hs.is-focus .hs__input,
.hs.is-active .hs__input {
    background: #fff !important;
    border-color: #2d81e0 !important;
    box-shadow: 0 0 0 4px rgba(45, 129, 224, .12) !important;
}
.hs.is-focus .hs__ico, .hs.is-active .hs__ico { color: #2d81e0; }

.hs__kbd { display: none !important; }

/* Красивая кнопка «Найти» */
.hs__submit {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    height: 32px;
    padding: 0 16px;
    border: none;
    border-radius: 9px;
    background: #2d81e0;
    background: linear-gradient(135deg, #2d81e0 0%, #1a6ecf 100%);
    color: #ffffff !important;
    font: 600 13.5px/32px 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
    letter-spacing: -0.01em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(45, 129, 224, 0.28);
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    -webkit-user-select: none;
    z-index: 3;
}
.hs__submit:hover {
    background: linear-gradient(135deg, #378ef0 0%, #2076dc 100%);
    box-shadow: 0 4px 12px rgba(45, 129, 224, 0.4);
    transform: translateY(-50%) scale(1.02);
}
.hs__submit:active {
    transform: translateY(-50%) scale(0.97);
    box-shadow: 0 1px 3px rgba(45, 129, 224, 0.2);
}
.hs.is-focus .hs__submit {
    box-shadow: 0 2px 8px rgba(45, 129, 224, 0.36);
}

.hs__clear {
    position: absolute;
    right: 84px;
    top: 50%;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin-top: -12px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #6b7280;
    background: #e5e7eb;
    cursor: pointer;
    z-index: 3;
    transition: background-color .15s ease, color .15s ease;
}
.hs__clear[hidden] { display: none; }
.hs__clear:hover { color: #111; background: #d9dce1; }
.hs__spin {
    position: absolute;
    right: 86px;
    top: 50%;
    display: none;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid #d6e4f6;
    border-top-color: #2d81e0;
    border-radius: 50%;
    animation: hs-spin .7s linear infinite;
    z-index: 3;
}
.hs.is-loading .hs__spin { display: block; }
.hs__back { display: none; }

/* выпадающий список */
.hs__drop {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 1000;
    box-sizing: border-box;
    width: max(100%, 520px);
    max-height: min(72vh, 600px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px;
    border: 1px solid #eceef2;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 20px 48px rgba(17, 24, 39, .16), 0 2px 6px rgba(17, 24, 39, .05);
    animation: hs-in .16s ease;
}
.hs__drop[hidden] { display: none; }

/* Переключатель города в выпадающем окне поиска */
.hs-city-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid #f0f2f5;
    min-width: 0;
}
.hs-city-bar__label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #9ca3af;
    user-select: none;
    padding-left: 2px;
    flex-shrink: 0;
}
.hs-city-tabs {
    display: flex;
    align-items: center;
    background: #f0f2f5;
    padding: 3px;
    border-radius: 10px;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-width: 0;
}
.hs-city-tabs::-webkit-scrollbar { display: none; }
.hs-city-tab {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border: 0;
    border-radius: 7px;
    font: 600 12px/1.2 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #64748b;
    background: transparent;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
    white-space: nowrap;
    user-select: none;
    flex-shrink: 0;
}
.hs-city-tab:hover {
    color: #1e293b;
}
.hs-city-tab.is-active {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .04);
}
.hs-city-tab__icon {
    font-size: 11.5px;
    line-height: 1;
}
.hs__results {
    min-height: 40px;
}

.hs-sec {
    padding: 10px 10px 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #9ca3af;
}
.hs-fixed { margin: 2px 4px 6px; padding: 8px 10px; border-radius: 10px; font-size: 13.5px; color: #4b5563; background: #fff8e6; }

a.hs-opt {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 12px;
    color: #111 !important;
    text-decoration: none !important;
    transition: background-color .12s ease;
}
a.hs-opt:hover, a.hs-opt.is-active { background: #f3f7fd; }

.hs-item__img {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    background: #f0f2f5;
}
.hs-item__img--e { display: grid; place-items: center; font-size: 24px; }
.hs-item__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hs-item__t {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.32;
}
.hs-opt mark { padding: 0 1px; border-radius: 3px; color: inherit; background: #fff1b8; }
.hs-item__m { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; color: #6b7280; white-space: nowrap; }
.hs-item__rb { flex: 0 0 auto; font-weight: 600; }
.hs-item__dot { color: #c4c8ce; }
.hs-item__meta { overflow: hidden; text-overflow: ellipsis; }
.hs-item__city {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    line-height: 14px;
    padding: 1px 6px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.hs-item__city-ico {
    font-style: normal;
    font-size: 10.5px;
    line-height: 1;
}

.hs-rub__ico { display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px; font-size: 20px; }
.hs-rub__name { flex: 1 1 auto; font-size: 15px; font-weight: 600; }
.hs-rub__go { font-size: 13px; font-weight: 600; color: #2d81e0; opacity: 0; transition: opacity .12s ease; }
a.hs-rub:hover .hs-rub__go, a.hs-rub.is-active .hs-rub__go { opacity: 1; }

a.hs-all {
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
    padding: 12px 10px;
    border-top: 1px solid #f0f2f5;
    border-radius: 0 0 10px 10px;
    font-size: 14.5px;
    font-weight: 600;
    color: #2d81e0 !important;
}
a.hs-all b { padding: 2px 8px; border-radius: 20px; font-size: 12.5px; color: #2d81e0; background: #e8f1fd; }

.hs-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 16px 12px; text-align: center; font-size: 14px; color: #6b7280; }
.hs-empty b { font-size: 15px; color: #111; }
.hs-empty__ico { font-size: 28px; margin-bottom: 4px; }
.hs-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 10px 10px; }
.hs-chips--pad { justify-content: center; padding-bottom: 14px; }
.hs-chip {
    padding: 8px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font: 500 14px/1.2 'Inter', sans-serif;
    color: #1f2937;
    background: #fff;
    cursor: pointer;
    transition: border-color .12s ease, background-color .12s ease, color .12s ease;
}
.hs-chip:hover { border-color: #c7dbf5; color: #2d81e0; background: #f3f8ff; }

/* скелетон загрузки */
.hs-skel { display: flex; align-items: center; gap: 12px; padding: 8px 10px; }
.hs-skel__img { flex: 0 0 auto; width: 56px; height: 56px; border-radius: 10px; }
.hs-skel__lines { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; }
.hs-skel__lines i { display: block; height: 12px; border-radius: 6px; }
.hs-skel__lines i:first-child { width: 80%; }
.hs-skel__lines i:last-child { width: 45%; }
.hs-skel__img, .hs-skel__lines i {
    background: linear-gradient(90deg, #f0f2f5 0%, #f7f8fa 50%, #f0f2f5 100%);
    background-size: 200% 100%;
    animation: hs-shimmer 1.1s linear infinite;
}

@keyframes hs-spin { to { transform: rotate(360deg); } }
@keyframes hs-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes hs-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (max-width: 1180px) {
    .hs { flex-basis: 360px !important; }
}

/* ---------- телефоны и планшеты: лупа → поиск на весь экран ---------- */
@media (max-width: 899px) {
    .hs { display: none; }
    .hs-open.header-search { display: flex !important; }

    body > .hs.is-open,
    .hs.is-open {
        position: fixed;
        inset: 0;
        z-index: 100050;
        display: flex;
        flex-direction: column;
        min-width: 0;
        margin: 0 !important;
        padding: 10px 12px 0;
        background: #fff;
        animation: hs-in .16s ease;
    }
    .hs.is-open .hs__form { gap: 6px; }
    .hs.is-open .hs__back {
        display: grid;
        place-items: center;
        flex: 0 0 auto;
        width: 40px;
        height: 44px;
        padding: 0;
        border: 0;
        color: #111;
        background: none;
        cursor: pointer;
    }
    .hs.is-open .hs__ico { left: 59px; }
    .hs.is-open .hs__input { height: 44px !important; font-size: 16px !important; line-height: 44px !important; }
    .hs.is-open .hs__submit {
        height: 36px;
        right: 4px;
        padding: 0 15px;
        font-size: 13.5px !important;
        line-height: 36px !important;
    }
    .hs.is-open .hs__clear { right: 86px; }
    .hs.is-open .hs__spin { right: 88px; }
    .hs.is-open .hs__kbd { display: none; }
    .hs.is-open .hs__drop {
        position: static;
        flex: 1 1 auto;
        width: auto;
        max-height: none;
        margin: 8px -12px 0;
        padding: 4px 8px 24px;
        border: 0;
        border-top: 1px solid #f0f2f5;
        border-radius: 0;
        box-shadow: none;
        animation: none;
    }
    .hs.is-open .hs__drop[hidden] { display: block; visibility: hidden; }
    html.hs-lock, html.hs-lock body { overflow: hidden !important; }
    .hs-rub__go { opacity: 1; }

    .hs-city-bar {
        padding: 6px 4px 10px;
        margin-bottom: 6px;
    }
    .hs-city-bar__label {
        display: none;
    }
    .hs-city-tabs {
        width: 100%;
        display: flex;
        padding: 4px;
        border-radius: 12px;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        gap: 3px;
    }
    .hs-city-tabs::-webkit-scrollbar { display: none; }
    .hs-city-tab {
        flex: 0 0 auto;
        justify-content: center;
        padding: 6px 11px;
        font-size: 13px;
        border-radius: 8px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .hs__drop, .hs.is-open { animation: none; }
    .hs-skel__img, .hs-skel__lines i { animation: none; }
}
