/* ========================================
   导航栏美化与优化 CSS
   ======================================== */

/* 导航栏容器 */
.header {
    position: relative;
    z-index: 999;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95) 0%, rgba(20, 20, 30, 0.95) 100%);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.header.can-sticky {
    position: sticky;
    top: 0;
}

.header.is-sticky {
    padding: 10px 0;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

/* Logo 样式 */
.header .logo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    height: 50px;
}

.header .logo a {
    display: flex;
    align-items: center;
    transition: transform 0.3s ease;
}

.header .logo a:hover {
    transform: scale(1.05);
}

.header .logo img {
    height: 50px;
    max-width: 200px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

/* 导航菜单 */
.navigation {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.main-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    gap: 5px;
}

.menu-item {
    position: relative;
    padding: 0;
}

.menu-item > a {
    display: block;
    padding: 12px 18px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 4px;
    position: relative;
    white-space: nowrap;
}

.menu-item > a:before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #4a9eff, #fff);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.menu-item > a:hover {
    background-color: rgba(74, 158, 255, 0.1);
    color: #4a9eff;
}

.menu-item > a:hover:before {
    transform: scaleX(1);
}

.menu-item.active > a {
    background-color: rgba(74, 158, 255, 0.2);
    color: #4a9eff;
}

.menu-item.active > a:before {
    transform: scaleX(1);
}

/* 下拉菜单 */
.menu-item-has-children {
    position: relative;
}

.sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(20, 20, 30, 0.98);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 8px;
    list-style: none;
    margin: 10px 0 0 0;
    padding: 10px 0;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.menu-item-has-children:hover .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sub-menu .menu-item {
    padding: 0;
}

.sub-menu .menu-item a {
    display: block;
    padding: 12px 20px;
    color: #e0e0e0;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.sub-menu .menu-item a:hover {
    background-color: rgba(74, 158, 255, 0.2);
    color: #4a9eff;
    border-left-color: #4a9eff;
    padding-left: 25px;
}

/* 头部操作按钮 */
.header_action {
    flex: 0 0 auto;
    margin-left: 20px;
}

.header_btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    background: linear-gradient(135deg, #4a9eff, #3a7edf);
    color: #fff;
    text-decoration: none;
    border-radius: 24px;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.3);
    border: none;
    cursor: pointer;
}

.header_btn:hover {
    background: linear-gradient(135deg, #3a7edf, #2a5ebf);
    box-shadow: 0 6px 25px rgba(74, 158, 255, 0.5);
    transform: translateY(-2px);
}

.header_btn:active {
    transform: translateY(0);
}

.button_title {
    display: inline-block;
}

/* 汉堡菜单按钮 */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 6px;
    padding: 10px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.hamburger:hover {
    background-color: rgba(74, 158, 255, 0.1);
}

.hamburger_btn {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hamburger_btn span {
    width: 25px;
    height: 2px;
    background-color: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.active .hamburger_btn span:nth-child(1) {
    transform: rotate(45deg) translate(10px, 10px);
}

.hamburger.active .hamburger_btn span:nth-child(2) {
    opacity: 0;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .header {
        padding: 10px 0;
    }

    .header .inner {
        flex-wrap: wrap;
    }

    .hamburger {
        display: flex;
        order: 3;
        margin-left: auto;
    }

    .navigation {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: rgba(20, 20, 30, 0.98);
        border-bottom: 1px solid rgba(74, 158, 255, 0.3);
        border-radius: 0 0 8px 8px;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        z-index: 100;
        backdrop-filter: blur(10px);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    }

    .header.mobile-menu-open .navigation {
        max-height: 600px;
    }

    .main-menu {
        flex-direction: column;
        width: 100%;
        gap: 0;
        align-items: stretch;
    }

    .menu-item {
        border-bottom: 1px solid rgba(74, 158, 255, 0.1);
    }

    .menu-item > a {
        border-radius: 0;
        padding: 15px 20px;
        text-align: left;
    }

    .menu-item > a:before {
        display: none;
    }

    .menu-item > a:hover {
        padding-left: 25px;
    }

    .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        background: transparent;
        border: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        box-shadow: none;
        backdrop-filter: none;
        margin: 0;
        padding: 0;
    }

    .menu-item-has-children.active .sub-menu {
        max-height: 500px;
    }

    .sub-menu .menu-item a {
        padding: 12px 40px;
        font-size: 13px;
        border-left: 3px solid transparent;
    }

    .sub-menu .menu-item a:hover {
        border-left-color: #4a9eff;
    }

    .header_action {
        width: 100%;
        margin: 15px 20px;
    }

    .header_btn {
        width: 100%;
    }

    .logo {
        flex-basis: 100%;
        order: 1;
    }

    .navigation {
        order: 2;
    }
}

@media (max-width: 576px) {
    .menu-item > a {
        padding: 12px 15px;
        font-size: 13px;
    }

    .header_btn {
        padding: 10px 20px;
        font-size: 12px;
    }

    .header .logo img {
        height: 40px;
    }
}

/* 平滑滚动效果 */
html {
    scroll-behavior: smooth;
}

/* 焦点状态和键盘导航 */
.menu-item > a:focus,
.header_btn:focus {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
}

/* 动画延迟 */
.menu-item {
    animation: slideInDown 0.5s ease backwards;
}

.menu-item:nth-child(1) { animation-delay: 0s; }
.menu-item:nth-child(2) { animation-delay: 0.1s; }
.menu-item:nth-child(3) { animation-delay: 0.2s; }
.menu-item:nth-child(4) { animation-delay: 0.3s; }
.menu-item:nth-child(5) { animation-delay: 0.4s; }

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
