/* --- ОСНОВНОЕ МЕНЮ ПК --- */
.top-menu {
    display: flex;
    gap: 28px;
    align-items: center;
}

.menu-item > a {
    color: #ffffff;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
}

.menu-item > a:hover {
    color: #FFD400;
}

/* --- ВЫПАДАЮЩЕЕ МЕНЮ (ПК) --- */
.has-submenu {
    position: relative;
}

.submenu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 15px; /* Отступ от пункта меню */
    background: #0a1515;
    border: var(--border-settings, 1px solid #1a2a2a);
    border-radius: 12px;
    padding: 8px 0;
    min-width: 220px;
    
    /* Плавное появление */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* Невидимый мостик, чтобы меню не пропадало при движении мыши вниз */
.has-submenu::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 0;
    width: 100%;
    height: 15px;
}

.has-submenu:hover .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.submenu a {
    display: block;
    padding: 10px 20px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
}

.submenu a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
    padding-left: 24px; /* Легкое смещение текста при наведении */
}

/* --- МОБИЛЬНАЯ ВЕРСИЯ --- */
@media (max-width: 1068px) {
    .top-menu {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
        width: 100%;
    }
    
    .menu-item {
        width: 100%;
    }

    .submenu {
        position: static; /* Становится гармошкой внутри списка */
        display: none; /* Полностью скрываем из потока */
        opacity: 1;
        visibility: visible;
        transform: none;
        margin-top: 12px;
        background: rgba(255, 255, 255, 0.03);
        border: none;
        box-shadow: none;
        width: 100%;
    }

    /* Класс, который будет вешать JS */
    .submenu.is-open {
        display: block;
    }

    .submenu-arrow {
        transition: transform 0.3s ease;
    }

    /* Поворот стрелки при открытии */
    .has-submenu.is-active .submenu-arrow {
        transform: rotate(180deg);
    }

    .has-submenu::after {
        display: none; /* Убираем мостик на мобилке */
    }
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: #0a151599;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.header-inner {
    border-left: var(--border-settings);
    border-right: var(--border-settings);
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.header-content {
    padding: 16px 8px;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    z-index: 1;
}

/* --- ЛОГОТИП --- */
.header-logo {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.header-logo .desc-text {
    border-left: var(--border-settings);
    padding-left: 20px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.2;
    font-weight: 500;
    margin: 0;
}

/* --- НАВИГАЦИЯ И КНОПКА --- */
.header-nav {
    display: flex;
    flex-grow: 1;
    align-items: center;
    justify-content: space-between;
}

.header-menu-wrapper {
    margin: 0 auto;
    display: flex;
    justify-content: center;
}

/* Главная обертка для всего правого края */
.header-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

/* Контейнер для Телефон Войти */
.header-account-block {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 24px;
}

/* ========================================= */
/* БЛОК ТЕЛЕФОНА                             */
/* ========================================= */
.phone-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.phone-link {
    font-weight: 700;
    font-size: 16px;
    color: #ffffff;
    text-decoration: none;
    line-height: 1.2;
}

.phone-subtitle {
    font-size: 12px;
    color: #94a3b8;
    margin: 0;
}

/* ========================================= */
/* ССЫЛКА "ВОЙТИ"                            */
/* ========================================= */
.login-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: #ffffff;
    font-size: 15px;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.login-link:hover {
    opacity: 0.8;
}

.login-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ========================================= */
/* ОВЕРЛЕЙ И БУРГЕР                          */
/* ========================================= */
.nav-overlay {
    display: none;
}

.burger-animated {
    border: var(--border-settings);
    border-radius: 12px;
    display: none;
    width: 56px;
    height: 56px;
    background: transparent;
    cursor: pointer;
    z-index: 1001;
    padding: 0;
    position: relative;
}

.burger-lines {
    width: 24px;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 2px;
    position: relative;
    transition: background-color 0.2s ease-in-out;
    margin: 0 auto;
}

.burger-lines::before,
.burger-lines::after {
    content: "";
    position: absolute;
    left: 0;
    width: 24px;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition:
        transform 0.3s ease-in-out,
        top 0.3s ease-in-out;
}

.burger-lines::before {
    top: -8px;
}
.burger-lines::after {
    top: 8px;
}

.burger-animated.is-active .burger-lines {
    background-color: transparent;
}
.burger-animated.is-active .burger-lines::before {
    top: 0;
    transform: rotate(45deg);
}
.burger-animated.is-active .burger-lines::after {
    top: 0;
    transform: rotate(-45deg);
}

/* ========================================= */
/* МОБИЛЬНАЯ ВЕРСИЯ                          */
/* ========================================= */
@media (max-width: 1200px) {
    .header-inner {
        border-left: 0px;
        border-right: 0px;
    }
}

@media (max-width: 1068px) {
    .burger-animated {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    /* Превращаем nav в боковую панель */
    .header-nav {
        position: fixed;
        top: 0;
        right: -150%;
        width: 100%;
        max-width: 320px;
        height: 100vh;
        background-color: var(--background-secondary);
        z-index: 1000;
        padding: 80px 24px 24px 24px;
        transition: right 0.3s ease-in-out;

        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
    }

    .header-nav.is-open {
        right: 0;
    }

    .header-menu-wrapper {
        margin: 0 0 32px 0;
        display: flex;
        flex-direction: column;
    }

    .header-actions {
        flex-direction: column;
        gap: 20px;
    }

    .header-account-block {
        flex-direction: column;
        gap: 16px;
        width: 100%;
        align-items: center;
    }

    .phone-block {
        align-items: center;
    }

    .header-actions .btn-yellow {
        width: 100%; 
        justify-content: center;
        text-align: center;
    }

    .nav-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: rgba(0, 0, 0, 0.6);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease-in-out;
    }

    .nav-overlay.is-open {
        opacity: 1;
        visibility: visible;
    }
}

@media (max-width: 410px) {
    .desc-text {
        display: none;
    }
}
