/* 统一的前端导航栏样式 */
/* 所有前端页面都应该引入这个CSS文件 */

/* 顶部导航栏 */
.top-navbar {
    background: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding: 0;
    margin: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    height: 72px;
    position: relative;
}

.navbar-logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.navbar-logo img {
    max-height: 40px;
}

.navbar-logo-text {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.navbar-links {
    display: flex;
    gap: 32px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.navbar-links a {
    color: #1a1a1a;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    padding: 8px 0;
    white-space: nowrap !important;
}

/* 隐藏横向滚动条（仍可滚动） */
.navbar-links::-webkit-scrollbar {
    height: 0;
}
.navbar-links {
    scrollbar-width: none; /* Firefox */
}

.navbar-links a:hover {
    color: #10b981;
}

.navbar-links a.active {
    color: #10b981;
}

.navbar-links a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    margin-right: -190px;
    flex-shrink: 0;
}

.navbar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #10b981;
    flex-shrink: 0;
}

.navbar-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.navbar-user-avatar .avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
}

.navbar-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.navbar-user-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    line-height: 1.2;
    text-decoration: none;
}

.navbar-user-name:hover {
    color: #10b981;
}

.navbar-user-id {
    font-size: 11px;
    color: #999;
    line-height: 1.2;
}

.navbar-user-btn {
    padding: 6px 12px;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

.navbar-user-btn:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.navbar-auth-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
}

.navbar-auth-btn.login {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
}

.navbar-auth-btn.login:hover {
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.navbar-auth-btn.register {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.navbar-auth-btn.register:hover {
    background: #eee;
}

/* 汉堡菜单按钮（移动端） */
.navbar-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.navbar-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #1a1a1a;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.navbar-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.navbar-toggle.active span:nth-child(2) {
    opacity: 0;
}

.navbar-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* 移动端侧边栏菜单（默认隐藏） */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none; /* 默认不阻止点击 */
}

.mobile-nav-overlay.active {
    opacity: 1;
    pointer-events: auto; /* 激活时才阻止点击 */
}

.mobile-nav-sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    max-width: 85%;
    height: 100%;
    background: #fff;
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.mobile-nav-sidebar.active {
    left: 0;
}

.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 1001;
}

.mobile-nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #1a1a1a;
}

.mobile-nav-logo .navbar-logo-text {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mobile-nav-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #1a1a1a;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.mobile-nav-close:hover {
    background: #f3f4f6;
}

.mobile-nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav-links li {
    border-bottom: 1px solid #f3f4f6;
}

.mobile-nav-links a {
    display: block;
    padding: 16px 20px;
    color: #1a1a1a;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mobile-nav-links a:hover,
.mobile-nav-links a.active {
    background: #f0fdf4;
    color: #10b981;
    padding-left: 24px;
}

.mobile-nav-user {
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    margin-top: auto;
}

.mobile-nav-user-logged-in {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f3f4f6;
    margin-bottom: 16px;
}

.mobile-nav-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #10b981;
    flex-shrink: 0;
}

.mobile-nav-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mobile-nav-user-avatar .avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
}

.mobile-nav-user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mobile-nav-user-name {
    font-weight: 600;
    color: #333;
    font-size: 15px;
    text-decoration: none;
}

.mobile-nav-user-id {
    font-size: 12px;
    color: #999;
}

.mobile-nav-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-nav-actions .navbar-auth-btn,
.mobile-nav-actions .navbar-user-btn {
    width: 100%;
    text-align: center;
    padding: 10px 16px;
}

@media (max-width: 768px) {
    .navbar-content {
        padding: 0 20px;
    }
    
    /* 隐藏桌面端导航链接和用户信息 */
    .navbar-links,
    .navbar-user {
        display: none;
    }
    
    /* 显示汉堡菜单按钮 */
    .navbar-toggle {
        display: flex;
    }
    
    /* 显示移动端侧边栏 */
    .mobile-nav-overlay {
        display: block;
    }
    
    .mobile-nav-sidebar {
        display: block;
    }
}

