/**
 * 自定义页眉样式 - 优化版
 * 移动端优化：增大网站名称字体和菜单按钮右边距
 */

.custom-header {
    background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
}

/* 前端页眉包装器 */
.custom-header-wrapper {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    margin-bottom: 0;
    backdrop-filter: blur(10px);
}

/* PC端页眉宽度 */
.custom-header .container-fluid {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
}

.custom-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    gap: 0;
}

/* 布局：左侧Logo，右侧搜索框和用户中心 */
.custom-header-logo {
    flex-shrink: 0;
    margin-right: auto;
}

.custom-header-logo .logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
    font-size: 18px;
    font-weight: 700;
    transition: all 0.3s ease;
    padding: 8px 0;
}

.custom-header-logo .logo-link:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

.custom-header-logo .site-logo {
    height: 42px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    border-radius: 6px;
}

.custom-header-logo .site-name {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 右侧容器 */
.custom-header-right {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-shrink: 0;
    flex-direction: row-reverse;
}

.custom-header-search {
    flex-shrink: 0;
    width: 320px;
}

.custom-header-user {
    flex-shrink: 0;
}

/* 搜索框优化 */
.search-form {
    width: 100%;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.custom-header-search .search-form .search-input-wrapper .search-input,
.custom-header .search-form .search-input-wrapper .search-input,
.search-input-wrapper .search-input {
    width: 100% !important;
    padding: 12px 50px 12px 16px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    font-size: 14px !important;
    background: rgba(255, 255, 255, 0.8) !important;
    transition: all 0.3s ease !important;
    outline: none !important;
    height: 44px !important;
    box-sizing: border-box !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}

.custom-header-search .search-form .search-input-wrapper .search-input:focus,
.custom-header .search-form .search-input-wrapper .search-input:focus,
.search-input-wrapper .search-input:focus {
    background: #fff !important;
    border-color: #667eea !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2) !important;
    transform: translateY(-1px);
}

.custom-header-search .search-form .search-input-wrapper .search-submit,
.custom-header .search-form .search-input-wrapper .search-submit,
.search-input-wrapper .search-submit {
    position: absolute !important;
    right: 6px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: none !important;
    padding: 0 !important;
    color: #fff !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
    z-index: 1 !important;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3) !important;
}

.custom-header-search .search-form .search-input-wrapper .search-submit:hover,
.custom-header .search-form .search-input-wrapper .search-submit:hover,
.search-input-wrapper .search-submit:hover {
    transform: translateY(-50%) scale(1.05) !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
}

.search-submit i {
    font-size: 14px;
    line-height: 1;
}

/* 未登录状态：登录/注册链接 */
.user-auth-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-auth-links a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-auth-links .login-link {
    color: #667eea;
    border: 2px solid #667eea;
    background: transparent;
}

.user-auth-links .login-link:hover {
    background: #667eea;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.user-auth-links .register-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: 2px solid transparent;
}

.user-auth-links .register-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.user-auth-links i {
    font-size: 14px;
}

/* 已登录状态：用户菜单 */
.user-menu-wrapper {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-radius: 25px;
    text-decoration: none;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.user-menu-trigger:hover {
    background: #fff;
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.user-menu-trigger img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e2e8f0;
}

.user-menu-trigger .user-name {
    font-size: 14px;
    font-weight: 600;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-trigger i {
    font-size: 12px;
    color: #64748b;
    transition: transform 0.3s ease;
}

.user-menu-wrapper.active .user-menu-trigger i {
    transform: rotate(180deg);
}

/* 用户下拉菜单 */
.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.user-menu-wrapper.active .user-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid #f1f5f9;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px 16px 0 0;
    color: #fff;
}

.user-menu-header img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-info .user-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-info .user-email {
    font-size: 13px;
    opacity: 0.9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-list {
    list-style: none;
    margin: 0;
    padding: 12px 0;
}

.user-menu-list li {
    margin: 0;
}

.user-menu-list li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: #475569;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.user-menu-list li a:hover {
    background: #f8fafc;
    color: #667eea;
    padding-left: 24px;
}

.user-menu-list li a i {
    width: 18px;
    text-align: center;
    color: #94a3b8;
    transition: color 0.3s ease;
}

.user-menu-list li a:hover i {
    color: #667eea;
}

.user-menu-list li.divider {
    height: 1px;
    background: #f1f5f9;
    margin: 8px 0;
    padding: 0;
}

.user-menu-list li:last-child a {
    color: #ef4444;
}

.user-menu-list li:last-child a:hover {
    background: #fef2f2;
    color: #dc2626;
}

.user-menu-list li:last-child a i {
    color: #ef4444;
}

/* 移动端菜单按钮 */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    position: relative;
    flex-shrink: 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.mobile-menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
    margin: 0 auto;
}

.mobile-menu-toggle.active {
    background: #ef4444;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
    width: 20px;
}

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

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
    width: 20px;
}

/* 移动端菜单遮罩层 */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

/* 移动端菜单内容 */
.mobile-menu-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    border-radius: 0 0 20px 20px;
}

.mobile-menu-overlay.active .mobile-menu-content {
    transform: translateY(0);
}

/* 移动端搜索框 */
.mobile-menu-search {
    padding: 24px 20px 20px;
    border-bottom: 1px solid #f1f5f9;
}

.mobile-menu-search .search-input-wrapper {
    position: relative;
}

.mobile-menu-search .search-input {
    width: 100%;
    padding: 14px 50px 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    background: #fff;
    height: 48px;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.mobile-menu-search .search-submit {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-radius: 8px !important;
    color: #fff !important;
}

/* 移动端用户选项 */
.mobile-menu-user {
    padding: 20px;
}

/* 移动端登录/注册链接 */
.mobile-user-auth-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-user-auth-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid #e2e8f0;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.mobile-user-auth-links .login-link {
    color: #667eea;
    border-color: #667eea;
}

.mobile-user-auth-links .login-link:hover {
    background: #667eea;
    color: #fff;
    transform: translateY(-2px);
}

.mobile-user-auth-links .register-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
}

.mobile-user-auth-links .register-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 移动端用户菜单 */
.mobile-user-menu {
    padding: 0;
}

.mobile-user-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 24px 20px;
    border-bottom: 1px solid #f1f5f9;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.mobile-user-header img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.mobile-user-info {
    flex: 1;
}

.mobile-user-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.mobile-user-email {
    font-size: 14px;
    opacity: 0.9;
}

.mobile-user-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-user-menu-list li {
    border-bottom: 1px solid #f1f5f9;
}

.mobile-user-menu-list li:last-child {
    border-bottom: none;
}

.mobile-user-menu-list li.divider {
    height: 1px;
    background: #f1f5f9;
    margin: 8px 0;
    border: none;
}

.mobile-user-menu-list li a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    text-decoration: none;
    color: #475569;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.mobile-user-menu-list li a:hover {
    background: #f8fafc;
    color: #667eea;
    padding-left: 24px;
}

.mobile-user-menu-list li a i {
    width: 20px;
    text-align: center;
    color: #94a3b8;
}

.mobile-user-menu-list li a:hover i {
    color: #667eea;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .custom-header .container-fluid {
        max-width: 100%;
        padding: 0 30px;
    }
    
    .custom-header-search {
        width: 280px;
    }
}

@media (max-width: 992px) {
    .custom-header .container-fluid {
        padding: 0 20px;
    }
    
    .custom-header-search {
        width: 240px;
    }
}

/* 移动端优化：增大网站名称字体和菜单按钮右边距 */
@media (max-width: 768px) {
    .custom-header .container-fluid {
        padding: 0 16px;
    }

    .custom-header-content {
        height: 70px;
        gap: 10px;
        justify-content: center;
        position: relative;
    }

    .custom-header-logo {
        margin-right: 0;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    /* 增大移动端网站名称字体 */
    .custom-header-logo .site-name {
        font-size: 22px; /* 从18px增加到22px */
        font-weight: 700;
    }

    .custom-header-logo .site-logo {
        height: 38px; /* 稍微增大logo高度 */
    }

    .custom-header-right {
        display: none;
    }

    /* 增大移动端菜单按钮右边距 */
    .mobile-menu-toggle {
        display: flex;
        margin-right: 25px; /* 从0增加到25px */
        margin-left: auto;
    }
    
    .mobile-menu-overlay {
        top: 70px;
    }
}

/* 小屏幕移动设备进一步优化 */
@media (max-width: 480px) {
    .custom-header .container-fluid {
        padding: 0 12px;
    }

    .custom-header-content {
        height: 64px;
    }

    /* 小屏幕上保持较大的网站名称字体 */
    .custom-header-logo .site-name {
        font-size: 20px; /* 在小屏幕上稍微减小，但仍然比原来大 */
    }

    .custom-header-logo .site-logo {
        height: 34px;
    }

    /* 小屏幕上保持较大的菜单按钮右边距 */
    .mobile-menu-toggle {
        width: 34px; /* 稍微增大按钮尺寸 */
        height: 34px;
        margin-right: 20px; /* 在小屏幕上保持较大的右边距 */
    }

    /* 增大三条横杠的尺寸 */
    .mobile-menu-toggle span {
        width: 22px; /* 从20px增加到22px */
        height: 3px; /* 从2px增加到3px，更粗更明显 */
    }

    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(7px, 7px);
        width: 22px;
    }

    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
        width: 22px;
    }
}

/* 超小屏幕设备 */
@media (max-width: 360px) {
    .custom-header-logo .site-name {
        font-size: 18px; /* 在超小屏幕上适当减小 */
    }
    
    .mobile-menu-toggle {
        margin-right: 15px; /* 在超小屏幕上适当减小右边距 */
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-header {
    animation: fadeIn 0.5s ease-out;
}

/* 滚动时的样式 */
.custom-header-wrapper.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(15px);
}

