/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 导航栏整体样式 */
.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(245, 245, 245, 0.7);
    /* 灰白色背景，70% 透明度 */
    backdrop-filter: blur(8px);
    /* 添加磨砂玻璃效果 */
    -webkit-backdrop-filter: blur(8px);
    /* 兼容 Safari */
    padding: 10px 20px;
    color: #333;
    /* 深灰色文本，提高可读性 */
    font-family: Arial, sans-serif;
    position: relative;
    z-index: 10;
}

/* 左侧部分样式 */
.left-part {
    display: flex;
    align-items: center;
    z-index: 2;
}

/* logo 样式 */
.logo {
    background-image: url(https://dandan2024-1304667790.cos.ap-guangzhou.myqcloud.com/tools/logo.png);
    width: 40px;
    height: 40px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

/* 移动端菜单开关 (隐藏) */
.mobile-menu-toggle {
    display: none;
}

/* 移动端菜单按钮样式 */
.mobile-menu-button {
    display: none;
    cursor: pointer;
    z-index: 2;
}

.mobile-menu-button .bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: #808080;
    transition: all 0.3s ease;
}

/* 导航菜单内容 */
.mobile-menu-content {
    padding-left:50px;
    display: flex;
    flex: 1;
    justify-content: space-between;
    align-items: center;
}

/* 中间部分样式 */
.middle-part {
    display: flex;
    align-items: center;
}

/* 导航链接样式 */
.nav-link {
    color: white;
    text-decoration: none;
    margin: 0 20px;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: #ccc;
}

/* 右侧部分样式 */
.right-part {
    display: none!important;
    display: flex;
    align-items: center;
}

/* 用户中心链接样式 */
.user-center-link {
    display: flex;
    align-items: center;
    color: #000;
    text-decoration: none;
    margin-right: 10px;
    transition: color 0.3s ease;
}

.user-icon {
    margin-right: 5px;
    font-size: 18px;
}

.user-center-link:hover {
    color: #ccc;
}

/* 登录按钮样式 */
.login-btn {
    padding: 8px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.login-btn:hover {
    background-color: #0056b3;
}

/* 注册按钮样式 */
.register-btn {
    padding: 8px 15px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-left: 10px;
    transition: background-color 0.3s ease;
}

.register-btn:hover {
    background-color: #218838;
}

/* 移动端样式 - 屏幕宽度小于等于768px时 */
@media screen and (max-width: 768px) {
    .nav-header {
        padding: 10px;
    }

    /* 显示移动端菜单按钮 */
    .mobile-menu-button {
        display: block;
    }

    /* 隐藏默认的菜单内容 */
    .mobile-menu-content {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #fff;
        z-index: 1;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    }

    /* 当checkbox被选中时显示菜单内容 */
    .mobile-menu-toggle:checked~.mobile-menu-content {
        display: flex;
    }

    /* 汉堡菜单按钮动画 */
    .mobile-menu-toggle:checked~.mobile-menu-button .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .mobile-menu-toggle:checked~.mobile-menu-button .bar:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle:checked~.mobile-menu-button .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* 移动端菜单内容样式调整 */
    .middle-part {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        padding: 10px 0;
    }

    .nav-link {
        margin: 10px 20px;
        display: block;
    }

    .right-part {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        padding: 10px 0;
        border-top: 1px solid #444;
    }

    .user-center-link {
        margin: 10px 20px;
    }

    .login-btn,
    .register-btn {
        margin: 10px 20px;
        width: calc(100% - 40px);
    }
}


/* 导航栏样式 */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    z-index: 50;
    border-bottom: 1px solid #f0f0f0;
}

.header-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-text {
    font-size: 1.25rem;
    color: #4F7AFF;
}

.site-title {
    font-size: 1rem;
    font-weight: 500;
}

.header-nav {
    display: none;
    /* 移动端导航默认隐藏，通过JavaScript控制显示 */
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: white;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header-nav.active {
    display: flex;
}

.nav-link {
    text-decoration: none;
    padding: 0.5rem 0;
}

.nav-link.active {
    color: #4F7AFF;
    font-weight: 500;
}

.nav-link:not(.active) {
    color: #4B5563;
}

.nav-link:not(.active):hover {
    color: #4F7AFF;
}

/* 移动端导航菜单按钮 */
.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 1.5rem;
    height: 1.25rem;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: #4F7AFF;
    border-radius: 2px;
    transition: all 0.3s ease;
}

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

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

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