/* ------------------------ШАПКА (desktop ≥1181px: город → лого → каталог → поиск → избранное → сравнение → корзина → аккаунт)------------------------ */

/* Desktop-only parts are hidden by default, so the mobile header stays as it was */
.hdr-topbar,
.hdr-catalog,
.hdr-search,
.li-fav,
.hdr-iconlink__label,
.hdr-account__txt {
    display: none;
}

.hdr-caret {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

@media (min-width: 1181px) {
    /* the top strip adds 34px to the fixed header; push page content down by that
       (+6px, since several pages already sat a few px under the old 66px header) */
    body {
        padding-top: 40px;
    }

    /* the full-width banner uses 100vw, which includes the scrollbar */
    html,
    body {
        overflow-x: clip;
    }

    .hdr-topbar {
        display: block;
        background: #f5f7fb;
        border-bottom: 1px solid #ebebeb;
        font-size: 13px;
    }

    .hdr-topbar__in {
        max-width: 1600px;
        margin: 0 auto;
        padding: 0 40px;
        height: 33px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .hdr-city {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        background: none;
        border: none;
        padding: 4px 0;
        color: #1a1a2e;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
    }

    .hdr-city svg:first-child {
        width: 15px;
        height: 15px;
        color: #0641a1;
    }

    .hdr-city:hover span {
        color: #0641a1;
    }

    .hdr-topbar__links {
        display: flex;
        align-items: center;
        gap: 22px;
    }

    .hdr-topbar__links > a,
    .hdr-dd__btn {
        color: #555;
        text-decoration: none;
        font-size: 13px;
        background: none;
        border: none;
        padding: 0;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        gap: 4px;
    }

    .hdr-topbar__links > a:hover,
    .hdr-dd__btn:hover,
    .hdr-dd.open .hdr-dd__btn {
        color: #0641a1;
    }

    .hdr-topbar__phone {
        font-weight: 700;
        color: #1a1a2e !important;
    }

    .hdr-dd {
        position: relative;
    }

    .hdr-dd__menu {
        display: none;
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        min-width: 230px;
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 10px 32px rgba(0, 0, 0, 0.14);
        padding: 8px;
        z-index: 120;
    }

    .hdr-dd.open .hdr-dd__menu {
        display: block;
    }

    .hdr-dd__menu a {
        display: block;
        padding: 9px 12px;
        border-radius: 8px;
        color: #1a1a2e;
        text-decoration: none;
        font-size: 14px;
    }

    .hdr-dd__menu a:hover {
        background: #f2f5fb;
        color: #0641a1;
    }

    /* main row */
    header .navbar__top {
        gap: 20px;
        padding: 12px 40px;
        justify-content: flex-start;
    }

    .hdr-logo {
        flex-shrink: 0;
    }

    .navbar__logo {
        width: 180px;
    }

    .hdr-catalog {
        display: block;
        position: relative;
        flex-shrink: 0;
    }

    .hdr-catalog__btn {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        height: 42px;
        padding: 0 20px;
        border: none;
        border-radius: 10px;
        background: #0641a1;
        color: #fff;
        font-size: 15px;
        font-weight: 600;
        cursor: pointer;
        transition: background 0.15s;
    }

    .hdr-catalog__btn:hover,
    .hdr-catalog.open .hdr-catalog__btn {
        background: #053080;
    }

    .hdr-catalog__icon {
        position: relative;
        width: 16px;
        height: 12px;
        display: inline-block;
    }

    .hdr-catalog__icon i {
        position: absolute;
        left: 0;
        width: 16px;
        height: 2px;
        border-radius: 1px;
        background: #fff;
        transition: transform 0.2s, opacity 0.2s, top 0.2s;
    }

    .hdr-catalog__icon i:nth-child(1) { top: 0; }
    .hdr-catalog__icon i:nth-child(2) { top: 5px; }
    .hdr-catalog__icon i:nth-child(3) { top: 10px; }

    .hdr-catalog.open .hdr-catalog__icon i:nth-child(1) { top: 5px; transform: rotate(45deg); }
    .hdr-catalog.open .hdr-catalog__icon i:nth-child(2) { opacity: 0; }
    .hdr-catalog.open .hdr-catalog__icon i:nth-child(3) { top: 5px; transform: rotate(-45deg); }

    .hdr-mega {
        display: none;
        position: absolute;
        top: calc(100% + 12px);
        left: 0;
        width: min(1100px, calc(100vw - 80px));
        max-height: min(560px, calc(100vh - 160px));
        background: #fff;
        border-radius: 16px;
        box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
        overflow: hidden;
        z-index: 130;
        grid-template-columns: 300px 1fr;
    }

    .hdr-catalog.open .hdr-mega {
        display: grid;
    }

    .hdr-mega__cats {
        margin: 0;
        padding: 10px;
        list-style: none;
        background: #f7f8fb;
        overflow-y: auto;
    }

    .hdr-mega__cats a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 10px 12px;
        border-radius: 10px;
        color: #1a1a2e;
        text-decoration: none;
        font-size: 14px;
        font-weight: 500;
    }

    .hdr-mega__cats svg {
        width: 14px;
        height: 14px;
        color: #9aa3b2;
        flex-shrink: 0;
    }

    .hdr-mega__cats li.active a {
        background: #fff;
        color: #0641a1;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    }

    .hdr-mega__panes {
        overflow-y: auto;
        padding: 22px 28px;
    }

    .hdr-mega__pane {
        display: none;
    }

    .hdr-mega__pane.active {
        display: block;
    }

    .hdr-mega__title {
        display: inline-block;
        font-size: 20px;
        font-weight: 700;
        color: #1a1a2e;
        text-decoration: none;
        margin-bottom: 16px;
    }

    .hdr-mega__title:hover {
        color: #0641a1;
    }

    .hdr-mega__grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 4px 24px;
    }

    .hdr-mega__grid a {
        display: block;
        padding: 7px 0;
        color: #444;
        text-decoration: none;
        font-size: 14px;
        line-height: 1.3;
    }

    .hdr-mega__grid a:hover {
        color: #0641a1;
    }

    .hdr-search {
        display: flex;
        align-items: center;
        flex: 1;
        min-width: 180px;
        height: 42px;
        border: 2px solid #0641a1;
        border-radius: 10px;
        background: #fff;
        overflow: hidden;
    }

    .hdr-search input {
        flex: 1;
        height: 100%;
        border: none;
        outline: none;
        padding: 0 14px;
        font-size: 15px;
        background: transparent;
        min-width: 0;
    }

    .hdr-search button {
        height: 100%;
        padding: 0 14px;
        border: none;
        background: none;
        cursor: pointer;
        display: flex;
        align-items: center;
    }

    .hdr-search .search-button {
        position: static;
        width: 20px;
        height: 20px;
        margin: 0;
        transform: none;
    }

    header .navbar__top-ul {
        flex-wrap: nowrap;
        gap: 6px;
        flex-shrink: 0;
    }

    .li-search {
        display: none !important;
    }

    .li-fav {
        display: list-item;
        list-style: none;
    }

    .hdr-iconlink {
        flex-direction: column;
        gap: 2px;
        padding: 2px 8px;
        position: relative;
        text-decoration: none;
    }

    .hdr-iconlink .navbar__icon,
    .hdr-svg {
        width: 22px;
        height: 22px;
    }

    .hdr-svg {
        color: #1a1a2e;
    }

    .hdr-iconlink__label {
        display: block;
        font-size: 11px;
        color: #555;
        line-height: 1;
        white-space: nowrap;
    }

    .hdr-iconlink:hover .hdr-iconlink__label {
        color: #0641a1;
    }

    .hdr-iconlink .cart-badge {
        top: -4px;
        right: 4px;
    }

    .hdr-account {
        gap: 8px;
        padding: 4px 10px;
        border-radius: 10px;
        text-decoration: none;
        max-width: 210px;
    }

    .hdr-account:hover {
        background: #f2f5fb;
    }

    .hdr-account__txt {
        display: flex;
        flex-direction: column;
        line-height: 1.2;
        text-align: left;
        min-width: 0;
    }

    .hdr-account__txt b {
        font-size: 13px;
        font-weight: 700;
        color: #1a1a2e;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .hdr-account__txt small {
        font-size: 12px;
        color: #6b7280;
        white-space: nowrap;
    }

    /* «Нужна консультация» — floating tab on the right edge instead of the bottom category bar */
    .navbar__bottom {
        left: auto;
        right: 0;
        bottom: auto;
        top: calc(50% - 90px);
        display: block;
    }

    .navbar__bottom-ul {
        padding: 0;
        gap: 0;
        background: none;
        box-shadow: none;
        border-radius: 0;
    }

    .navbar__bottom-ul .btn__modal {
        display: block;
        writing-mode: vertical-rl;
        transform: rotate(180deg);
        padding: 18px 11px;
        border-radius: 0 12px 12px 0;
        font-size: 13px;
        letter-spacing: 0.04em;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
        color: #1a1a2e;
    }

    .navbar__bottom .call-button {
        position: fixed;
        right: 40px;
        bottom: 40px;
        width: 70px;
    }
}

@media (min-width: 1181px) and (max-width: 1360px) {
    header .navbar__top { gap: 14px; padding: 12px 24px; }
    .hdr-topbar__in { padding: 0 24px; }
    .navbar__logo { width: 150px; }
    .hdr-catalog__btn { padding: 0 14px; }
    .hdr-iconlink { padding: 2px 5px; }
    .hdr-account { max-width: 160px; }
    .li-currency { display: none !important; }
}

/* ------------------------Выбор города------------------------ */
.city-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, visibility 0.2s;
}

.city-modal.open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.city-modal__box {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 20px;
    padding: 28px 26px 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.city-modal__close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #9ca3af;
    cursor: pointer;
}

.city-modal__title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 6px;
}

.city-modal__sub {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 18px;
    line-height: 1.45;
}

.city-modal__group {
    margin-bottom: 14px;
}

.city-modal__group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.city-modal__group label span {
    color: #ef4444;
}

.city-modal__input {
    width: 100%;
    height: 46px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    padding: 0 12px;
    font-size: 15px;
    color: #1a1a2e;
    background: #fff;
    box-sizing: border-box;
}

.city-modal__input:focus {
    border-color: #0641a1;
    outline: none;
}

.city-modal__btn {
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 12px;
    background: #0641a1;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
}

.city-modal__btn:hover {
    background: #053080;
}

.city-modal__error {
    background: #fff0f0;
    border: 1px solid #fca5a5;
    color: #dc2626;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 13px;
    margin-bottom: 14px;
}
