/* .x-header {
    position: relative;
    z-index: 50;
} */

.x-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 50;
    background-color: #fff;
}

.x-topbar {
    background: #f8f9fd;
    font-size: 13px;
    color: #3b4452;
    transition:
        max-height 0.3s ease,
        padding 0.3s ease,
        opacity 0.3s ease;
    max-height: 60px; /* подберите под реальную высоту вашей панели */
    overflow: hidden;
}
.x-topbar__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 38px;
}
.x-topbar__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.x-topbar__right {
    display: flex;
    gap: 18px;
    align-items: center;
}
.x-topbar__phone:hover {
    opacity: 0.75;
}

.x-mainbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.x-mainbar__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 74px;
}

.x-brand {
    display: flex;
    align-items: center;
    min-width: 160px;
}
.x-brand__link {
    display: flex;
    align-items: center;
    gap: 10px;
}
.x-brand__text {
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--green);
    font-size: 20px;
    text-transform: uppercase;
}
.custom-logo {
    max-height: 30px;
    width: auto;
}

.x-nav {
    flex: 1;
}
.x-nav__list {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.x-nav__list > li {
    position: relative;
}
.x-nav__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 24px;
    font-size: 13px;
    color: #202531;
    transition: 0.15s ease;
    width: max-content;
}
.x-nav__link:hover {
    background: var(--soft);
}
.x-nav__list > li.menu-item-has-children > a::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid #9aa4b2;
    border-bottom: 2px solid #9aa4b2;
    transform: rotate(45deg);
    margin-left: 6px;
    margin-top: -2px;
}
.x-nav__list li ul {
    position: absolute;
    top: 110%;
    left: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow2);
    border-radius: 14px;
    padding: 8px;
    list-style: none;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: 0.15s ease;
    z-index: 30;
}
.x-nav__list li:hover > ul {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.x-nav__list li ul li a {
    display: block;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
}
.x-nav__list li ul li a:hover {
    background: var(--soft);
}

/* ===== Мобильное меню ===== */
body.x-menu-open {
    overflow: hidden;
}
.x-burger {
    display: none; /* по умолчанию скрыта на десктопе */
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 16px;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    margin-left: 8px;
}

.x-burger__line {
    display: block;
    width: 100%;
    height: 2px;
    background: #000;
    transition:
        transform 0.3s ease,
        opacity 0.3s ease;
}

.x-burger.is-active .x-burger__line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.x-burger.is-active .x-burger__line:nth-child(2) {
    opacity: 0;
}
.x-burger.is-active .x-burger__line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.x-mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #fff;
    padding: 80px 24px 24px;
    overflow-y: auto;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.35s ease;
}

.x-mobile-menu.is-open {
    transform: translateX(0);
    display: block;
}

.x-mobile-nav__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.x-mobile-nav__list li {
    border-bottom: 1px solid #eee;
}

.x-mobile-nav__list a {
    display: block;
    padding: 14px 0;
    font-size: 18px;
    font-weight: 500;
    color: #000;
    text-decoration: none;
}

/* Кнопка закрытия меню */
.x-mobile-menu__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #000;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.x-mobile-menu__close:hover {
    opacity: 0.7;
}

/* Убедимся, что у меню есть relative/absolute позиционирование */
.x-mobile-menu {
    position: fixed;
    /* остальные стили уже есть */
}

/* Показываем бургер и скрываем десктопное меню на мобильных */
@media (max-width: 1024px) {
    /* или ваш брейкпоинт */
    .x-nav,
    .x-mobile-nav__list .sub-menu {
        display: none;
    }
    /* Когда у родителя добавлен класс .submenu-open, показываем его подменю */
    .x-mobile-nav__list .menu-item-has-children.submenu-open > .sub-menu {
        display: block;
    }
    .x-burger {
        display: flex;
    }
    .x-mobile-menu {
        display: block; /* чтобы анимация работала */
    }
}

@media (min-width: 1025px) {
    .x-mobile-menu {
        display: none !important;
    }
}

.x-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
    justify-content: flex-end;
}
.x-iconbtn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.15s ease;
    position: relative;
    border: none;
}
.x-iconbtn:hover {
    background: var(--soft);
    transform: translateY(-1px);
}
.x-iconbtn svg {
    color: #111827;
}

.x-badge-count {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    padding: 0;
    border-radius: 8px;
    background: var(--green);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.x-account {
    position: relative;
}
.x-pop {
    position: absolute;
    top: 52px;
    right: 0;
    width: 320px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: 0.15s ease;
}
.x-account.is-open .x-pop {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.x-pop__row {
    display: flex;
    gap: 10px;
}
.x-pop__btn {
    flex: 1;
    height: 44px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 14px;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.x-pop__btn--black {
    background: #111827;
    color: #fff;
}
.x-pop__btn--ghost {
    background: #eef2f7;
    color: #111827;
    border-color: #d7dee8;
}

.x-search {
    display: none;
    padding: 0 0 16px 0;
}
.x-search.is-open {
    display: block;
}
.x-search__form {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}
.x-search__input {
    width: min(520px, 100%);
    height: 44px;
    border-radius: 14px;
    border: 1px solid var(--line);
    padding: 0 14px;
    font-size: 14px;
    outline: none;
    background: #fff;
}
.x-search__btn {
    height: 44px;
    border-radius: 14px;
    border: 0;
    padding: 0 16px;
    background: #111827;
    color: #fff;
    cursor: pointer;
}

@media (max-width: 1024px) {
    .x-nav {
        display: none;
    }
}

@media (max-width: 768px) {
    .x-topbar--hidden {
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        opacity: 0;
    }

    /* Основная панель прилипает к верху */
    .x-mainbar {
        position: sticky;
        top: 0;
        z-index: 50;
        background: #fff; /* ваш фон */
        transition: margin-top 0.3s ease;
    }

    .x-brand {
        min-width: 160px;
        width: auto;
    }
    .x-topbar__row {
        display: block;
        text-align: center;
        padding: 6px 0;
        height: auto;
    }

    .x-topbar__left {
        margin: 4px auto;
    }

    .x-topbar__right {
        display: block;
    }

    .x-topbar__right a + a {
        margin-left: 12px;
    }
}

@media (max-width: 640px) {
    .x-brand {
        min-width: 160px;
        width: 160px;
    }
}

@media (max-width: 420px) {
    .x-brand {
        min-width: 120px;
        width: 120px;
    }
}
