/* 导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.75rem 0; /* 减少垂直padding */
    z-index: 1000; /* 低于移动菜单 */
    transition: transform 0.2s ease;
    height: auto; /* 自适应高度 */
}

.navbar.hidden {
    transform: translateY(-100%);
}

/* 移除不需要的菜单相关样式 */

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 100%;
    padding: 0 2rem;
    margin: 0;
    position: relative; /* 添加相对定位，作为汉堡按钮的参考 */
    overflow: visible; /* 确保导航栏内容完整显示 */
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
        padding-right: 4.5rem; /* 增加右侧填充，为汉堡菜单留出更多空间 */
    }
    
    .navbar {
        padding: 0.6rem 0; /* 在移动设备上进一步减少padding */
    }
    
    .logo {
        max-width: calc(100% - 80px); /* 移动端上为汉堡菜单留出更多空间 */
    }
}

.logo {
    display: flex;
    flex-direction: row;
    align-items: center;
    color: #333;
    font-weight: bold;
    font-size: 1.2rem;
    position: relative;
    gap: 10px; /* Increased from 8px to add more space between icon and text */
    min-width: 0; /* 允许子元素缩小 */
    max-width: calc(100% - 200px); /* 为右侧导航留出更多空间 */
    overflow: visible; /* 确保内容完整显示 */
    cursor: pointer; /* 确保鼠标悬停时显示为可点击状态 */
}

.logo-icon {
    width: 50px; /* Increased from 40px */
    height: 50px; /* Increased from 40px */
    flex-shrink: 0; /* 防止图标被压缩 */
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 4px; /* Increased from 2px to add more vertical space between text elements */
    min-width: 0; /* 允许子元素缩小 */
    max-width: calc(100% - 60px); /* 确保留出空间给图标 */
}

.logo span {
    font-size: 1.2rem; /* Reduced from 1.3rem */
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #4285f4; /* Changed to blue color */
}

.logo-subtitle {
    position: static;
    font-size: 0.85rem; /* Reduced from 0.9rem */
    color: #666;
    font-weight: normal;
    white-space: normal;
    overflow: visible;
    max-width: 100%;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem; /* 进一步减小间距确保有足够空间 */
    position: relative;
    flex-shrink: 0; /* 防止被压缩 */
    min-width: 0; /* 允许内容自适应 */
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 0.75rem; /* 进一步减小间距 */
    overflow: visible; /* 确保可见 */
    flex-shrink: 0; /* 防止导航链接被压缩 */
}

.nav-links a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease, border 0.3s ease, background 0.3s ease;
    border-radius: 8px;
    border: 2px solid transparent;
    padding: 0.25rem 0.5rem; /* 减小内边距 */
    display: block; /* 确保完整显示 */
}

.nav-links a:hover {
    color: #4285f4;
    border: 2px solid transparent;
    background: rgba(66,133,244,0.15);
}

.login-btn {
    background: #4285f4;
    color: white;
    padding: 0.4rem 0.75rem; /* 减小内边距 */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    flex-shrink: 0; /* 防止按钮被压缩 */
}

.login-btn:hover {
    background: #3b78e7; /* 稍暗一点的蓝色，与移动版一致 */
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* 汉堡菜单包装器 - 确保汉堡菜单按钮始终在顶层 */
.hamburger-wrapper {
    position: absolute; /* 改为绝对定位 */
    top: 50%; /* 垂直居中 */
    right: 1rem; /* 右侧1rem */
    width: 60px;
    height: 60px;
    z-index: 2000; /* 极高的z-index，确保在所有元素之上 */
    display: none; /* 默认不显示 */
    justify-content: center;
    align-items: center;
    pointer-events: none; /* 默认不接收点击事件 */
    transition: opacity 0.3s ease, visibility 0.3s ease; /* 添加平滑过渡 */
    transform: translateY(-50%); /* 垂直居中调整 */
}

/* 菜单内的汉堡按钮包装器 */
.hamburger-wrapper-menu {
    position: fixed;
    top: 1rem;
    right: 1rem;
    transform: none;
    z-index: 2100; /* 确保在菜单之上 */
    display: none;
    background: transparent;
}

/* 在移动端视图下且菜单打开时显示菜单内的关闭按钮 */
@media (max-width: 768px) {
    .mobile-menu.active .hamburger-wrapper-menu {
        display: flex;
    }
    
    /* 当菜单打开时隐藏导航栏中的汉堡按钮 */
    .mobile-menu.active ~ .navbar .hamburger-wrapper {
        display: none;
    }
}

/* 只有在移动设备视图下才显示汉堡按钮包装器 */
@media (max-width: 768px) {
    .hamburger-wrapper {
        display: flex;
        right: 0.75rem; /* 调整位置，确保不会重叠 */
    }
}

/* 汉堡菜单按钮 */
.hamburger {
    display: none; /* 默认不显示 */
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
    padding: 8px;
    transition: all 0.3s ease, display 0s; /* 添加过渡效果，但display无需过渡 */
    border-radius: 50%;
    width: 40px;
    height: 40px;
    justify-content: center;
    align-items: center;
    background: transparent; /* 改为透明背景 */
    box-shadow: none; /* 移除阴影 */
    pointer-events: auto; /* 确保可以接收点击事件 */
}

/* 移动视图中显示汉堡按钮 */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }
    
    /* 移动端视图中调整登录按钮的样式 */
    .nav-right .login-btn {
        padding: 0.5rem 0.75rem; /* 减少水平内边距 */
        font-size: 13px; /* 略微减小字体大小 */
        margin-right: 60px; /* 增加右侧外边距，为汉堡菜单留出足够空间 */
    }
    
    /* 在非常小的屏幕上进一步调整 */
    @media (max-width: 360px) {
        .nav-right .login-btn {
            padding: 0.4rem 0.6rem; /* 进一步减少内边距 */
            font-size: 12px; /* 进一步减小字体 */
        }
        
        .logo-subtitle {
            font-size: 0.8rem; /* Smaller font on very small screens but still visible */
            max-width: 100%; /* Ensure full width available */
            white-space: normal; /* Allow wrapping */
        }
    }
}

.hamburger:hover {
    background: transparent; /* 移除悬停时的背景 */
    box-shadow: none; /* 移除悬停时的阴影 */
}

.hamburger.active {
    background: transparent; /* 移除激活状态的背景 */
    box-shadow: none; /* 移除激活状态的阴影 */
}

/* 具体针对菜单内的关闭按钮 */
.hamburger-menu:hover,
.hamburger-menu.active {
    background: transparent;
    box-shadow: none;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: #333;
    transition: all 0.3s cubic-bezier(.68,-0.55,.27,1.55);
    transform-origin: center;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* 保持汉堡菜单按钮的文字颜色 */
.hamburger.active span {
    background: #333;
}

/* 移动菜单打开时的body样式 */
body.modal-open {
    overflow: hidden; /* 防止背景滚动 */
    position: fixed;
    width: 100%;
    height: 100%;
}

/* 移动菜单 */
.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%; /* 全屏宽度 */
    max-width: none;
    height: 100%;
    background: rgba(255, 255, 255, 0.98); /* 稍微透明一点，减轻闷感 */
    z-index: 1900; /* 高于导航栏，但低于汉堡按钮包装器 */
    visibility: hidden;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateX(100%); /* 初始位置在屏幕右侧 */
    box-shadow: none; /* 全屏不需要阴影 */
    overflow: hidden;
}

.mobile-menu.active {
    visibility: visible;
    opacity: 1;
    transform: translateX(0); /* 移动到可见位置 */
}

.mobile-menu.closing {
    visibility: visible;
    opacity: 0;
    transform: translateX(100%); /* 移回屏幕右侧 */
}

/* 菜单项动画调整 */
.mobile-menu-items {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.4s ease 0.1s;
    width: 100%;
    max-width: 300px; /* 限制菜单宽度，避免在大屏幕上过宽 */
    margin-top: 40px; /* 增加更多顶部间距，避开汉堡按钮区域 */
}

/* 菜单项动画状态类 */
.mobile-menu.active .mobile-menu-items {
    opacity: 1;
    transform: translateX(0);
}

.mobile-menu.closing .mobile-menu-items {
    opacity: 0;
    transform: translateX(30px);
    transition-delay: 0s;
}

/* 修改所有菜单项样式，使宽度一致 */
.mobile-menu-items a,
.mobile-menu-items button:not(.mobile-login) {
    color: #333;
    text-decoration: none;
    font-size: 1.3rem;
    transition: all 0.3s ease;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    width: 200px; /* 固定宽度 */
    text-align: center; /* 文本居中 */
    display: block; /* 确保块级显示 */
}

/* 普通菜单项悬停效果 */
.mobile-menu-items a:hover,
.mobile-menu-items button:not(.mobile-login):hover {
    background: rgba(66, 133, 244, 0.1);
    transform: translateY(-2px);
    color: #4285f4;
}

/* 登录按钮包装元素 */
.mobile-login-wrapper {
    width: 200px;
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 登录按钮特殊样式 */
.mobile-login {
    font-size: 1.1rem !important;
    padding: 0.75rem 0 !important;
    background-color: #4285f4;
    color: white !important;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%; /* 使用100%宽度填充父容器 */
    text-align: center; /* 文本居中 */
    display: flex; /* 使用flex布局 */
    justify-content: center; /* 水平居中 */
    align-items: center; /* 垂直居中 */
    border-radius: 8px;
    line-height: 1.5;
    height: 48px; /* 固定高度 */
    position: relative; /* 添加相对定位 */
    z-index: 1; /* 确保在最上层 */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* 添加阴影效果 */
}

/* 登录按钮悬停效果 - 更温和的颜色变化 */
.mobile-login:hover {
    background-color: #3b78e7; /* 稍暗一点的蓝色 */
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* 轻微阴影增强 */
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    
    /* 登录按钮的显示/隐藏完全由JavaScript控制，不在CSS中强制隐藏 */
    
    .nav-container {
        padding: 0 1rem;
        position: relative; /* 确保相对定位，使汉堡菜单定位正确 */
    }

    .navbar {
        padding: 0.6rem 0; /* 在移动设备上进一步减少padding */
    }

    .nav-right {
        gap: 0.75rem;
        position: relative; /* 确保相对定位 */
        padding-right: 45px; /* 为汉堡菜单预留空间 */
    }
}

/* 动画关键帧 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* 新增从右到左滑动动画 */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0.5;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0.5;
    }
}
/* 移动菜单内容容器 */
.mobile-menu-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    padding: 2rem;
    padding-top: 80px; /* 为顶部汉堡菜单留出空间 */
    position: relative; /* 添加相对定位 */
    z-index: 1950; /* 比.mobile-menu高，但比hamburger-wrapper低 */
    overflow-y: auto; /* 允许内容滚动 */
    overflow-x: hidden; /* 防止水平滚动 */
}

/* 添加顶部安全区域，确保不会遮挡汉堡按钮 */
.mobile-menu-content::before {
    content: "";
    display: block;
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    pointer-events: none; /* 允许点击穿透到汉堡按钮 */
}
