/*
 * Шапка сайта.
 *
 * Отдельный файл, префикс hd-: старые правила шапки в style.css
 * (.top-row, .main-nav, .nav-item, .catalog-btn) больше ни к чему
 * не привязаны и на новую разметку не действуют.
 */

/* Липкой делаем всю шапку, а не строку внутри неё: sticky внутри
   короткого <header> уезжает вместе с ним. Отрицательный top прячет
   верхнюю полосу и оставляет на экране основную строку. */
.hd {
    position: sticky;
    top: -38px;
    z-index: 50;

    --hd-ink: #14132B;
    --hd-muted: #77768F;
    --hd-line: #EAEAF3;
    --hd-soft: #F6F6FB;
    --hd-brand: #4F4BFF;
    --hd-brand-light: #6C69FF;
    --hd-accent: #FF5C7A;

    font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--hd-ink);
}

.hd *,
.hd *::before,
.hd *::after {
    box-sizing: border-box;
}

.hd a {
    text-decoration: none;
    color: inherit;
}

.hd button {
    font-family: inherit;
    cursor: pointer;
}

.hd :focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 75, 255, .35);
    border-radius: 10px;
}

/* ── Верхняя полоса ───────────────────────────────────────────────── */

.hd__top {
    background: linear-gradient(90deg, #14132B 0%, #1D1B44 55%, #241C46 100%);
    color: rgba(255, 255, 255, .62);
    font-size: 12.5px;
}

.hd__top-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 38px;
}

.hd__city {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px;
    background: rgba(255, 255, 255, .07);
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    transition: background .2s ease, border-color .2s ease;
}

.hd__city:hover {
    background: rgba(255, 255, 255, .16);
    border-color: rgba(255, 255, 255, .3);
}

.hd__city svg {
    flex: 0 0 auto;
}

.hd__city-caret {
    opacity: .6;
}

.hd__promise {
    display: none;
    align-items: center;
    gap: 8px;
}

.hd__dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--hd-accent);
}

.hd__age {
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, .2);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    color: rgba(255, 255, 255, .75);
}

.hd__account {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding: 5px 4px;
    color: rgba(255, 255, 255, .72);
    font-size: 12.5px;
    font-weight: 500;
    background: none;
    border: 0;
    transition: color .2s ease;
}

.hd__account:hover {
    color: #fff;
}

/* ── Основная строка ──────────────────────────────────────────────── */

.hd__bar {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--hd-line);
    transition: box-shadow .25s ease, background .25s ease;
}

.hd__bar.is-stuck {
    box-shadow: 0 14px 30px -24px rgba(20, 19, 43, .8);
}

.hd__bar-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 72px;
}

.hd__logo {
    flex: 0 0 auto;
    display: block;
    line-height: 0;
}

.hd__logo img {
    width: 159px;
    height: 39px;
}

/* Каталог */

.hd__catalog {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 46px;
    padding: 0 20px;
    border: 0;
    border-radius: 14px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .02em;
    background: linear-gradient(135deg, #6C69FF 0%, #4F4BFF 100%);
    box-shadow: 0 14px 28px -14px rgba(79, 75, 255, .95);
    transition: transform .18s ease, box-shadow .18s ease;
}

.hd__catalog:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 18px 34px -14px rgba(79, 75, 255, 1);
}

.hd__catalog:active {
    transform: scale(.98);
}

.hd__burger,
.hd__icon {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border: 1px solid var(--hd-line);
    border-radius: 13px;
    background: #fff;
    color: var(--hd-ink);
    transition: border-color .2s ease, color .2s ease, background .2s ease;
}

.hd__burger:hover,
.hd__icon:hover {
    border-color: #C9C7FF;
    color: var(--hd-brand);
}

.hd__burger {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #6C69FF 0%, #4F4BFF 100%);
    box-shadow: 0 12px 24px -14px rgba(79, 75, 255, .95);
}

.hd__burger:hover {
    color: #fff;
}

/* Точка подсказывает, что фильтр уже применён. */
.hd__icon.is-on {
    position: relative;
    color: var(--hd-brand);
    border-color: #C9C7FF;
}

.hd__icon.is-on::after {
    content: '';
    position: absolute;
    top: 7px;
    right: 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--hd-accent);
    box-shadow: 0 0 0 2px #fff;
}

/* Поиск */

.hd__search {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 420px;
    display: flex;
    align-items: center;
}

.hd__search-icon {
    position: absolute;
    left: 16px;
    color: #9C9BB4;
    pointer-events: none;
}

.hd__search input {
    width: 100%;
    height: 46px;
    padding: 0 96px 0 44px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: var(--hd-soft);
    font-family: inherit;
    font-size: 14px;
    color: var(--hd-ink);
    transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.hd__search input::placeholder {
    color: #9C9BB4;
}

.hd__search input:focus {
    outline: none;
    background: #fff;
    border-color: var(--hd-brand-light);
    box-shadow: 0 0 0 3px rgba(79, 75, 255, .14);
}

.hd__search button {
    position: absolute;
    right: 6px;
    height: 34px;
    padding: 0 16px;
    border: 0;
    border-radius: 10px;
    background: var(--hd-ink);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    transition: background .2s ease;
}

.hd__search button:hover {
    background: var(--hd-brand);
}

/* Навигация */

.hd__nav {
    display: flex;
    align-items: center;
    gap: 26px;
    margin-left: auto;
}

.hd__nav-item {
    position: relative;
    padding: 6px 0;
    font-size: 14px;
    font-weight: 500;
    color: #3D3C5C;
    white-space: nowrap;
    transition: color .2s ease;
}

.hd__nav-item::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--hd-brand-light), var(--hd-accent));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .22s ease;
}

.hd__nav-item:hover {
    color: var(--hd-ink);
}

.hd__nav-item:hover::after {
    transform: scaleX(1);
}

.hd__nav-item.is-active {
    color: var(--hd-brand);
    font-weight: 600;
}

.hd__nav-item.is-active::after {
    transform: scaleX(1);
}

/* Строка поиска на телефоне */

.hd__search-row {
    display: none;
    padding: 0 0 14px;
}

.hd__search-row.is-open {
    display: block;
    animation: hd-drop .22s ease;
}

@keyframes hd-drop {
    from { opacity: 0; transform: translateY(-6px) }
    to { opacity: 1; transform: none }
}

.hd__search-row .hd__search {
    max-width: none;
}

/* ── Окно выбора города ───────────────────────────────────────────── */

#cityModal .modal-content {
    border: 0;
    border-radius: 22px;
    padding: 26px;
    box-shadow: 0 40px 80px -40px rgba(20, 19, 43, .6);
}

#cityModal #cityModalLabel {
    font-family: 'Montserrat', sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: #14132B;
    text-align: left;
    margin: 0 0 16px;
}

#cityModal .city-search {
    height: 46px;
    border-radius: 14px;
    border: 1px solid #EAEAF3;
    background: #F6F6FB;
    padding: 0 16px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
}

#cityModal .city-search:focus {
    background: #fff;
    border-color: #6C69FF;
    box-shadow: 0 0 0 3px rgba(79, 75, 255, .14);
}

#cityModal .city-list {
    column-count: 2;
    column-gap: 18px;
    padding: 0;
    margin: 0;
    list-style: none;
    font-family: 'Montserrat', sans-serif;
}

#cityModal .city-list li {
    break-inside: avoid;
    padding: 7px 0;
}

#cityModal .city-list a {
    font-size: 14px;
    color: #3D3C5C;
    text-decoration: none;
    transition: color .18s ease;
}

#cityModal .city-list a:hover {
    color: #4F4BFF;
}

/* ── Боковые панели над прилипшей шапкой ──────────────────────────── */

.side-panel {
    z-index: 60;
}

.header-overlay {
    z-index: 55;
    background-color: rgba(20, 19, 43, .45);
    backdrop-filter: blur(2px);
}

.filter-wrap {
    z-index: 60;
}

/* Немного воздуха под прилипшей шапкой: раньше заголовок страницы
   упирался прямо в её нижнюю границу. */
main.container {
    padding-top: 14px;
}

/* ── Экраны ───────────────────────────────────────────────────────── */

@media (min-width: 992px) {
    .hd__promise {
        display: inline-flex;
    }
}

@media (max-width: 1199px) {
    .hd__nav {
        gap: 18px;
    }

    .hd__catalog span {
        display: none;
    }

    .hd__catalog {
        padding: 0 14px;
    }
}

@media (max-width: 991px) {
    .hd__bar-inner {
        min-height: 62px;
        gap: 10px;
    }

    .hd__burger,
    .hd__icon {
        display: inline-flex;
    }

    .hd__catalog,
    .hd__nav,
    .hd__bar-inner .hd__search {
        display: none;
    }

    .hd__logo img {
        width: 132px;
        height: 32px;
    }

    .hd__actions {
        margin-left: auto;
        display: flex;
        gap: 8px;
    }

    .hd__promise,
    .hd__account span {
        display: none;
    }
}

@media (max-width: 575px) {
    .hd {
        top: -34px;
    }

    .hd__top-inner {
        min-height: 34px;
        gap: 10px;
    }

    .hd__city {
        max-width: 60vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #cityModal .modal-content {
        padding: 20px;
        border-radius: 18px;
    }

    #cityModal .city-list {
        column-count: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hd * {
        transition: none !important;
        animation: none !important;
    }
}
