/* 导航栏样式 */
.nav-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 1rem;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: flex-end; /* 将菜单按钮放到右边 */
}

/* PC端导航样式 */
.nav-menu {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    transition: all 0.3s ease;
}

.nav-item {
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    padding: 0.5rem 1rem;
    transition: color 0.3s ease;
    position: relative; /* 添加相对定位 */
}

.nav-item:hover {
    color: #ffd700;
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #FFD700;
    transition: width 0.3s ease;
}

.nav-item:hover::after {
    width: 100%;
}

/* 移动端菜单按钮 */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    margin-left: auto; /* 确保按钮在右侧 */
}

.menu-toggle span {
    width: 100%;
    height: 3px;
    background-color: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

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

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* 移动端样式 */
@media screen and (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh; /* 使用全屏高度 */
        background-color: rgba(0, 0, 0, 0.95);
        flex-direction: column;
        justify-content: center;
        align-items: center; /* 确保水平居中 */
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 60px 20px; /* 添加内边距避免内容贴边 */
        overflow-y: auto; /* 允许滚动 */
        -webkit-overflow-scrolling: touch; /* iOS滚动优化 */
    }

    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: all;
    }

    .nav-item {
        font-size: 1.2rem;
        padding: 1rem 2rem;
        margin: 0.5rem 0; /* 增加垂直间距 */
        width: auto; /* 移除宽度限制 */
        text-align: center;
        white-space: nowrap; /* 防止文字换行 */
    }

    .nav-item::after {
        left: 50%;
        bottom: 5px;
        width: 0;
        transform: translateX(-50%);
    }

    .nav-item:hover::after {
        width: 50%;
    }

    /* 优化滑动手势指示器 */
    .nav-menu::after {
        content: '';
        position: absolute;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background-color: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }

    /* 防止body滚动 */
    body.nav-active {
        overflow: hidden;
    }
}

/* 适配超小屏幕 */
@media screen and (max-width: 320px) {
    .nav-item {
        font-size: 1.1rem;
        padding: 0.8rem 1.5rem;
    }
}

/* 适配横屏模式 */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .nav-menu {
        height: 100vh;
        padding: 40px 20px;
    }

    .nav-item {
        padding: 0.6rem 1.5rem;
        margin: 0.3rem 0;
    }
}
