/* === SUPER MENU === */
#supermenu {
    display: none;
    position: fixed;
    top: calc(var(--header-height, 120px));
    left: 0;
    width: 100vw;
    height: calc(100vh - var(--header-height, 120px));
    background: var(--white);
    z-index: 1000;
    overflow-y: auto; scrollbar-width: none; /* Firefox */ -ms-overflow-style: none;  /* Internet Explorer 10+ */
    box-sizing: border-box;
    padding: 20px 50px;
}

/* Стили для каталога меню */
.catalog-menu {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
    padding: 0;
    margin: 0;
}

/* Базовые настройки для всех меню */
.menu-level {
    position: relative; 
    list-style: none; 
    padding: 0; 
    margin: 0;
    box-sizing: border-box;
    overflow-y: auto; scrollbar-width: none; /* Firefox */ -ms-overflow-style: none;  /* Internet Explorer 10+ */
}

/* Десктопные стили для подуровней */
.menu-level:not(.menu-root) {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0s linear 0.3s;
}

.menu-level:not(.menu-root).menu-level--visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease-in-out, visibility 0s linear 0s;
}

.menu-root {
    height: calc(100% - 40px);
    flex-shrink: 0; 
    background-color: var(--main-grey); 
    border-radius: 10px;
    padding: 20px 0 20px 20px;
}

/* Все пункты меню */
.menu-item {
    position: relative;
}
    
/* Ссылки в меню */
.menu-item a {
    display: block;
    padding: 8px 20px;
    font-size: 15px;
}

/* Особые стили для первого уровня */
.menu-root > .menu-item {
    background: url(../img/arrow-right-small.png) no-repeat calc(100% - 20px) 50%;
    background-size: auto 14px;
}

.menu-root > .menu-item > a {
    font-size: 18px;
    font-weight: 400;
    padding: 15px 20px;
    background: none;
}

.menu-root > .menu-item.active  {
    border-radius: 10px 0 0 10px;
    background-color: #fff;
}

/* Иконки первого уровня */
.menu-root > .menu-link-1 > a,
.mobile-menu-root .menu-link-1 > a {background: url(../img/cat-1.png) no-repeat 15px 50%; background-size: 30px auto; padding-left: 60px;}

.menu-root > .menu-link-8 > a,
.mobile-menu-root .menu-link-8 > a {background: url(../img/cat-2.png) no-repeat 15px 50%; background-size: 30px auto; padding-left: 60px;}

.menu-root > .menu-link-9 > a,
.mobile-menu-root .menu-link-9 > a {background: url(../img/cat-3.png) no-repeat 15px 50%; background-size: 30px auto; padding-left: 60px;}

.menu-root > .menu-link-10 > a,
.mobile-menu-root .menu-link-10 > a {background: url(../img/cat-4.png) no-repeat 15px 50%; background-size: 30px auto; padding-left: 60px;}

.menu-root > .menu-link-11 > a,
.mobile-menu-root .menu-link-11 > a {background: url(../img/cat-5.png) no-repeat 15px 50%; background-size: 30px auto; padding-left: 60px;}

.menu-root > .menu-link-12 > a,
.mobile-menu-root .menu-link-12 > a {background: url(../img/cat-6.png) no-repeat 15px 50%; background-size: 30px auto; padding-left: 60px;}

.menu-root > .menu-link-13 > a,
.mobile-menu-root .menu-link-13 > a {background: url(../img/cat-7.png) no-repeat 15px 50%; background-size: 30px auto; padding-left: 60px;}

/* УСЛУГИ */
.menu-root > .menu-link-14 > a,
.mobile-menu-root .menu-link-14 > a {background: url(../img/cat-8.png) no-repeat 15px 50%; background-size: 30px auto; padding-left: 60px;}

/* Стрелки для подпунктов */
.menu-item .menu-item.has-children {
    background: url(../img/arrow-right-small.png) no-repeat calc(100% - 10px) 50%;
    background-size: auto 14px;
    border-radius: var(--main-radius);
}

/* Базовое позиционирование подменю */
.menu-item .menu-level {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    z-index: 100;
    border-right: 1px solid #eee;
    box-sizing: border-box;
    padding: 0 20px;
    height: auto;
}

/* Фиксированное позиционирование для десктопа */
.menu-root > .menu-item > .menu-level,
.menu-root > .menu-item > .menu-level .menu-level {
    position: fixed;
    top: 0;
    margin-top: 0;
    padding-top: 0;
    height: auto;
    border-right: 1px solid #D0D0D0;
    width: 290px;
    box-sizing: border-box;
}

/* Показ подменю при наведении (НЕ ТРОГАЕМ - ДЛЯ ДЕСКТОПА) */
.menu-item.has-children:hover > .menu-level,
.menu-item.has-children.active > .menu-level {
    display: block;
}

/* Активные состояния (НЕ ТРОГАЕМ - ДЛЯ ДЕСКТОПА) */
.menu-item .menu-item.active {
    background: url(../img/arrow-right-small.png) no-repeat calc(100% - 10px) 50%;
    background-size: auto 14px;
    background-color: var(--main-grey);
}

/* Z-index для десктопа (НЕ ТРОГАЕМ) */
.menu-root > .menu-item > .menu-level {z-index: 101;}
.menu-root > .menu-item > .menu-level > .menu-item > .menu-level {z-index: 102;}
.menu-root > .menu-item > .menu-level > .menu-item > .menu-level > .menu-item > .menu-level {z-index: 103;}

/* Контейнер заголовка */
#supermenu-active-title-container {
    position: absolute;
    z-index: 105;
    display: none;
    padding-bottom: 15px;
    box-sizing: border-box;
}
#supermenu-active-title-text {
    font-size: 40px; 
    font-weight: 700;
    color: var(--main-black);
    line-height: normal;
    margin: 28px 0 10px 40px;
    padding: 0;
}

/* МОБИЛЬНЫЕ СТИЛИ */
@media (max-width: 800px) {
    /* Контейнер мобильного меню */
    #mobile-menu-container {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: var(--white);
        z-index: 9999;
        padding: 60px 0 20px 0;
        box-sizing: border-box;
        overflow-y: auto;
    }

    /* Кнопка закрытия */
    .mobile-close-button {
        position: fixed;
        top: 10px;
        right: 10px;
        padding: 10px 15px;
        background: var(--main-orange);
        font-weight: 700;
        color: white;
        border: none;
        border-radius: 8px;
        font-size: 16px;
        cursor: pointer;
        z-index: 10000;
    }

    /* Кнопка назад */
    .mobile-back-button {
        display: block;
        width: calc(100% - 40px);
        margin: 0 20px 20px 20px;
        padding: 15px 20px;
        background: var(--main-grey);
        border: none;
        border-radius: 10px;
        font-size: 16px;
        font-weight: 500;
        cursor: pointer;
        color: var(--main-black);
    }

    /* Заголовок уровня */
    .mobile-level-title {
        margin: 0 20px 20px 20px;
        font-size: 24px;
        font-weight: 700;
        color: var(--main-black);
        padding-bottom: 15px;
        border-bottom: 2px solid var(--main-grey);
    }

    /* Мобильный корневой уровень */
    .mobile-menu-root {
        padding: 0 20px;
        background: none;
        border-radius: 0;
        height: auto;
        list-style: none;
    }

    /* Мобильные пункты первого уровня - наследуют иконки */
    .mobile-menu-root .menu-item {
        margin-bottom: 2px;
        border-radius: 10px;
        background-color: var(--main-grey);
        list-style: none;
    }

    .mobile-menu-root .menu-item > a {
        display: block;
        padding: 20px 60px 20px 60px;
        font-size: 18px;
        font-weight: 500;
        color: var(--main-black);
        text-decoration: none;
        border-radius: 10px;
        background-size: 30px auto;
        background-repeat: no-repeat;
        background-position: 15px 50%;
    }

    /* Стрелки для корневых элементов с подменю */
    .mobile-menu-root .menu-item.has-children > a {
        padding-right: 50px;
        position: relative;
    }

    .mobile-menu-root .menu-item.has-children > a::after {
        content: '';
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
        width: 14px;
        height: 14px;
        background-image: url(../img/arrow-right-small.png);
        background-repeat: no-repeat;
        background-position: center;
        background-size: contain;
        transition: opacity 0.2s ease;
    }

    /* Визуальная область для клика по стрелке */
    .mobile-menu-root .menu-item.has-children > a::before {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 60px;
        background: rgba(0, 0, 0, 0.05);
        border-radius: 0 10px 10px 0;
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    .mobile-menu-root .menu-item.has-children > a:active::before {
        opacity: 1;
    }

    .mobile-submenu .menu-item.has-children > a {
        position: relative;
    }

    /* Аналогично для подуровней */
    .mobile-submenu .menu-item.has-children > a::before {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 50px;
        background: rgba(0, 0, 0, 0.05);
        border-radius: 0 8px 8px 0;
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    .mobile-submenu .menu-item.has-children > a:active::before {
        opacity: 1;
    }

    /* Специфичные правила для категорий с подменю - сохраняем иконки */
    .mobile-menu-root .menu-link-1.has-children > a {background-image: url(../img/cat-1.png);}
    .mobile-menu-root .menu-link-8.has-children > a {background-image: url(../img/cat-2.png);}
    .mobile-menu-root .menu-link-9.has-children > a {background-image: url(../img/cat-3.png);}
    .mobile-menu-root .menu-link-10.has-children > a {background-image: url(../img/cat-4.png);}
    .mobile-menu-root .menu-link-11.has-children > a {background-image: url(../img/cat-5.png);}
    .mobile-menu-root .menu-link-12.has-children > a {background-image: url(../img/cat-6.png);}
    .mobile-menu-root .menu-link-13.has-children > a {background-image: url(../img/cat-7.png);}
    .mobile-menu-root .menu-link-14.has-children > a {background-image: url(../img/cat-8.png);}

    /* Мобильные подуровни */
    .mobile-submenu {
        padding: 0 20px;
        background: none;
        list-style: none;
    }

    .mobile-submenu .menu-item {
        margin-bottom: 2px;
        background: none;
        border-radius: 8px;
        list-style: none;
    }

    .mobile-submenu .menu-item > a {
        display: block;
        padding: 15px 20px;
        font-size: 16px;
        color: var(--main-black);
        text-decoration: none;
        background: #f8f8f8;
        border-radius: 8px;
    }

    .mobile-submenu .menu-item.has-children > a {
        background-image: url(../img/arrow-right-small.png);
        background-repeat: no-repeat;
        background-position: calc(100% - 15px) 50%;
        background-size: 12px auto;
        background-color: #f8f8f8;
        padding-right: 40px;
    }

    /* Активные состояния для мобильной версии */
    .mobile-menu-root .menu-item:active,
    .mobile-submenu .menu-item:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}