/* ===== МЕНЮ В СТИЛЕ K-SPEED ===== */

.nav {
    background: #fff;
    padding-top: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.nav__content {
    position: relative;
}

.menu {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
    gap: 30px;
}

/* Элементы основного меню */
.menu__item {
    position: relative;
    margin: 0;
}

.menu__link {
    display: block;
    padding: 10px 0;
    color: #6b6b6b;
    text-decoration: none;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.55;
    transition: all 0.3s ease;
    position: relative;
}

.menu__link:hover {
    color: #111111;
}

/* Активный пункт меню */
.menu__item--active > .menu__link {
    color: #111111;
    font-weight: 500;
}

.menu__item--active > .menu__link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #F91D1D;
}

/* ===== ВЫПАДАЮЩИЕ ПОДМЕНЮ ===== */

/* Стрелка для пунктов с подменю */
.menu__item--has-children > .menu__link {
    position: relative;
    padding-right: 20px;
}

.menu__item--has-children > .menu__link::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 7px;
    background: url("data:image/svg+xml,%3Csvg width='12' height='7' viewBox='0 0 12 7' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%236b6b6b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
    transition: transform 0.3s ease;
}

.menu__item--has-children:hover > .menu__link::after {
    transform: translateY(-50%) rotate(180deg);
    background: url("data:image/svg+xml,%3Csvg width='12' height='7' viewBox='0 0 12 7' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23F91D1D' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
}

/* Подменю (по умолчанию скрыто) */
.sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 240px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
    margin: 0;
    padding: 10px 0;
    list-style: none;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.05);
}

/* Показываем подменю при наведении */
.menu__item:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Элементы подменю */
.sub-menu .menu__item {
    width: 100%;
}

.sub-menu .menu__link {
    padding: 10px 20px;
    white-space: nowrap;
    font-size: 14px;
    color: #6b6b6b;
    border-left: 2px solid transparent;
}

.sub-menu .menu__link:hover {
    color: #111111;
    background: #f8f8f8;
    border-left-color: #F91D1D;
    padding-left: 25px;
}

/* Активный пункт в подменю */
.sub-menu .menu__item--active > .menu__link {
    color: #111111;
    font-weight: 500;
    border-left-color: #F91D1D;
}

/* ===== ВЛОЖЕННЫЕ ПОДМЕНЮ (3-Й УРОВЕНЬ) ===== */

/* Подменю второго уровня (смещаем вправо) */
.sub-menu .sub-menu {
    top: 0;
    left: 100%;
    margin-left: 5px;
    transform: translateX(10px);
}

/* Анимация для вложенных подменю */
.sub-menu .menu__item:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Стрелка для пунктов с вложенным подменю */
.sub-menu .menu__item--has-children > .menu__link {
    position: relative;
    padding-right: 30px;
}

.sub-menu .menu__item--has-children > .menu__link::after {
    content: '';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 7px;
    background: url("data:image/svg+xml,%3Csvg width='12' height='7' viewBox='0 0 12 7' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%236b6b6b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
    transform: translateY(-50%) rotate(-90deg);
}

.sub-menu .menu__item--has-children:hover > .menu__link::after {
    background: url("data:image/svg+xml,%3Csvg width='12' height='7' viewBox='0 0 12 7' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23F91D1D' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
}

/* Последний пункт меню справа */
.menu__item:last-child {
    margin-left: auto;
}

/* ===== МОБИЛЬНОЕ МЕНЮ ===== */

/* Кнопка бургер для мобильных */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    width: 44px;
    height: 44px;
    position: relative;
    z-index: 100;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #111;
    margin: 5px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

@media (max-width: 1024px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .nav__content {
        position: relative;
    }
    
    .menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
        gap: 0;
        border-radius: 0 0 8px 8px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.1);
        z-index: 1000;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .menu.menu--open {
        display: flex;
    }
    
    .menu__item {
        width: 100%;
        margin-left: 0 !important;
    }
    
    .menu__link {
        width: 100%;
        padding: 15px 0;
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }
    
    .menu__item:last-child .menu__link {
        border-bottom: none;
    }
    
    .menu__item--has-children > .menu__link {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .menu__item--has-children > .menu__link::after {
        position: static;
        transform: none;
    }
    
    .menu__item--has-children.mobile-open > .menu__link::after {
        transform: rotate(180deg);
    }
    
    /* Подменю на мобильных */
    .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: #f8f8f8;
        display: none;
        padding: 10px 0 10px 20px;
        margin: 0;
        width: 100%;
        border: none;
        border-radius: 0;
    }
    
    .menu__item--has-children.mobile-open > .sub-menu {
        display: block;
    }
    
    .sub-menu .menu__link {
        border-left: none;
        padding: 10px 20px;
    }
    
    .sub-menu .menu__link:hover {
        padding-left: 25px;
    }
    
    /* Вложенные подменю на мобильных */
    .sub-menu .sub-menu {
        left: 0;
        background: #f0f0f0;
    }
    
    .sub-menu .menu__item--has-children > .menu__link::after {
        transform: none;
    }
    
    .sub-menu .menu__item--has-children.mobile-open > .menu__link::after {
        transform: rotate(180deg);
    }
}

/* Затемнение фона при открытом мобильном меню */
.menu-open body {
    overflow: hidden;
}

.menu-open body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    animation: fadeIn 0.3s ease;
}
.menu-open nav {
	display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Анимации для пунктов меню */
.menu__link {
    transition: color 0.3s ease, padding 0.3s ease;
}

.sub-menu .menu__link {
    transition: color 0.3s ease, background 0.3s ease, padding-left 0.3s ease, border-color 0.3s ease;
}

.sub-menu {
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

/* Эффект появления для подменю */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu__item:hover > .sub-menu {
    animation: slideDown 0.3s ease;
}