/* nav.css - 导航栏独立样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', Arial, sans-serif;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* 导航栏主样式 */
.navbar {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px 0;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 999;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: 50px;
}

.nav-links {
    display: flex;
    list-style: none;
}

.nav-links li {
    margin: 0 15px;
    position: relative;
}

.nav-links li a {
    font-weight: 500;
    display: block;
    padding: 20px 15px;
    text-decoration: none;
    color: #333;
    transition: color 0.3s;
}

.nav-links li a:hover {
    color: #1a73e8;
}

.nav-links li a.active {
    color: #1a73e8;
    border-bottom: 2px solid #1a73e8;
}

/* 下拉菜单样式 */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #fff;
    min-width: 220px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-radius: 0 0 4px 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
	overflow:hidden;
}

.dropdown-menu li {
    width: 100%;
}

.dropdown-menu li a {
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
}

.dropdown-menu li:last-child a {
    border-bottom: none;
}

.dropdown-menu li a:hover {
    background-color: #f8f9fa;
    color: #1a73e8;
}

/* 鼠标悬停时显示下拉菜单（桌面端） */
.nav-links li:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 汉堡按钮默认样式（仅移动端显示） */
.mobile-menu-btn {
    display: none; /* 桌面端隐藏 */
    font-size: 1.5rem;
    color: #333;
    cursor: pointer;
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 20px; /* 和主导航拉开间距 */
    flex-shrink: 0; /* 防止导航项多时按钮被挤压 */
}

.btn-login,
.btn-register {
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    white-space: nowrap;
    line-height: 1.5;
}

.btn-login {
    color: #333;
}

.btn-login:hover {
    color: #1a73e8;
}

.btn-register {
    background: #1a73e8;
    color: #fff;
}

.btn-register:hover {
    background: #0d47a1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
}

/* 移动端菜单里的登录注册，桌面端隐藏 */
.mobile-only {
    display: none;
}

/* 移动端响应式样式 */
@media (max-width: 768px) {
    /* 显示汉堡按钮 */
    .mobile-menu-btn {
        display: block;
    }

    /* 导航容器样式 */
    .nav-container {
        flex-direction: row;
        justify-content: space-between;
        padding: 10px 20px;
    }

    /* 导航链接：默认隐藏 */
    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 100%;
        left: 0;
        background: #fff;
        box-shadow: 0 5px 10px rgba(0,0,0,0.1);
        padding: 10px 0;
        align-items: stretch; /* 移动端重置对齐 */
    }

    /* 点击汉堡按钮后显示 */
    .nav-links.active {
        display: flex;
    }

    .nav-links li {
        margin: 0;
        width: 100%;
    }

    .nav-links li a {
        padding: 12px 15px;
        border-bottom: 1px solid #f0f0f0;
    }

    /* 移动端下拉菜单 */
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        display: none;
        width: 100%;
        background: #f8f9fa;
    }

    .nav-links li:hover .dropdown-menu,
    .nav-links li:focus-within .dropdown-menu {
        display: block;
    }

    /* ========== 新增：移动端适配 ========== */
    /* 隐藏桌面端按钮 */
    .user-nav {
        display: none;
    }

    /* 显示移动端菜单里的登录注册 */
    .mobile-only {
        display: block;
    }

    .mobile-only a {
        font-weight: 600;
        color: #1a73e8;
    }
}
/* 移动端响应式样式（修复闭合+去重） */
@media (max-width: 768px) {
    /* 显示汉堡按钮 */
    .mobile-menu-btn {
        display: block;
    }

    /* 导航容器样式 */
    .nav-container {
        flex-direction: row;
        justify-content: space-between;
        padding: 10px 20px;
    }

    /* 导航链接：默认隐藏，active 显示（只写一次！） */
    .nav-links {
        display: none; /* 默认隐藏 */
        flex-direction: column; /* 垂直排列 */
        width: 100%; /* 铺满宽度 */
        position: absolute; /* 绝对定位在导航栏下方 */
        top: 100%;
        left: 0;
        background: #fff;
        box-shadow: 0 5px 10px rgba(0,0,0,0.1);
        padding: 10px 0;
    }

    /* 点击汉堡按钮后，添加 .active 类显示 */
    .nav-links.active {
        display: flex;
    }

    /* 移动端导航链接内边距 */
	 .nav-links li {
                margin: 0;
                width: 100%;
            }
    .nav-links li a {
        padding: 12px 15px;
		 border-bottom: 1px solid #f0f0f0;
    }

    /* 移动端下拉菜单 */
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        display: none;
        width: 100%;
        background: #f8f9fa;
    }

    /* 移动端hover显示下拉菜单 */
    .nav-links li:hover .dropdown-menu,
	.nav-links li:focus-within .dropdown-menu{
        display: block;
    }
}