/* 导航栏样式 */
.main-nav {
    background: #2d5aa0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1000;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: block;
    padding: 15px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.nav-link:hover,
.nav-link.active {
    background: #3a6bb8;
    border-bottom-color: #ffd700;
    color: white;
}

/* 子菜单样式 */
.nav-item.has-submenu::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid #ffffff;
    transition: transform 0.3s ease;
}

.nav-item.has-submenu.show-submenu::after {
    transform: translateY(-50%) rotate(180deg);
}

.submenu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-top: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    list-style: none;
    margin: 0;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.nav-item.show-submenu .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.submenu li {
    border-bottom: 1px solid #f0f0f0;
}

.submenu li:last-child {
    border-bottom: none;
}

.submenu a {
    display: block;
    padding: 12px 20px;
    color: #333333;
    text-decoration: none;
    font-size: 15px;
    transition: all 0.3s ease;
}

.submenu a:hover {
    background: #f8f9fa;
    color: #4a7bc8;
    padding-left: 25px;
}

/* 辅助功能链接 */
.nav-auxiliary {
    display: flex;
    gap: 10px;
}

.aux-link {
    padding: 8px 12px;
    color: #ffffff;
    text-decoration: none;
    font-size: 15px;
    border: 1px solid #ffffff;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.aux-link:hover {
    background: #ffffff;
    color: #4a7bc8;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1002;
}

.mobile-menu-btn span {
    width: 100%;
    height: 3px;
    background: #2d5aa0;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .nav-link {
        padding: 15px 16px;
        font-size: 15px;
    }
}

@media (max-width: 992px) {
    .nav-link {
        padding: 15px 12px;
        font-size: 15px;
    }
    
    .nav-auxiliary {
        display: none;
    }
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }
    
    .main-nav {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        height: 100vh;
        background: #003d82;
        transition: left 0.3s ease;
        overflow-y: auto;
        z-index: 1001;
    }
    
    .main-nav.mobile-open {
        left: 0;
    }
    
    .nav-content {
        flex-direction: column;
        align-items: stretch;
        padding-top: 60px;
    }
    
    .nav-list {
        flex-direction: column;
    }
    
    .nav-item {
        border-bottom: 1px solid #0056b3;
    }
    
    .nav-link {
        padding: 20px;
        border-bottom: none;
    }
    
    .nav-item.has-submenu::after {
        right: 20px;
    }
    
    .submenu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        background: #0056b3;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .nav-item.show-submenu .submenu {
        max-height: 300px;
    }
    
    .submenu a {
        color: #ffffff;
        padding-left: 40px;
    }
    
    .submenu a:hover {
        background: #004494;
        color: #ffffff;
        padding-left: 45px;
    }
    
    .nav-auxiliary {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 20px;
        border-top: 1px solid #0056b3;
    }
    
    .aux-link {
        text-align: center;
    }
}

/* 移动端遮罩层 */
@media (max-width: 768px) {
    .main-nav.mobile-open::before {
        content: '';
        position: fixed;
        top: 0;
        right: 0;
        width: 20%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }
}

/* 导航栏动画效果 */
.nav-item {
    transition: all 0.3s ease;
}

.nav-item:hover {
    transform: translateY(-2px);
}

/* 活动状态指示器 */
.nav-link.active::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: #ffd700;
    animation: expandWidth 0.3s ease forwards;
}

@keyframes expandWidth {
    to {
        width: 80%;
    }
}

/* 无障碍支持 */
.nav-link:focus,
.aux-link:focus,
.submenu a:focus {
    outline: 2px solid #ffd700;
    outline-offset: 2px;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .main-nav {
        border-bottom: 2px solid #000000;
    }
    
    .nav-link {
        border: 1px solid transparent;
    }
    
    .nav-link:hover,
    .nav-link.active {
        border-color: #ffffff;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    .nav-link,
    .submenu,
    .mobile-menu-btn span,
    .nav-item {
        transition: none;
    }
    
    .nav-link.active::before {
        animation: none;
        width: 80%;
    }
}