/* Стили для каталога в фиксированном хедере */
body .wrapper1 #headerfixed .menu-row .menu-only-wr .mega-menu table td > .wrap > a {
    background-color: #259f5c !important;
    color: #fff !important;
    transition: background-color 0.3s ease;
    padding: 10px 14px 10px 10px;
    border-radius: 10px;
}

/* Стили для иконки каталога */
body .wrapper1 #headerfixed .menu-row .menu-only-wr .mega-menu table td > .wrap > a svg path,
body .wrapper1 #headerfixed .menu-row .menu-only-wr .mega-menu table td > .wrap > a .svg-inline-catalog path {
    fill: #FFFFFF !important;
}

body .wrapper1 #headerfixed .mega-menu table td .wrap > a .svg:not(.svg-inline-down) {
  top: -1px;
  margin-right: 6px;
  opacity: 1;
}

/* Специфичные стили для фиксированного хедера */
body .wrapper1 #headerfixed .logo-row.menu-row .menu-only-wr .mega-menu table td > .wrap > a {
    background-color: #d9002b !important;
    margin-bottom: 0 !important;
}

body .wrapper1 #headerfixed .logo-row.menu-row .menu-only-wr .mega-menu table td > .wrap > a:hover {
    background-color: #f00837 !important;
    cursor: pointer !important;
    margin-bottom: 0 !important;
}

/* Отключаем затемнение фона для каталога в фиксированном хедере */
#headerfixed .mega-menu .menu-item.dropdown.hover .wrap::before {
  background-color: none !important;
  background: none !important;
}

#headerfixed .menu-navigation {
    height: calc(100vh - 70px);
    display: flex;
    overflow: hidden;
}

#headerfixed .menu-navigation__sections-wrapper {
    width: 256px;
    border-right: 1px solid rgba(0, 0, 0, 0.09);
    flex-shrink: 0;
    overflow-y: scroll;
    height: 100%;
    scrollbar-width: thin;
    scrollbar-color: #f00837 transparent;
}


#headerfixed .menu-navigation__sections-wrapper::-webkit-scrollbar {
    width: 4px;
    overflow-y: scroll;
}

#headerfixed .menu-navigation__sections-wrapper::-webkit-scrollbar-track {
    background: transparent;
    overflow-y: scroll;
}

#headerfixed .menu-navigation__sections-wrapper::-webkit-scrollbar-thumb {
    background-color: #f00837;
    border-radius: 2px;
    overflow-y: scroll;
}

body .wrapper1 #headerfixed .menu-row .mega-menu table td.wide_menu .dropdown-menu.long-menu-items .customScrollbar {
    height: 100% !important;
    overflow: visible !important;
}

/* Блокируем скролл при открытом меню в фиксированном хедере */
body.mega-fixed-menu-open {
    overflow: hidden !important;
    padding-right: var(--scrollbar-width, 0px) !important;
}

/* Стили для открытого состояния меню */
body.mega-fixed-menu-open #headerfixed {
    right: var(--scrollbar-width, 0px) !important;
}

/* Скрываем меню вместе с хедером */
#headerfixed:not(.fixed) .mega-menu table td.wide_menu > .wrap > .dropdown-menu,
#headerfixed.fixed.scrolled.hidden .mega-menu table td.wide_menu > .wrap > .dropdown-menu {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Очищаем состояние при скрытом хедере */
#headerfixed:not(.fixed) .mega-menu table td,
#headerfixed.fixed.scrolled.hidden .mega-menu table td {
    pointer-events: none !important;
}

#headerfixed:not(.fixed) .menu-item.dropdown.hover,
#headerfixed.fixed.scrolled.hidden .menu-item.dropdown.hover {
    background: none !important;
}

/* Сохраняем стили для header_7 */
body .wrapper1 .header_7 .menu-row .menu-only-wr .mega-menu table td > .wrap > a {
    background-color: inherit;
}

/* Стили для контейнера выпадающего меню */
body .wrapper1 #headerfixed .menu-row .mega-menu table td.wide_menu > .wrap > .dropdown-menu {
    display: block !important;
    position: fixed !important;
    top: 62px !important;
    left: 0 !important;
    right: 0 !important;
    height: calc(100vh - 60px) !important;
    overflow: hidden !important;
    margin: 0 !important;
    overscroll-behavior: contain;
}

/* Стили для правой части меню с подкатегориями */
body .wrapper1 #headerfixed .menu-row .mega-menu .dropdown-menu .menu-navigation__content {
    padding: 20px;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* Фиксируем положение меню при скролле */
body .wrapper1 #headerfixed .menu-row .mega-menu table td.wide_menu {
    position: static !important;
}

/* Стили для состояния с открытым меню */
body.mega-menu-opened {
    pointer-events: none; /* Блокируем взаимодействие с body */
}

body.mega-menu-opened .mega-menu-overlay,
body.mega-menu-opened #headerfixed,
body.mega-menu-opened #headerfixed .menu-row .mega-menu {
    pointer-events: auto; /* Разрешаем взаимодействие с меню */
}

/* Оверлей для блокировки кликов */
.mega-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 995;
    display: none;
}

.mega-menu-overlay.active {
    display: block;
}
