/**
 * 通用Header样式
 * 文件: header.css
 * 用途: 顶部工具栏和导航栏样式
 * 最后更新: 2025-10-22
 * 
 * 包含：
 * 1. 顶部工具栏（登录/用户信息）
 * 2. Logo和上传按钮区域
 * 3. 主导航菜单
 * 4. 模态框样式
 * 5. 移动端响应式优化
 */

/* ============================================
   CSS变量定义
   ============================================ */
:root {
    --primary: #c62828;
    --primary-dark: #b71c1c;
    --secondary: #d32f2f;
    --dark: #212121;
    --white: #FFFFFF;
    --gray: #616161;
    --light: #ECF0F1;
}

/* ============================================
   顶部工具栏基础样式
   ============================================ */

.top-toolbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 20px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.welcome-text {
    font-weight: 500;
    letter-spacing: 0.3px;
}

.toolbar-divider {
    color: rgba(255,255,255,0.3);
    margin: 0 5px;
}

.toolbar-link {
    padding: 5px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.toolbar-link:hover {
    background: rgba(255,255,255,0.15);
    transform: translateY(-1px);
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================
   登录注册按钮
   ============================================ */

.auth-btn {
    padding: 6px 16px !important;
    border-radius: 20px !important;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease !important;
    font-size: 14px;
}

.login-btn {
    background: rgba(255,255,255,0.2) !important;
}

.login-btn:hover {
    background: rgba(255,255,255,0.3) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.signup-btn {
    background: linear-gradient(135deg, #ffd89b 0%, #19547b 100%) !important;
}

.signup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* ============================================
   用户信息区域 - 统一按钮样式
   ============================================ */

/* 工具栏按钮统一基础样式 */
.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: white !important;
    text-decoration: none !important;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(255,255,255,0.15);
    transition: all 0.3s ease;
    font-size: 14px;
    cursor: pointer;
}

.toolbar-btn:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* 用户按钮特殊样式 */
.toolbar-btn.user-btn {
    position: relative;
}

.toolbar-btn.user-btn .vip-tag {
    position: absolute;
    top: -6px;
    right: -6px;
    background: linear-gradient(135deg, #ffd89b 0%, #ff8c00 100%);
    color: #fff;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(255,140,0,0.4);
    line-height: 1;
}

/* 积分按钮特殊样式 */
.toolbar-btn.credit-btn {
    background: rgba(255,215,0,0.2);
}

.toolbar-btn.credit-btn:hover {
    background: rgba(255,215,0,0.3);
}

.toolbar-btn .credit-value {
    color: #ffd700;
    font-size: 16px;
    font-weight: 700;
}

/* 退出按钮特殊样式 */
.toolbar-btn.logout-btn:hover {
    background: rgba(255,100,100,0.25);
}

/* 按钮文本 */
.btn-text {
    font-size: 14px;
}

.icon {
    font-style: normal;
}

/* ============================================
   移动端显示控制
   ============================================ */

.mobile-only {
    display: none;
}

/* ============================================
   平板适配 (768px - 1024px)
   ============================================ */

@media (max-width: 1024px) and (min-width: 769px) {
    .top-toolbar .container {
        padding: 10px 18px;
    }
    
    .toolbar-link {
        font-size: 13px;
        padding: 4px 10px;
    }
    
    .welcome-text {
        font-size: 13px;
    }
}

/* ============================================
   移动端适配 (≤768px)
   ============================================ */

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: flex !important;
    }
    
    .top-toolbar {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }
    
    .top-toolbar .container {
        padding: 10px 15px;
        gap: 8px;
    }
    
    .toolbar-right {
        gap: 5px;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .toolbar-right::-webkit-scrollbar {
        display: none;
    }
    
    /* 工具栏按钮移动端优化 */
    .toolbar-btn {
        padding: 5px 10px;
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* 用户名文本 - 移动端限制宽度 */
    .toolbar-btn .btn-text {
        max-width: 60px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .toolbar-btn.user-btn .vip-tag {
        top: -4px;
        right: -4px;
        padding: 2px 5px;
        font-size: 9px;
    }
    
    .auth-btn {
        padding: 5px 12px !important;
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .mobile-welcome {
        font-size: 14px;
        font-weight: 600;
        white-space: nowrap;
    }
    
    /* 移动端图标优化 */
    .icon {
        font-size: 14px;
    }
    
    .credit-value {
        font-size: 14px;
    }
}

/* ============================================
   小屏手机适配 (≤480px)
   ============================================ */

@media (max-width: 480px) {
    .top-toolbar .container {
        padding: 8px 12px;
    }
    
    .mobile-welcome {
        font-size: 13px;
    }
    
    .toolbar-btn {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .auth-btn {
        padding: 4px 10px !important;
        font-size: 12px;
    }
    
    .toolbar-btn.user-btn .vip-tag {
        top: -3px;
        right: -3px;
        padding: 2px 4px;
        font-size: 8px;
    }
    
    .icon {
        font-size: 13px;
    }
    
    .credit-value {
        font-size: 13px;
    }
    
    /* 用户名进一步缩短 */
    .toolbar-btn .btn-text {
        max-width: 50px;
    }
}

/* ============================================
   触摸设备优化
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    .toolbar-link,
    .auth-btn,
    .toolbar-btn {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    /* 增加触摸目标尺寸 */
    .toolbar-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    .auth-btn,
    .toolbar-btn {
        min-height: 44px;
    }
}

/* ============================================
   横屏手机优化
   ============================================ */

@media (max-height: 500px) and (orientation: landscape) {
    .top-toolbar .container {
        padding: 6px 12px;
    }
    
    .toolbar-btn,
    .auth-btn {
        padding: 4px 8px;
        font-size: 12px;
    }
}

/* ============================================
   模态框移动端优化
   ============================================ */

.modal-responsive {
    max-width: 700px;
}

@media (max-width: 768px) {
    .modal-responsive {
        max-width: 95%;
        margin: 0.5rem auto;
    }
    
    .modal-content {
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 15px;
        border-bottom: 1px solid #e9ecef;
    }
    
    .modal-title {
        font-size: 16px;
        font-weight: 600;
    }
    
    .modal-body {
        padding: 15px;
        max-height: calc(100vh - 150px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-footer {
        padding: 12px 15px;
    }
    
    /* 关闭按钮优化 */
    .modal-header .close {
        padding: 1rem;
        margin: -1rem -1rem -1rem auto;
        font-size: 1.5rem;
        opacity: 0.8;
    }
}

@media (max-width: 480px) {
    .modal-responsive {
        max-width: 98%;
        margin: 0.25rem auto;
    }
    
    .modal-header {
        padding: 12px;
    }
    
    .modal-title {
        font-size: 15px;
    }
    
    .modal-body {
        padding: 12px;
        font-size: 14px;
    }
    
    .modal-footer {
        padding: 10px 12px;
    }
}

/* ============================================
   表单元素移动端优化
   ============================================ */

@media (max-width: 768px) {
    .modal-body input[type="text"],
    .modal-body input[type="password"],
    .modal-body input[type="email"],
    .modal-body textarea,
    .modal-body select {
        font-size: 16px !important; /* 防止iOS自动缩放 */
        padding: 10px 12px;
    }
    
    .modal-body .btn {
        padding: 10px 20px;
        font-size: 15px;
        min-height: 44px; /* 触摸友好 */
    }
    
    .modal-body .form-group {
        margin-bottom: 15px;
    }
    
    .modal-body label {
        font-size: 14px;
        margin-bottom: 6px;
    }
}

/* ============================================
   主Header样式（Logo + 导航菜单）
   ============================================ */

.main-header,
.header {
    background: var(--white);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 999;
    padding: 0;
}

/* Logo区域 */
.header-container,
.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

.header-logo,
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: all 0.3s;
}

.header-logo:hover,
.logo:hover {
    transform: scale(1.02);
}

.header-logo img,
.logo img {
    height: 55px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.header-logo-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.logo-title {
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(135deg, #c62828 0%, #b71c1c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
}

.logo-subtitle {
    font-size: 12px;
    color: var(--gray);
    font-weight: 400;
    margin-top: -3px;
}

/* 兼容原有的类名 */
.logo-text {
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(135deg, #c62828 0%, #b71c1c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
}

.logo-slogan {
    font-size: 12px;
    color: var(--gray);
    margin-top: -3px;
}

/* 上传按钮区域 */
.header-actions,
.nav-actions {
    display: flex;
    gap: 15px;
}

.btn-upload,
.btn.btn-primary {
    padding: 12px 24px;
    background: linear-gradient(135deg, #d32f2f 0%, #e53935 100%);
    color: white !important;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.25);
}

.btn-upload:hover,
.btn.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.35);
    background: linear-gradient(135deg, #2980B9 0%, #2471A3 100%);
}

/* 主导航菜单 */
.main-nav,
.nav-menu {
    background: linear-gradient(135deg, #e53935 0%, #d32f2f 100%);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
    overflow: hidden;
    border-radius: 0;
}

.main-nav .container {
    padding: 0;
}

.nav-links,
.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0;
}

.nav-links li,
.nav-menu li {
    margin: 0;
    position: relative;
}

.nav-links a,
.nav-menu a {
    display: block;
    padding: 16px 32px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s ease;
    border-right: 1px solid rgba(255,255,255,0.15);
    white-space: nowrap;
}

.nav-links li:last-child a,
.nav-menu li:last-child a {
    border-right: none;
}

.nav-links a:hover,
.nav-menu a:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-3px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.nav-links a.active,
.nav-menu a.active {
    background: rgba(255, 255, 255, 0.35);
    box-shadow: inset 0 -3px 0 rgba(255,255,255,0.5);
}

/* ============================================
   主Header移动端优化
   ============================================ */

@media (max-width: 768px) {
    .main-header,
    .header {
        position: sticky;
        top: 0;
        z-index: 999;
    }
    
    /* Logo区域移动端 */
    .header-container,
    .nav-container {
        flex-direction: row;
        gap: 10px;
        padding: 12px 0;
        align-items: center;
    }
    
    .header-logo,
    .logo {
        flex: 1;
        justify-content: flex-start;
        gap: 8px;
    }
    
    .header-logo img,
    .logo img {
        height: 40px;
    }
    
    .logo-title,
    .logo-text {
        font-size: 18px;
    }
    
    .logo-subtitle,
    .logo-slogan {
        font-size: 10px;
        display: none; /* 移动端隐藏副标题 */
    }
    
    /* 上传按钮移动端 */
    .header-actions,
    .nav-actions {
        flex: 0 0 auto;
    }
    
    .btn-upload,
    .nav-actions .btn {
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    /* 导航菜单移动端优化 */
    .main-nav .container {
        padding: 0;
    }
    
    .nav-links,
    .nav-menu {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        justify-content: flex-start;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none;  /* IE 10+ */
        border-radius: 0;
    }
    
    .nav-links::-webkit-scrollbar,
    .nav-menu::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }
    
    .nav-links a,
    .nav-menu a {
        padding: 12px 18px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    .nav-links a:hover,
    .nav-menu a:hover {
        transform: none; /* 移动端禁用变换效果 */
    }
}

/* 小屏手机适配 (≤480px) */
@media (max-width: 480px) {
    .header-container,
    .nav-container {
        padding: 10px 0;
    }
    
    .header-logo img,
    .logo img {
        height: 35px;
    }
    
    .logo-title,
    .logo-text {
        font-size: 16px;
    }
    
    .btn-upload,
    .nav-actions .btn {
        padding: 8px 14px;
        font-size: 12px;
    }
    
    .nav-links a,
    .nav-menu a {
        padding: 10px 15px;
        font-size: 12px;
    }
}

