/* 统一导航栏样式 */
.navbar {
    background-color: rgba(44, 62, 80, 0.7);
    padding: 1rem 2rem;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    transition: transform 0.3s ease-in-out, background-color 0.3s ease;
}

.navbar.scrolled {
    background-color: rgba(44, 62, 80, 0.7);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar.nav-hidden {
    transform: translateY(-100%);
}

.nav-container {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
    padding-right: 20px; /* 为右侧按钮预留空间 */
    transform: translateX(250px); /* 整体右移，使首页位于中间 */
}

.auth-buttons {
    display: flex;
    gap: 0.5rem;
    position: absolute;
    right: 2rem;
}

.auth-buttons a {
    color: white;
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.login-btn {
    background: transparent;
    border: 1px solid white;
}

.login-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

:root {
    --primary-color: #3498db;
    --primary-color-dark: #2980b9;
    --secondary-color: #2ecc71;
    --hover-color: rgba(255, 255, 255, 0.1);
}

.register-btn {
    background: var(--primary-color);
}

.register-btn:hover {
    background: var(--primary-color-dark);
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    transition: color 0.3s;
    margin-right: auto;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 3rem;
}

.nav-links a {
    text-decoration: none;
    color: white;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--secondary-color);
}

/* 汉堡菜单按钮 */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
    position: relative;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
        justify-content: space-between;
        align-items: center;
        box-sizing: border-box;
    }

    .nav-container {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        height: 100vh;
        background-color: rgba(44, 62, 80, 0.98);
        padding: 80px 2rem 2rem;
        transition: all 0.3s ease;
        flex-direction: column;
        z-index: 1000;
        justify-content: flex-start;
        transform: none; /* 移除在移动端的右移 */
        padding-right: 0; /* 移除在移动端的右边距 */
    }

    .auth-buttons {
        display: none; /* 在移动端隐藏按钮 */
    }
    
    .menu-toggle {
        display: flex;
    }

    .nav-container.active {
        right: 0;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
    }

    .nav-container:not(.active) {
        visibility: hidden;
    }

    .nav-container.active {
        visibility: visible;
    }

    .nav-links {
        flex-direction: column;
        gap: 1.5rem;
        align-items: center;
        width: 100%;
        padding: 0;
        margin: 0;
    }

    .nav-links a {
        font-size: 1.1rem;
        width: 100%;
        text-align: center;
        padding: 0.5rem 0;
        color: rgba(255, 255, 255, 0.9);
    }

    .nav-links a:hover {
        color: white;
        background: rgba(255, 255, 255, 0.1);
    }

    body.menu-open {
        overflow: hidden;
    }
}
