/*
 * 1zeh_v2 header
 * Header-only styles. Dropdown menu follows old 1zeh.ru Template3 UX:
 * top-level click-open, nested click-open, WordPress-managed hierarchy.
 *
 * + Filial selector (desktop + mobile)
 */

/* ═══════════════════════════════════════
   1. Header shell
   ═══════════════════════════════════════ */

.xs_header_main {
    position: relative;
    z-index: 1000;
    font-family: var(--xs-font-family-primary);
}

.header_logo {
    width: 147px;
    height: 55px;
    object-fit: contain;
}

.xs_header__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    margin-top: 15px;
}

.xs_header__topleft {
    display: flex;
    align-items: flex-end;
    gap: 20px;
}

.xs_header__topright___messegers {
    display: flex;
    gap: 10px;
}

.xs_header__topright {
    display: flex;
    gap: 60px;
    justify-content: space-between;
    align-items: center;
}

.xs_header__topright___messegers img {
    width: 42px;
    height: 46px;
    object-fit: contain;
}

.xs_max {
    display: flex;
    gap: 10px;
    align-items: center;
    position: relative;
    top: -2px;
}

.xs_max span {
    font-size: 18px;
    color: #2C3137;
    line-height: 21px;
}

.xs_max b {
    font-size: 18px;
    color: #2C3137;
    line-height: 21px;
    font-weight: var(--xs-font-weight-semibold);
}

.xs_header__topright___emailphone {
    display: flex;
    flex-direction: column;
}

.xs_header__topright___emailphone > a {
    font-size: 18px;
    color: #2C3137;
    line-height: 21px;
    text-decoration: none;
}

/* ═══════════════════════════════════════
   2. Filial selector — Desktop
   ═══════════════════════════════════════ */

.xs_filial-select--desktop {
    /* position: relative; */
    z-index: 100;
}

.xs_filial-select--desktop .xs_filial-select__trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid var(--akcent_color, #c8352f);
    cursor: pointer;
    font-size: 20px;
    color: #052230;
    line-height: 1.25;
    margin-bottom: 8px;
    user-select: none;
    transition: color .2s ease;
}

.xs_filial-select--desktop .xs_filial-select__trigger:hover,
.xs_filial-select--desktop .xs_filial-select__trigger.is-active {
    color: var(--akcent_color, #c8352f);
}

.xs_filial-select--desktop .xs_filial-select__arrow {
    transition: transform .2s ease;
    color: var(--akcent_color, #c8352f);
}

.xs_filial-select--desktop .xs_filial-select__trigger.is-active .xs_filial-select__arrow {
    transform: rotate(180deg);
}

/* Dropdown panels — shared */
.xs_filial-select__list {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 1145px;
    height: auto;
    max-height: 290px;
    display: none;
    flex-direction: column;
    flex-wrap: wrap;
    gap: 0;
    padding: 44px 15px 15px;
    background: #fff;
    border-radius: 7px;
    box-shadow: 0 8px 30px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
    z-index: 99999;
    list-style: none;
    margin: 0;
}

.xs_filial-select__list.is-visible {
    display: flex;
}

/* Red banner — uses container-relative positioning */
.xs_filial-select__list::before {
    content: "Свои производства. Без посредников";
    position: absolute;
    top: 0;
    left: 0;
    background-color: var(--akcent_color, #c8352f);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    padding: 7px 21px;
    border-top-left-radius: 7px;
    border-bottom-right-radius: 7px;
    white-space: nowrap;
    z-index: 1;
}

/* Items */
.xs_filial-select__list li {
    list-style: none;
    width: auto;
}

.xs_filial-select__list li a {
    display: block;
    padding: 5px 0;
    font-size: 16px;
    line-height: 1.4;
    color: #111;
    text-decoration: none;
    transition: color .2s ease;
    white-space: nowrap;
}

.xs_filial-select__list li a:hover {
    color: var(--akcent_color, #c8352f);
}

.xs_filial-select__list li a.active {
    color: var(--akcent_color, #c8352f);
    font-weight: var(--xs-font-weight-regular);
}

/* «На картах» link inside dropdown */
.xs_filial-select__map-link {
    position: absolute;
    bottom: 22px;
    right: 18px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #fff;
    padding: 4px 10px 4px 7px;
    color: rgba(83, 146, 255, 1) !important;
    font-size: 13px !important;
    line-height: 13px !important;
    text-decoration: underline !important;
    text-underline-offset: 2px;
    cursor: pointer;
    z-index: 10;
    white-space: nowrap;
    transition: box-shadow 0.2s, transform 0.15s;
}

/* ═══════════════════════════════════════
   3. Filial selector — Mobile
   ═══════════════════════════════════════ */

.xs_filial-select--mobile {
    display: none;
    padding: 0 20px;
    margin-top: 30px;
}

.xs_filial-select--mobile .xs_filial-select__current {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: auto;
}

.xs_filial-select--mobile .xs_filial-select__current svg {
    flex-shrink: 0;
}

.xs_filial-select--mobile .xs_filial-select__current-label {
    font-size: 14px;
    line-height: 14px;
    color: #687479;
    font-weight: var(--xs-font-weight-regular);
}

.xs_filial-select--mobile .xs_filial-select__current-label strong {
    color: #052230;
    font-weight: 800;
}

.xs_filial-select--mobile .xs_filial-select__current-label strong.active {
    color: var(--akcent_color, #c8352f);
}

.xs_filial-select--mobile .xs_filial-select__toggle {
    font-size: 11px;
    line-height: 9px;
    color: #052230;
    font-weight: var(--xs-font-weight-regular);
    padding: 8px 13px;
    border: 1px solid #052230;
    border-radius: 2px;
    background: #fff;
    cursor: pointer;
    min-width: 107px;
    text-align: center;
    transition: background-color .2s ease, color .2s ease;
    white-space: nowrap;
}

.xs_filial-select--mobile .xs_filial-select__toggle:hover {
    background: #052230;
    color: #fff;
}

.xs_filial-select--mobile .xs_filial-select__moblist {
    display: none;
    list-style: none;
    margin: 15px 0 0;
    padding: 0;
}

.xs_filial-select--mobile .xs_filial-select__moblist.is-visible {
    display: block;
}

.xs_filial-select--mobile .xs_filial-select__moblist li a {
    display: block;
    padding: 8px 0;
    font-size: 16px;
    color: rgba(5, 34, 48, .61);
    text-decoration: none;
    text-align: right;
    transition: color .2s ease;
}

.xs_filial-select--mobile .xs_filial-select__moblist li a:hover,
.xs_filial-select--mobile .xs_filial-select__moblist li a.active {
    color: var(--akcent_color, #c8352f);
}

/* ═══════════════════════════════════════
   4. Dropdown navigation menu
   ═══════════════════════════════════════ */

.xs_header__bottom {
    margin-top: 25px;
    position: relative;
    z-index: 50;
}

.xs_header__bottom .header_menu,
.xs_header__bottom .header_menu .sub-menu {
    list-style: none;
    margin: 0;
}

.xs_header__bottom .header_menu {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(18px, 2.3vw, 40px);
    padding: 0;
}

.xs_header__bottom .header_menu li {
    position: relative;
    margin: 0;
    padding: 0;
}

.xs_header__bottom .header_menu > li {
    flex: 0 0 auto;
}

.xs_header__bottom .header-menu-link {
    font-family: var(--xs-font-family-primary);
    font-weight: var(--xs-font-weight-regular);
    font-size: 18px;
    line-height: 1.25;
    color: #111111;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    position: relative;
    overflow: visible;
    transition: color .22s ease, transform .22s ease;
    -webkit-tap-highlight-color: transparent;
}

.xs_header__bottom .header_menu > li > .header-menu-link {
    min-height: 36px;
}

/* Top-level underline — only leaf items */
.xs_header__bottom .header_menu > li:not(.menu-item-has-children) > .header-menu-link::before {
    content: "";
    display: block;
    width: 100%;
    height: 1px;
    position: absolute;
    left: 0;
    bottom: 0;
    background-color: var(--akcent_color, #c8352f);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform .24s ease;
}

.xs_header__bottom .header_menu > li.current-menu-item:not(.menu-item-has-children) > .header-menu-link::before {
    content: "";
    display: block;
    width: 100%;
    height: 1px;
    position: absolute;
    left: 0;
    bottom: 0;
    background-color: var(--akcent_color, #c8352f);
    transform: scaleX(1);
    transform-origin: left center;
    transition: transform .24s ease;
}







.xs_header__bottom .header_menu > li:not(.menu-item-has-children):hover > .header-menu-link::before,
.xs_header__bottom .header_menu > li:not(.menu-item-has-children).is-open > .header-menu-link::before {
    transform: scaleX(1);
}

/* .xs_header__bottom .header_menu > li:hover > .header-menu-link,
.xs_header__bottom .header_menu > li.is-open > .header-menu-link {
    color: #ba0700;
} */

/* FontAwesome arrows for parent items */
.xs_header__bottom .header_menu > li.menu-item-has-children > .header-menu-link {
    cursor: pointer;
}

.xs_header__bottom .header_menu > li.menu-item-has-children > .header-menu-link::after {
    content: "\f107";
    font: normal normal normal 16px/1 FontAwesome;
    color: var(--akcent_color, #c8352f);
    position: absolute;
    right: 50%;
    top: auto;
    bottom: -7px;
    transform: translateX(50%);
    transition: transform .22s ease, color .22s ease;
}





.xs_header__bottom .header_menu > li.menu-item-has-children.is-open > .header-menu-link::after {
    transform: translateX(50%) rotate(180deg);
    color: var(--akcent_color, #c8352f);
}

/* Submenu panels */
.xs_header__bottom .header_menu .sub-menu {
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    width: fit-content;
    min-width: 180px;
    max-width: min(90vw, 420px);
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, .08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .04);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
    z-index: 9999;
}

/* Arrow triangle */
.xs_header__bottom .header_menu > li > .sub-menu::before {
    content: "";
    position: absolute;
    left: 22px;
    top: -5px;
    width: 10px;
    height: 10px;
    background: #ffffff;
    border: inherit;
    border-width: 1px 0 0 1px;
    transform: rotate(45deg);
}

.xs_header__bottom .header_menu > li:nth-last-child(-n+2) > .sub-menu {
    left: auto;
    right: 0;
}

.xs_header__bottom .header_menu > li:nth-last-child(-n+2) > .sub-menu::before {
    left: auto;
    right: 24px;
}

.xs_header__bottom .header_menu .sub-menu.subtoggle,
.xs_header__bottom .header_menu > li.is-open > .sub-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.xs_header__bottom .header_menu .sub-menu li {
    display: block;
    min-width: 0;
}

.xs_header__bottom .header_menu .sub-menu .header-menu-link {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 17px;
    line-height: 1.25;
    color: #111111;
    white-space: nowrap;
    transition: color .18s ease, background-color .18s ease, padding-left .18s ease;
}

.xs_header__bottom .header_menu .sub-menu .header-menu-link:hover,
.xs_header__bottom .header_menu .sub-menu li:hover > .header-menu-link {
    color: var(--akcent_color, #c8352f);
    background-color: rgba(0, 0, 0, .045);
}

/* Nested submenu: click-open, opens to the right */
.xs_header__bottom .header_menu .sub-menu .sub-menu {
    left: calc(100% + 10px);
    top: -10px;
    width: fit-content;
    min-width: 180px;
    max-width: min(90vw, 420px);
    transform: translateX(8px);
}

.xs_header__bottom .header_menu .sub-menu li.menu-item-has-children {
    padding-right: 12px;
}

.xs_header__bottom .header_menu .sub-menu li.menu-item-has-children > .header-menu-link {
    cursor: pointer;
}

.xs_header__bottom .header_menu .sub-menu li.menu-item-has-children::after {
    content: "\f107";
    font: normal normal normal 16px/1 FontAwesome;
    color: var(--akcent_color, #c8352f);
    position: absolute;
    right: 0;
    top: 10px;
    transform: rotate(-90deg);
    z-index: 2;
    pointer-events: none;
    transition: transform .22s ease, color .22s ease;
}

.xs_header__bottom .header_menu .sub-menu li.menu-item-has-children.is-open::after {
    transform: rotate(90deg);
    color: var(--akcent_color, #c8352f);
}

.xs_header__bottom .header_menu .sub-menu li.menu-item-has-children.is-open > .sub-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
}

.xs_header__bottom .header_menu .sub-menu .sub-menu.xs-submenu-wide {
    display: block;
    column-count: 2;
    column-gap: 16px;
    width: fit-content;
    min-width: 280px;
    max-width: min(90vw, 700px);
}

.xs_header__bottom .header_menu .sub-menu .sub-menu.xs-submenu-wide > li {
    break-inside: avoid;
    page-break-inside: avoid;
    display: block;
    width: auto;
    max-width: none;
    margin-bottom: 2px;
}

.xs_header__bottom .header_menu .sub-menu .sub-menu.xs-submenu-wide > li > .header-menu-link {
    white-space: nowrap;
}

/* Guard against underline appearing inside dropdowns */
.xs_header__bottom .header_menu .sub-menu .header-menu-link::before,
.xs_header__bottom .header_menu .sub-menu .header-menu-link::after {
    content: none;
}




#menu-header-menu::after {
    content: '';
    display: block;
    width: 100%;
    height: 1px;
    background-color: #E8E8E8;
    position: absolute;
    bottom: -23px;
    left: 0;
}














/* ═══════════════════════════════════════
   5. Responsive
   ═══════════════════════════════════════ */

@media (max-width: 1199px) {
    .xs_header__bottom .header_menu {
        gap: 42px;
        justify-content: flex-start;
        /* flex-wrap: wrap; */
    }

    .xs_header__bottom .header-menu-link {
        font-size: 17px;
    }

   .xs_filial-select__list {
        min-width: 1080px;
    }
    
}


@media (max-width: 1160px) {

     .xs_filial-select__list {
        min-width: 1040px;
    }

}


@media (max-width: 1060px) {
    .xs_header__bottom .header_menu {
        gap: 34px;
    }
}



@media (max-width: 1090px) {
     .xs_filial-select__list {
        min-width: 930px;
    }
}








@media (min-width: 992px) {
    /* Desktop: hide mobile selector */
    .xs_filial-select--mobile {
        display: none !important;
    }

    .xs_filial-select--desktop {
        display: block;
    }
}


@media (max-width: 991px) {
    .xs_header__top,
    .xs_header__topright {
        gap: 18px;
    }

    .xs_header__bottom .header_menu {
        align-items: flex-start;
    }

    .xs_header__bottom .header_menu .sub-menu {
        max-width: calc(100vw - 30px);
    }

    /* Show mobile selector, hide desktop */
    .xs_filial-select--desktop {
        display: none;
    }

    .xs_filial-select--mobile {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-end;
        gap: 10px;
    }

    .xs_header__topright___emailphone
    {
        display: none;
    }
}





@media (max-width: 576px) {
    .xs_header__topright___messegers .xs_max > span
    {
        display: none;
    }
}




@media (max-width: 360px) {
    .header_logo {
        width: 135px;
        height: 55px;
        object-fit: contain;
    }


    .xs_header__topright___messegers img {
        width: 30px;
        height: 46px;
        object-fit: contain;
    }
}


/* ═══════════════════════════════════════
   6. Mobile top-line contacts
   ═══════════════════════════════════════ */

.xs_header_mobile_contacts {
    display: none;
}

.xs_header_mobile_contacts__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 34px;
    padding: 10px 12px;
    border-radius: 0;
    font-family: var(--xs-font-family-primary);
    font-size: 14px;
    line-height: 1;
    font-weight: var(--xs-font-weight-semibold);
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    box-sizing: border-box;
}

.xs_header_mobile_contacts__item svg {
    flex: 0 0 12px;
    width: 12px;
    height: 12px;
    color: currentColor;
}

.xs_header_mobile_contacts__item--phone {
    background: linear-gradient(90deg, var(--akcent_color, #f41818) 0%, #ff3b3b 100%);
}

.xs_header_mobile_contacts__item--email {
    background: #2C3137;
}

@media (max-width: 991px) {
    .xs_header_mobile_contacts {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 15px;
        width: 100%;
        margin-top: 15px;
    }

    .xs_header_mobile_contacts__item {
        width: 100%;
    }
}

@media (max-width: 390px) {
    .xs_header_mobile_contacts__item {
        gap: 5px;
        padding-left: 8px;
        padding-right: 8px;
        font-size: 13px;
    }
}
