/* 导航栏整体容器 */
.navbar-container {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}
.nav-links li {
    margin: 0 1rem;
}

/* 主导航栏 */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 2rem;
}

/* Logo styling */
.logo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.logo a {
    display: flex; /* Ensure the link itself is a flex container */
    align-items: center; /* Vertically center the image within the link */
}

.logo img {
    height: 40px;
    border-radius: 10px;
}

/* 导航链接容器样式 */
.nav-links {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nav-links ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    justify-content: center;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--nav-text);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--nav-active);
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--nav-active);
    transition: width 0.3s;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

/* 用户头像样式 */
.navbar-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.user-avatar-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.nav-avatar.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--nav-active);
    transition: transform 0.3s, box-shadow 0.3s;
}

.nav-avatar.user-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    font-size: 1.5rem;
    background: none;
    border: none;
    color: #1a1a1a;
    cursor: pointer;
    transition: color 0.2s ease;
}

/* 暗色模式样式 */
html.dark .navbar-container {
    background-color: #1a1a1a;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

html.dark .nav-links a {
    color: #e0e0e0;
}

html.dark .nav-links a:hover,
html.dark .nav-links a.active {
    color: #4a90e2;
}

html.dark .language-btn,
html.dark .theme-toggle {
    color: #e0e0e0;
}

html.dark .language-btn:hover,
html.dark .theme-toggle:hover {
    color: #4a90e2;
}

html.dark .theme-toggle i {
    color: #e0e0e0;
}

html.dark .mobile-menu-btn {
    color: #e0e0e0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 1rem;
    }
    
    .nav-links {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        height: calc(100vh - 70px);
        background-color: white;
        transform: translateX(-100%);
        opacity: 0;
        transition: transform 0.3s ease, opacity 0.3s ease, background-color 0.3s ease;
        display: flex;
        justify-content: center;
        align-items: flex-start;
    }
    
    /* 添加暗色模式下移动导航栏的背景颜色 */
    html.dark .nav-links {
        background-color: #1a1a1a;
    }
    
    .nav-links.active {
        transform: translateX(0);
        opacity: 1;
    }
    
    .nav-links ul {
        flex-direction: column;
        padding: 2rem;
    }
    
    .nav-links li {
        margin: 1rem 0;
    }
    
    .mobile-menu-btn {
        display: block;
    }
}

/* 小屏幕设备的响应式设计 */
@media (max-width: 480px) {
    .navbar {
        padding: 0.3rem 0.8rem;
    }

    .logo img {
        height: 32px;
    }

    .nav-links a {
        font-size: 0.9rem;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
    }
}