/**
 * 组件样式模块
 * 版本: 1.4.1
 * 变更记录:
 * - 1.4.1: 修复“生成解读报告”按钮在部分环境下文字与背景同为白色的问题，增强对比度与可访问性
 * - 1.4.0: 新增 #aiInterpretationPanel 排版修复样式（统一间距、换行、列表缩进、按钮换行），优化移动端展示
 * - 1.3.1: 新增 stats-grid--quaternary 四列布局样式，优化响应式断点
 * - 1.3.0: 新增卡片提示文本样式 - 为统计卡片添加小字说明
 * - 1.2.1: 统一卡片配色 - 采用灰白色系，去除彩色背景，提升专业性
 * - 1.2.0: 新增统计卡片样式系统 - 统一设计风格，支持响应式布局
 * - 1.1.0: 移除调试面板样式，优化生产环境代码
 * - 1.0.0: 新建文件，包含导航栏、按钮、图标、面板等组件样式
 */

/* ========== 导航栏和页脚 ========== */
.nav-modern, 
footer, 
#userManualModal .bg-blue-600 {
    background: linear-gradient(to right, var(--color-primary), var(--color-primary-light));
    box-shadow: var(--shadow-primary);
}

.nav-modern button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all var(--transition-base);
}

.nav-modern button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* ========== 提示图标 ========== */
.success-icon {
    color: var(--color-success);
    font-size: var(--font-size-2xl);
}

.error-icon {
    color: var(--color-error);
    font-size: var(--font-size-2xl);
}

.warning-icon {
    color: var(--color-warning);
    font-size: var(--font-size-2xl);
}

/* ========== 内容区块 ========== */
.bg-white {
    animation: fadeIn var(--transition-slow) forwards;
}

#resultPanel:not(.hidden) {
    animation: fadeIn 0.6s ease-out forwards;
}

.panel-collapsible {
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.3s ease;
}

.panel-collapsible:hover {
    border-color: rgba(79, 70, 229, 0.2);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.08);
}

.panel-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.125rem 1.5rem;
    list-style: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    position: relative;
}

.panel-summary::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: linear-gradient(180deg, #4f46e5, #7c3aed);
    transition: height 0.3s ease;
    border-radius: 0 2px 2px 0;
}

.panel-summary::-webkit-details-marker {
    display: none;
}

.panel-summary:not(.hidden)::after {
    content: '\25BC';
    font-size: 0.75rem;
    color: #64748b;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #f1f5f9;
    border-radius: 6px;
}

.panel-collapsible[open] .panel-summary::after {
    transform: rotate(180deg);
    background: #e0e7ff;
    color: #4f46e5;
}

.panel-summary:hover {
    background: linear-gradient(135deg, #fafbfc 0%, #f1f5f9 100%);
}

.panel-summary:hover::before {
    height: 50%;
}

.panel-summary:hover::after {
    background: #e0e7ff;
    color: #4f46e5;
}

.panel-content {
    padding: 0 1.5rem 1.5rem;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== 加载面板 ========== */
#loadingPanel .flex {
    animation: fadeIn var(--transition-slow);
}

#processingStatus {
    font-size: 0.9rem;
    color: var(--color-gray-600);
    margin-top: 0.75rem;
}

/* ========== 统计卡片样式 ========== */
.stats-card {
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1.5px solid rgba(100, 116, 139, 0.35);
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.08);
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4f46e5, #7c3aed, #4f46e5);
    background-size: 200% 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 32px rgba(79, 70, 229, 0.15), 0 6px 18px rgba(15, 23, 42, 0.12);
    border-color: rgba(79, 70, 229, 0.55);
}

.stats-card:hover::before {
    opacity: 1;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.stats-card__label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.stats-card__value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
    color: #1e293b;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.stats-card__hint {
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.4;
    margin-top: 0.25rem;
}

/* 主要指标卡片（大卡片） */
.stats-card--primary {
    padding: 1.5rem 1.75rem;
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
    border: 1.75px solid rgba(79, 70, 229, 0.25);
}

.stats-card--primary .stats-card__label {
    font-size: 0.875rem;
    margin-bottom: 0.625rem;
    color: #475569;
}

.stats-card--primary .stats-card__value {
    font-size: 2.25rem;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.stats-card--primary .stats-card__hint {
    font-size: 0.8125rem;
}

/* 不同类型的强调色（保持简洁） */
.stats-card--highlight .stats-card__value {
    color: var(--color-primary);
}

/* 统计卡片容器 */
.stats-grid {
    display: grid;
    gap: 0.875rem;
}

.stats-grid--primary {
    grid-template-columns: repeat(3, 1fr);
}

.stats-grid--secondary {
    grid-template-columns: repeat(4, 1fr);
}

.stats-grid--tertiary {
    grid-template-columns: repeat(3, 1fr);
}

.stats-grid--quaternary {
    grid-template-columns: repeat(4, 1fr);
}

/* 响应式调整 */
@media (max-width: 1024px) {
    .stats-grid--secondary,
    .stats-grid--quaternary {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .stats-grid--primary,
    .stats-grid--secondary,
    .stats-grid--tertiary,
    .stats-grid--quaternary {
        grid-template-columns: 1fr;
    }
    
    .stats-card__value {
        font-size: 1.25rem;
    }
    
    .stats-card--primary .stats-card__value {
        font-size: 1.75rem;
    }
}

/* ========== AI 智能解读面板：排版修复 ========== */
#aiInterpretationPanel {
    line-height: 1.65;
}

/* 顶部按钮区域在小屏换行且保持间距 */
#aiInterpretationPanel .flex.space-x-2 {
    flex-wrap: wrap;
    row-gap: 0.5rem;
    column-gap: 0.5rem; /* 兼容不支持 space-x 的位置 */
}

/* 标题与分组统一间距 */
#aiInterpretationPanel h2 {
    margin: 0; /* 保持头部紧凑 */
}
#aiInterpretationPanel h3 {
    margin-bottom: 0.5rem;
}

/* 内容区统一垂直节奏 */
#aiInterpretationPanel #aiReportContent > div {
    margin-bottom: 1rem;
}

/* 段落与列表 */
#aiInterpretationPanel p {
    margin: 0.5rem 0;
}
#aiInterpretationPanel ul,
#aiInterpretationPanel ol {
    margin: 0.5rem 0 0.75rem 1.25rem;
}
#aiInterpretationPanel li {
    margin: 0.25rem 0;
}

/* 预格式文本与长内容自动换行、限制高度并可滚动 */
#aiInterpretationPanel pre {
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 16rem; /* 与现有类 max-h-64 保持一致语义 */
    overflow: auto;
}

/* 行内代码与引用的可读性 */
#aiInterpretationPanel code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-200);
    border-radius: 0.375rem;
    padding: 0.1rem 0.3rem;
}
#aiInterpretationPanel blockquote {
    border-left: 3px solid var(--color-gray-300);
    padding-left: 0.75rem;
    color: var(--color-gray-600);
    margin: 0.5rem 0 0.75rem;
}

/* 异常与提示区块的内边距统一（若存在多来源内容） */
#aiInterpretationPanel .bg-white.border,
#aiInterpretationPanel .bg-yellow-50.border,
#aiInterpretationPanel .bg-green-50.border,
#aiInterpretationPanel .bg-gradient-to-r {
    padding: 1rem;
}

/* 移动端优化：标题与按钮的对齐 */
@media (max-width: 640px) {
    #aiInterpretationPanel .flex.justify-between {
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* 生成解读报告按钮：强制高对比可见性（覆盖潜在的白底白字冲突） */
#aiInterpretationPanel #generateAIReport {
    background-color: #7e22ce !important; /* tailwind purple-600 */
    color: #ffffff !important;
    border-color: transparent !important;
}
#aiInterpretationPanel #generateAIReport:hover,
#aiInterpretationPanel #generateAIReport:focus {
    background-color: #6b21a8 !important; /* tailwind purple-700 */
    color: #ffffff !important;
}
#aiInterpretationPanel #generateAIReport:disabled {
    background-color: #a78bfa !important; /* tailwind violet-300 近似，体现禁用态 */
    color: #ffffff !important;
    opacity: 0.9;
    cursor: not-allowed;
}

