/**
 * 统一导航栏样式
 * 适用于所有页面
 */

/* 导航栏基础样式 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    height: 64px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid #f0f0f0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
    transition: all 0.3s ease;
}

/* 深色背景页面的导航栏 */
.navbar.dark {
    background: transparent;
    border-bottom: none;
}

.navbar.dark.scrolled {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Logo 品牌 */
.navbar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.navbar-brand img {
    height: 56px;
    width: auto;
    transition: transform 0.2s;
}

.navbar-brand:hover img {
    transform: scale(1.05);
}

/* Logo 文字样式（用于 index 页面） */
.navbar-logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #fff;
    transition: opacity 0.2s;
}

.navbar-brand:hover .navbar-logo-text {
    opacity: 0.8;
}

/* 白色背景页面的 logo 文字 */
.navbar.light .navbar-logo-text {
    color: #000;
}

/* 中间导航链接 */
.navbar-center {
    flex: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
}

.navbar-center a {
    color: #666;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s, transform 0.2s;
    position: relative;
    display: inline-block;
    padding: 8px 0;
}

.navbar-center a:hover {
    color: #000;
    transform: translateY(-1px);
}

/* 下划线动画效果 */
.navbar-center a::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: all 0.3s ease;
    transform: translateX(-50%);
    border-radius: 1px;
}

.navbar-center a:hover::after {
    width: 100%;
}

/* 深色背景的中间导航 */
.navbar.dark .navbar-center a {
    color: rgba(255, 255, 255, 0.7);
}

.navbar.dark .navbar-center a:hover {
    color: #fff;
}

/* 左侧导航区域 */
.navbar-left {
    flex: 1;
    display: flex;
    align-items: center;
}

/* 右侧导航 */
.navbar-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 20px;
}

/* 登录/注册按钮 */
.btn-nav-login {
    color: #000;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: transform 0.2s ease;
    position: relative;
    display: inline-block;
    padding: 8px 0;
}

.btn-nav-login:hover {
    transform: translateY(-1px);
}

/* 下划线动画效果 */
.btn-nav-login::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: all 0.3s ease;
    transform: translateX(-50%);
    border-radius: 1px;
}

.btn-nav-login:hover::after {
    width: 100%;
}

.btn-nav-primary {
    padding: 10px 24px;
    background: #000;
    color: #fff;
    border-radius: 100px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: opacity 0.2s, transform 0.2s;
}

.btn-nav-primary:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

/* 深色背景的按钮 */
.navbar.dark .btn-nav-login {
    color: rgba(255, 255, 255, 0.8);
}

.navbar.dark .btn-nav-primary {
    background: #fff;
    color: #000;
}

/* 积分显示 */
.credits-display:hover {
    background: rgba(0, 0, 0, 0.05);
}

.navbar.dark .credits-display:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 用户头像区域 */
.user-profile-trigger:hover {
    background: rgba(0, 0, 0, 0.05);
}

.navbar.dark .user-profile-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 下拉菜单 hover 效果 */
.dropdown-menu a:hover {
    background: #f7f7f7 !important;
}

/* 创建视频按钮 - 默认深色背景 */
.nav-create-btn {
    background: #1D1D1F !important;
    color: #fff !important;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.nav-create-btn:hover {
    background: #333 !important;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3) !important;
}

.nav-create-btn:active {
    transform: translateY(-1px) scale(1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
}

/* 响应式设计 */
@media (max-width: 900px) {
    .navbar {
        padding: 12px 20px;
        height: auto;
    }

    .navbar-brand img {
        height: 40px;
    }

    .navbar-center {
        display: none;
    }

    .navbar-right {
        gap: 12px;
    }

    .btn-nav-login {
        font-size: 0.85rem;
    }

    .btn-nav-primary {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

@media (max-width: 600px) {
    .navbar {
        padding: 8px 16px;
    }

    .navbar-brand img {
        height: 36px;
    }

    .navbar-right {
        gap: 8px;
    }

    .btn-nav-login {
        display: none;
    }
}



/* ========== 手机端导航栏优化 ========== */

/* 手机端下拉菜单遮罩 - 放在媒体查询外面确保生效 */
.mobile-dropdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-tap-highlight-color: transparent;
}

.mobile-dropdown-overlay.active {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 768px) {
    .navbar {
        padding: 0 16px;
        height: 56px;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
    
    .navbar-brand {
        font-size: 1.25rem !important;
    }
    
    .navbar-center {
        display: none !important;
    }
    
    /* 手机端右侧区域 */
    .navbar-right {
        gap: 10px;
    }
    
    /* 返回按钮样式 */
    .nav-back-btn {
        padding: 8px 12px !important;
        background: #f5f5f7 !important;
        border-radius: 20px !important;
    }
    
    /* 手机端积分显示 */
    .credits-wrapper .credits-display {
        padding: 6px 12px !important;
        background: #f5f5f7 !important;
        border-radius: 100px !important;
    }
    
    /* 手机端用户区域 */
    .user-area .user-profile-trigger {
        padding: 2px !important;
        border-radius: 50% !important;
    }
    
    .user-area .user-profile-trigger img,
    .user-area .user-profile-trigger > div {
        width: 36px !important;
        height: 36px !important;
        border: 2px solid #f0f0f0 !important;
    }
    
    /* 手机端下拉菜单 - 底部弹出 */
    #creditsDropdown,
    #userDropdown {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: none !important;
        border-radius: 24px 24px 0 0 !important;
        padding: 8px 20px 34px 20px !important;
        box-shadow: 0 -10px 50px rgba(0, 0, 0, 0.2) !important;
        border: none !important;
        background: #fff !important;
        z-index: 2000 !important;
        /* 不使用 !important，让 JS 可以控制 */
        transform: translateY(100%);
        opacity: 1;
        visibility: hidden;
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.35s;
    }
    
    #creditsDropdown.active,
    #userDropdown.active {
        transform: translateY(0) !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* 下拉菜单顶部拖动条 */
    #creditsDropdown::before,
    #userDropdown::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: #E0E0E0;
        border-radius: 2px;
        margin: 8px auto 16px;
    }
    
    /* 手机端下拉菜单项 */
    .dropdown-menu a {
        padding: 16px 16px !important;
        font-size: 1rem !important;
        border-radius: 12px !important;
        margin-bottom: 4px;
    }
    
    .dropdown-menu a:active {
        background: #f0f0f0 !important;
        transform: scale(0.98);
    }
    
    /* 未登录状态按钮 */
    .btn-nav-login {
        display: none !important;
    }
    
    .btn-nav-primary {
        padding: 10px 20px !important;
        font-size: 0.9rem !important;
        border-radius: 100px;
    }
}

/* 超小屏幕优化 */
@media (max-width: 375px) {
    .navbar {
        padding: 0 12px;
    }
    
    .navbar-brand {
        font-size: 1.1rem !important;
    }
    
    .credits-wrapper .credits-display {
        padding: 5px 10px !important;
        font-size: 0.85rem !important;
    }
    
    .btn-nav-primary {
        padding: 8px 16px !important;
        font-size: 0.85rem !important;
    }
    
    .navbar-right {
        gap: 6px;
    }
}
