/**
 * 模块头部组件样式 - 统一设计
 * 用于能力中心和场景中心的头部区域
 * 作者：陕西大模智能科技有限公司
 * 创建时间：2024
 * 设计理念：简洁、美观、稳定、一致性
 */

/* 模块头部容器 - 统一样式，提高特异性以确保一致性 */
.module-header,
.admin-config-container .module-header,
.user-config-container .module-header,
.super-admin-config-container .module-header,
div[id*="admin"] .module-header,
#knowledge-module .module-header,
#capability-module .module-header,
#scenario-module .module-header {
    background: linear-gradient(135deg, 
        rgba(99, 102, 241, 0.08) 0%, 
        rgba(168, 85, 247, 0.08) 50%, 
        rgba(236, 72, 153, 0.08) 100%) !important;
    border-radius: 0 !important;
    padding: 1.73rem 0 !important;
    margin: 0 !important;
    position: relative !important;
    overflow: hidden !important;
    border: none !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    transition: all 0.3s ease !important;
    animation: header-pulse 6s ease-in-out infinite !important;
    box-shadow: none !important;
    min-height: 96px !important;
}

/* 增强的光效动画 - 统一应用到所有模块头部 */
.module-header::before,
.admin-config-container .module-header::before,
.user-config-container .module-header::before,
.super-admin-config-container .module-header::before,
div[id*="admin"] .module-header::before,
#knowledge-module .module-header::before,
#capability-module .module-header::before,
#scenario-module .module-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.06) 30%, 
        rgba(255, 255, 255, 0.12) 50%, 
        rgba(255, 255, 255, 0.06) 70%, 
        transparent 100%);
    animation: gentle-sweep 12s ease-in-out infinite;
    z-index: 1;
}

/* 添加第二层光效 - 统一应用到所有模块头部 */
.module-header::after,
.admin-config-container .module-header::after,
.user-config-container .module-header::after,
.super-admin-config-container .module-header::after,
div[id*="admin"] .module-header::after,
#knowledge-module .module-header::after,
#capability-module .module-header::after,
#scenario-module .module-header::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, 
        rgba(99, 102, 241, 0.03) 0%, 
        rgba(168, 85, 247, 0.02) 30%, 
        transparent 70%);
    animation: radial-glow 12s ease-in-out infinite;
    z-index: 0;
}

/* 径向光晕动画 - 优化减少抖动 */
@keyframes radial-glow {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1) rotate(0deg);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.05) rotate(180deg);
    }
}

@keyframes gentle-sweep {
    0%, 20% {
        left: -100%;
        opacity: 0;
    }
    40%, 60% {
        opacity: 1;
    }
    80%, 100% {
        left: 100%;
        opacity: 0;
    }
}

/* 头部光晕动画已移除 - 去除阴影效果 */

/* 头部脉冲动画 - 优化减少抖动 */
@keyframes header-pulse {
    0%, 100% {
        transform: scale(1);
        border-color: rgba(255, 255, 255, 0.12);
    }
    50% {
        transform: scale(1.001);
        border-color: rgba(255, 255, 255, 0.15);
    }
}

/* 渐变背景动画 */
@keyframes gradient-shift {
    0%, 100% {
        background: linear-gradient(135deg, 
            rgba(99, 102, 241, 0.08) 0%, 
            rgba(168, 85, 247, 0.08) 50%, 
            rgba(236, 72, 153, 0.08) 100%);
    }
    33% {
        background: linear-gradient(135deg, 
            rgba(168, 85, 247, 0.08) 0%, 
            rgba(236, 72, 153, 0.08) 50%, 
            rgba(99, 102, 241, 0.08) 100%);
    }
    66% {
        background: linear-gradient(135deg, 
            rgba(236, 72, 153, 0.08) 0%, 
            rgba(99, 102, 241, 0.08) 50%, 
            rgba(168, 85, 247, 0.08) 100%);
    }
}

/* 头部内容容器 - 统一间距定义，避免不稳定显示 */
.module-header .header-content,
.admin-config-container .module-header .header-content,
.super-admin-config-container .module-header .header-content,
.user-config-container .module-header .header-content,
div[id*="admin"] .module-header .header-content,
#knowledge-module .module-header .header-content,
#capability-module .module-header .header-content,
#scenario-module .module-header .header-content {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 2rem !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 0 2rem !important;
    position: relative !important;
    z-index: 2 !important;
    box-sizing: border-box !important;
}

/* 左侧内容区域 */
.header-left {
    flex: 1;
    min-width: 0; /* 防止flex溢出 */
}

/* 标题区域 */
.header-title {
    display: flex !important;
    align-items: flex-start !important;
    gap: 0.875rem;
    margin-bottom: 0.875rem;
    text-align: left !important;
}

.header-icon {
    font-size: 1.625rem;
    line-height: 1.3;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    margin-top: 0.1rem;
}

.header-title h3 {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    line-height: 1.3;
    text-align: left !important;
    letter-spacing: -0.02em;
}

/* 描述文本 */
.header-description {
    font-size: 1.0625rem !important;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
    opacity: 0.85;
    text-align: left !important;
    font-weight: 400;
    max-width: 600px;
}

/* 右侧统计区域 */
.header-right {
    flex-shrink: 0;
}

/* 统计数据样式 */
.header-stats {
    display: flex;
    gap: 1.25rem;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
}

.stat-item {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    text-align: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: none;
    min-width: 90px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 70px;
}

.stat-item::before {
    display: none;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.stat-item:hover::before {
    display: none;
}

.stat-item:focus {
    outline: 2px solid rgba(255, 255, 255, 0.4);
    outline-offset: 2px;
    background: rgba(255, 255, 255, 0.12);
}

.stat-item:active {
    transform: none;
    transition: none;
}

.stat-item.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

/* 统计项光影动画 */
@keyframes stat-glow {
    0% {
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15),
                    0 6px 18px rgba(99, 102, 241, 0.3),
                    0 3px 9px rgba(168, 85, 247, 0.25);
    }
    100% {
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1),
                    0 4px 12px rgba(99, 102, 241, 0.2),
                    0 2px 6px rgba(168, 85, 247, 0.15);
    }
}

.stat-number {
    display: block;
    font-size: 1.1rem !important;
    font-weight: 800;
    color: var(--text-primary, #2c3e50) !important;
    margin-bottom: 0.25rem;
    line-height: 1.2;
    position: relative;
    z-index: 2;
    animation: none;
    text-shadow: 0 1px 2px rgba(44, 62, 80, 0.1);
    /* 浏览器兼容性备用方案 */
    -webkit-text-fill-color: var(--text-primary, #2c3e50);
    background: none;
    /* 优化：数字突出显示 */
    flex-shrink: 0;
}

/* 管理员模块统计数字样式 - 提高优先级 */
.admin-config-container .stat-number,
div[id*="admin"] .stat-number {
    font-size: 0.95rem !important;
}

/* 数字闪烁动画 - 优化减少抖动 */
@keyframes number-shimmer {
    0%, 100% {
        filter: brightness(1) drop-shadow(0 0 1px rgba(99, 102, 241, 0.2));
    }
    50% {
        filter: brightness(1.05) drop-shadow(0 0 2px rgba(99, 102, 241, 0.3));
    }
}

.stat-label {
    display: block !important;
    font-size: 0.75rem;
    color: var(--text-secondary, #6c757d) !important;
    opacity: 0.9;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(108, 117, 125, 0.1);
    margin-top: 0;
    line-height: 1.3;
    /* 优化：标签文字换行支持 */
    word-wrap: break-word;
    text-align: center;
    flex-shrink: 0;
    max-width: 100%;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .module-header {
        padding: 2.1rem 0;
        margin: 0;
    }
    
    .header-stats {
        gap: 1rem;
    }
    
    .stat-item {
        padding: 0.875rem 1rem;
        min-width: 80px;
        min-height: 65px;
    }
    
    .stat-number {
        font-size: 1.2rem !important;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
}

@media (max-width: 768px) {
    .module-header {
        padding: 2rem 0;
        margin: 0;
    }
    
    .module-header .header-content {
        flex-direction: column;
        gap: 1.75rem;
        text-align: center;
        padding: 0 1.5rem;
        max-width: none;
    }
    
    .header-left {
        text-align: center;
        width: 100%;
    }
    
    .header-title {
        justify-content: center;
        margin-bottom: 1rem;
        gap: 1rem;
    }
    
    .header-title h3 {
        font-size: 1.375rem;
    }
    
    .header-description {
        font-size: 1rem;
        max-width: none;
    }
    
    .header-stats {
        justify-content: center;
        gap: 1rem;
        flex-wrap: wrap;
        width: 100%;
    }
    
    .stat-item {
        padding: 0.875rem 1.125rem;
        min-width: 85px;
        flex: 1;
        max-width: 120px;
    }
    
    .stat-number {
        font-size: 1rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .module-header {
        padding: 1.75rem 0;
        margin: 0;
        border-radius: 0;
    }
    
    .module-header .header-content {
        padding: 0 1rem;
        gap: 1.5rem;
    }
    
    .header-title {
        gap: 0.75rem;
        margin-bottom: 0.875rem;
    }
    
    .header-icon {
        font-size: 1.5rem;
    }
    
    .header-title h3 {
        font-size: 1.25rem;
    }
    
    .header-description {
        font-size: 0.9375rem;
    }
    
    .header-stats {
        gap: 0.75rem;
    }
    
    .stat-item {
        padding: 0.75rem 1rem;
        min-width: 75px;
        max-width: 100px;
    }
    
    .stat-number {
        font-size: 1rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    .module-header {
        background: linear-gradient(135deg, 
            rgba(99, 102, 241, 0.12) 0%, 
            rgba(168, 85, 247, 0.12) 50%, 
            rgba(236, 72, 153, 0.12) 100%);
        border-color: rgba(255, 255, 255, 0.15);
    }
    
    .stat-item {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.15);
    }
    
    .stat-item:hover {
        background: rgba(255, 255, 255, 0.15);
        border-color: rgba(255, 255, 255, 0.25);
    }
}

/* 打印样式 */
@media print {
    .module-header {
        background: none !important;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
    }
    
    .module-header::before {
        display: none !important;
    }
    
    .stat-item {
        background: #f8f9fa !important;
        border: 1px solid #dee2e6 !important;
    }
}
