/* ========================================
   НАВИГАЦИОННОЕ МЕНЮ БЦ АКАДЕМИЧЕСКИЙ
   Версия: 2025.01_unified_premium
   ======================================== */

/* ========================================
   ПЕРЕМЕННЫЕ И БАЗОВЫЕ НАСТРОЙКИ
   ======================================== */

:root {
    /* Цветовая палитра для светлой темы */
    --nav-bg-light: rgba(255, 255, 255, 0.95);
    --nav-border-light: rgba(0, 0, 0, 0.08);
    --text-primary-light: #414141;
    --text-secondary-light: #4a5568;
    
    /* Цветовая палитра для темной темы */
    --nav-bg-dark: rgba(255, 255, 255, 0.06);
    --nav-border-dark: rgba(255, 255, 255, 0.1);
    --text-primary-dark: rgba(255, 255, 255, 0.9);
    --text-secondary-dark: rgba(255, 255, 255, 0.7);
    
    /* Акцентные цвета */
    --menu-accent-primary: #65A9DD;
    --menu-accent-secondary: #7EB6E3;
    
    /* Анимации */
    --ease-premium: cubic-bezier(0.33, 1, 0.68, 1);
    --ease-smooth: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ========================================
   ДЕСКТОПНАЯ НАВИГАЦИЯ
   ======================================== */

.main-navigation {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    pointer-events: none;
}

.nav-container {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 4px 8px;
    border-radius: 20px;
    pointer-events: auto;
    position: relative;
    transition: all 0.3s var(--ease-premium);
    
    /* Анимация появления */
    opacity: 0;
    transform: translateY(-10px);
    animation: menuFadeIn 0.5s ease forwards;
    animation-delay: 0.3s;
}

/* Стили контейнера для светлой темы */
body:not(.night-mode) .nav-container {
    background: var(--nav-bg-light);
    border: 1px solid var(--nav-border-light);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.05),
        0 10px 40px rgba(0, 0, 0, 0.08);
}

body:not(.night-mode) .nav-container:hover {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 12px 48px rgba(0, 0, 0, 0.12);
}

/* Стили контейнера для темной темы */
body.night-mode .nav-container {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.night-mode .nav-container:hover {
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

@keyframes menuFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Основная секция навигации */
.nav-main-section {
    display: flex;
    align-items: center;
    gap: 0;
}

/* Секция авторизации */
.nav-auth-section {
    margin-left: 60px;
    position: relative;
}

/* Визуальный разделитель */
.nav-auth-section::before {
    content: '';
    position: absolute;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 20px;
}

body:not(.night-mode) .nav-auth-section::before {
    background: linear-gradient(
        to bottom,
        transparent,
        rgba(0, 0, 0, 0.12),
        transparent
    );
}

body.night-mode .nav-auth-section::before {
    background: linear-gradient(
        to bottom,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
}

/* Элементы навигации */
.nav-item {
    position: relative;
    opacity: 0;
    animation: navItemFadeIn 0.5s ease forwards;
}

.nav-item:nth-child(1) { animation-delay: 0.1s; }
.nav-item:nth-child(2) { animation-delay: 0.15s; }
.nav-item:nth-child(3) { animation-delay: 0.2s; }
.nav-item:nth-child(4) { animation-delay: 0.25s; }
.nav-item:nth-child(5) { animation-delay: 0.3s; }

@keyframes navItemFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Базовые стили ссылок */
.nav-link {
    display: block;
    padding: 10px 18px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.2px;
    border-radius: 16px;
    transition: all 0.25s ease;
    position: relative;
    white-space: nowrap;
}

/* Ссылки для светлой темы */
body:not(.night-mode) .nav-link {
    color: var(--text-primary-light);
}

body:not(.night-mode) .nav-link:hover {
    background: rgba(101, 169, 221, 0.08);
    color: var(--menu-accent-primary);
}

/* Ссылки для темной темы */
body.night-mode .nav-link {
    color: rgba(255, 255, 255, 0.8);
}

body.night-mode .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* КНОПКА ВХОДА В ДЕСКТОПЕ */
.nav-login .nav-link {
    font-weight: 400;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-size: 12px;
    padding: 8px 20px;
    border-radius: 50px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s var(--ease-premium);
}

/* Кнопка входа - светлая тема */
body:not(.night-mode) .nav-login .nav-link {
    background: linear-gradient(135deg, var(--menu-accent-primary), var(--menu-accent-secondary));
    color: white;
    border: none;
    box-shadow: 
        0 2px 8px rgba(101, 169, 221, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

body:not(.night-mode) .nav-login .nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transition: left 0.5s ease;
}

body:not(.night-mode) .nav-login .nav-link:hover::before {
    left: 100%;
}

body:not(.night-mode) .nav-login .nav-link:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 4px 16px rgba(101, 169, 221, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Кнопка входа - темная тема */
body.night-mode .nav-login .nav-link {
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

body.night-mode .nav-login .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0;
    background: rgba(255, 255, 255, 0.05);
    transition: height 0.3s ease;
}

body.night-mode .nav-login .nav-link:hover::after {
    height: 100%;
}

body.night-mode .nav-login .nav-link:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* Выпадающее меню */
.nav-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px;
    min-width: 220px;
    border-radius: 12px;
    margin-top: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-10px);
    transition: all 0.3s ease;
}

/* Выпадающее меню - светлая тема */
body:not(.night-mode) .nav-dropdown {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--nav-border-light);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 8px 28px rgba(0, 0, 0, 0.12);
}

/* Выпадающее меню - темная тема */
body.night-mode .nav-dropdown {
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.nav-item:hover .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dropdown-link {
    display: block;
    padding: 10px 16px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.1px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

body:not(.night-mode) .dropdown-link {
    color: var(--text-secondary-light);
}

body:not(.night-mode) .dropdown-link:hover {
    background: rgba(101, 169, 221, 0.08);
    color: var(--menu-accent-primary);
    padding-left: 20px;
}

body.night-mode .dropdown-link {
    color: rgba(255, 255, 255, 0.8);
}

body.night-mode .dropdown-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    padding-left: 20px;
}

/* Индикатор выпадающего меню */
.has-dropdown > .nav-link::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 6px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    transition: all 0.2s ease;
}

body:not(.night-mode) .has-dropdown > .nav-link::after {
    border-top: 4px solid #718096;
}

body:not(.night-mode) .has-dropdown:hover > .nav-link::after {
    border-top-color: var(--menu-accent-primary);
    transform: rotate(180deg);
}

body.night-mode .has-dropdown > .nav-link::after {
    border-top: 4px solid rgba(255, 255, 255, 0.5);
}

body.night-mode .has-dropdown:hover > .nav-link::after {
    border-top-color: rgba(255, 255, 255, 0.9);
    transform: rotate(180deg);
}

/* ========================================
   МОБИЛЬНОЕ МЕНЮ
   ======================================== */

.site-header {
    position: fixed;
    top: 18px;
    right: 10px;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    z-index: 1600;
}

/* Бургер меню */
.burger {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.burger:hover { 
    transform: translateY(-1px);
    background: rgba(255,255,255,0.08);
}

.burger:active { 
    transform: translateY(0);
}

.burger span {
    position: absolute;
    width: 18px;
    height: 2px;
    background: rgba(255,255,255,0.9);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease, top 0.25s ease;
}

.burger span:nth-child(1) { top: 15px; }
.burger span:nth-child(2) { top: 21px; }
.burger span:nth-child(3) { top: 27px; }

.burger.active span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.burger.active span:nth-child(2) {
    opacity: 0;
}
.burger.active span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Контейнер мобильного меню */
.mobile-menu {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 1700;
}

.mobile-menu.is-open { 
    display: block; 
}

.mobile-menu__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8,10,14,0.55);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu.is-open .mobile-menu__backdrop { 
    opacity: 1; 
}

.mobile-menu__panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: min(560px, 92vw);
    height: auto;
    max-height: 86vh;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    transform: translateY(-16px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(.2,.8,.2,1), opacity 0.25s ease;
    padding: 16px 10px;
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    overflow-y: auto;
}

.mobile-menu.is-open .mobile-menu__panel {
    transform: translateY(18px);
    opacity: 1;
}

.mobile-list {
    list-style: none;
    padding: 6px;
    margin: 0;
}

.mobile-item + .mobile-item { 
    margin-top: 6px; 
}

/* Основные ссылки мобильного меню */
.mobile-link,
.mobile-sublink {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-decoration: none;
    color: rgba(255,255,255,0.92);
    font-size: 16px;
    font-weight: 500;
    padding: 14px 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.mobile-link:hover,
.mobile-sublink:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-1px);
}

/* Стиль для раскрывающихся пунктов */
.mobile-item.has-children > .mobile-link {
    cursor: pointer;
    position: relative;
}

/* Вертикальная линия от родителя к подменю */
.mobile-item.has-children > .mobile-link::after {
    content: "";
    position: absolute;
    left: 20px;
    bottom: -6px;
    width: 2px;
    height: 6px;
    background: rgba(255,255,255,0.18);
    opacity: 0;
    transition: opacity 0.2s;
}

.mobile-item.expanded > .mobile-link::after {
    opacity: 1;
}

.mobile-item.expanded > .mobile-link {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.24);
}

/* Иконка стрелки */
.mobile-chevron {
    width: 18px;
    height: 18px;
    flex: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0.8;
}

.mobile-item.expanded .mobile-chevron {
    transform: rotate(180deg);
    opacity: 1;
}

/* Подменю с визуальными линиями */
.mobile-sublist {
    list-style: none;
    margin: 4px 0 0;
    padding: 4px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-left: 2px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.25s ease;
}

.mobile-item.expanded .mobile-sublist {
    max-height: 320px;
    opacity: 1;
}

.mobile-sublist li + li { 
    margin-top: 4px; 
}

/* Подпункты с точками */
.mobile-sublink {
    font-size: 14px;
    padding: 10px 10px 10px 32px;
    position: relative;
    background: transparent;
    border: none;
}

.mobile-sublink::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    opacity: 0.6;
}

.mobile-sublink:hover {
    background: rgba(255,255,255,0.06);
    transform: none;
    padding-left: 34px;
}

/* КНОПКА ВХОДА В МОБИЛЬНОМ МЕНЮ */
.mobile-item.mobile-login {
    margin-top: 20px;
    padding-top: 20px;
    position: relative;
}

/* Разделительная линия перед входом */
.mobile-item.mobile-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent);
}

.mobile-item.mobile-login .mobile-link {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 13px;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-item.mobile-login .mobile-link:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
}

/* Блокировка скролла */
body.scroll-lock { 
    overflow: hidden; 
}

/* ========================================
   МЕДИА ЗАПРОСЫ
   ======================================== */

/* Планшеты */
@media (max-width: 1024px) {
    .main-navigation { 
        display: none; 
    }
    .site-header { 
        display: flex; 
    }
}

/* Десктоп */
@media (min-width: 1025px) {
    .site-header { 
        display: none; 
    }
}

/* Мобильные устройства */
@media (max-width: 768px) {
    .main-navigation {
        display: none;
    }
    
    .day-night-toggle { 
        top: 18px; 
        right: 75px; 
    }
}

/* Маленькие экраны */
@media (max-width: 480px) {
    .mobile-menu__panel {
        width: 95vw;
        padding: 12px 8px;
    }
    
    .mobile-link {
        font-size: 14px;
        padding: 12px;
    }
    
    .mobile-sublink {
        font-size: 13px;
        padding: 8px 8px 8px 28px;
    }
}

/* ========================================
   АНИМАЦИИ И ЭФФЕКТЫ
   ======================================== */

/* Плавное появление элементов навигации */
@keyframes navItemFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-item {
    animation: navItemFadeIn 0.5s ease forwards;
    opacity: 0;
}

.nav-item:nth-child(1) { animation-delay: 0.1s; }
.nav-item:nth-child(2) { animation-delay: 0.15s; }
.nav-item:nth-child(3) { animation-delay: 0.2s; }
.nav-item:nth-child(4) { animation-delay: 0.25s; }
.nav-item:nth-child(5) { animation-delay: 0.3s; }

/* Микроанимация для кнопки входа */
@keyframes subtlePulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.nav-login .nav-link {
    animation: subtlePulse 4s ease-in-out infinite;
    animation-delay: 5s;
}

.nav-login .nav-link:hover {
    animation: none;
}

/* ========================================
   НОЧНОЙ РЕЖИМ
   ======================================== */

body.night-mode .nav-container {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

body.night-mode .nav-link {
    color: rgba(255, 255, 255, 0.8);
}

body.night-mode .nav-login .nav-link {
    border-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
}

body.night-mode .nav-dropdown {
    background: rgba(15, 15, 20, 0.95);
    border-color: rgba(255, 255, 255, 0.08);
}

body.night-mode .mobile-menu__panel {
    background: rgba(20, 20, 30, 0.95);
}

body.night-mode .mobile-link,
body.night-mode .mobile-sublink {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.08);
}