/* ===== 基础样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #f0f4f8;
    min-height: 100vh;
    padding: 20px;
    color: #334155;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== 页面头部 ===== */
.page-header {
    text-align: center;
    padding: 50px 20px;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.page-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: white;
    letter-spacing: -0.5px;
}

.page-header .subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 400;
}

/* ===== 区域分组 ===== */
.section-group {
    background: white;
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.section-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #3b82f6;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    margin-right: 14px;
    flex-shrink: 0;
}

.section-header h2 {
    font-size: 1.25rem;
    color: #1e293b;
    font-weight: 600;
}

/* ===== 卡片样式 ===== */
.card {
    background: #fafbfc;
    border-radius: 10px;
    padding: 22px;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.card:last-child {
    margin-bottom: 0;
}

.card h3 {
    font-size: 1.05rem;
    color: #1e293b;
    margin-bottom: 10px;
    font-weight: 600;
}

.card-desc {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 16px;
    line-height: 1.5;
}

/* ===== 按钮样式 ===== */
.btn-primary, .btn-secondary, .btn-link {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.btn-link {
    background: transparent;
    color: #3b82f6;
    text-decoration: none;
    padding: 10px 12px;
}

.btn-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

.btn-large {
    padding: 12px 24px;
    font-size: 0.95rem;
}

.btn-icon {
    font-size: 1.1em;
}

/* ===== 演示模式卡片 ===== */
.demo-card {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
    border: none;
}

.demo-card:hover {
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.25);
}

.demo-card h3 {
    color: white;
}

.demo-card .card-desc {
    color: rgba(255, 255, 255, 0.9);
}

.demo-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.demo-buttons .btn-primary {
    background: white;
    color: #0284c7;
}

.demo-buttons .btn-primary:hover {
    background: #f8fafc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.demo-buttons .btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.demo-buttons .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ===== 上传区域 ===== */
.upload-area, .resource-upload-area {
    margin-top: 14px;
}

.file-input-wrapper, .resource-input {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.resource-hint {
    margin-top: 8px;
    color: #94a3b8;
    font-size: 0.85rem;
}

.uploaded-resources {
    margin-top: 14px;
}

.uploaded-resources h4 {
    font-size: 0.95rem;
    color: #1e293b;
    margin-bottom: 10px;
    font-weight: 600;
}

.uploaded-resources ul {
    list-style: none;
}

.uploaded-resources li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

.uploaded-resources li:last-child {
    border-bottom: none;
}

.resource-type {
    background: #dbeafe;
    color: #2563eb;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.resource-name {
    flex: 1;
    color: #475569;
    font-size: 0.9rem;
}

.btn-remove {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-remove:hover {
    background: #fecaca;
}

/* ===== AI控制区域 ===== */
.ai-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.ai-options {
    display: flex;
    gap: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #475569;
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #3b82f6;
}

/* ===== 进度条 ===== */
.progress-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 16px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #0ea5e9 100%);
    transition: width 0.3s ease;
}

.progress-text {
    position: absolute;
    right: 0;
    top: -22px;
    font-size: 0.85rem;
    color: #3b82f6;
    font-weight: 600;
}

/* ===== 分析状态 ===== */
.analysis-status {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
}

.analysis-status.analyzing {
    background: #dbeafe;
    color: #2563eb;
}

.analysis-status.completed {
    background: #dcfce7;
    color: #16a34a;
}

.analysis-status.error {
    background: #fee2e2;
    color: #dc2626;
}

/* ===== 图表网格 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

.stat-chart {
    background: white;
    border-radius: 10px;
    padding: 18px;
    border: 1px solid #e2e8f0;
}

.stat-chart h4 {
    font-size: 1rem;
    color: #1e293b;
    margin-bottom: 14px;
    text-align: center;
    font-weight: 600;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #64748b;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* ===== 分布信息 ===== */
.distribution-info {
    margin-top: 20px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 3px solid #3b82f6;
}

.distribution-info h4 {
    color: #1e293b;
    margin-bottom: 10px;
    font-size: 0.95rem;
    font-weight: 600;
}

.distribution-info ul {
    list-style: none;
    padding: 0;
}

.distribution-info li {
    padding: 6px 0;
    color: #64748b;
    font-size: 0.9rem;
    border-bottom: 1px dashed #e2e8f0;
}

.distribution-info li:last-child {
    border-bottom: none;
}

/* ===== 操作按钮区域 ===== */
.action-card {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===== 数据表格 ===== */
.data-table {
    overflow-x: auto;
    margin-top: 14px;
}

.data-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    position: sticky;
    top: 0;
    font-size: 0.85rem;
}

.data-table tr:hover {
    background: #f8fafc;
}

/* 变更详情样式 */
.data-table td.change-detail {
    font-size: 0.8rem;
    line-height: 1.5;
}

.change-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    margin: 2px 0;
    white-space: nowrap;
}

.change-tag.target-change {
    background: #dbeafe;
    color: #2563eb;
}

.change-tag.diff-change {
    background: #fef3c7;
    color: #d97706;
}

.change-tag.ai-only {
    background: #dcfce7;
    color: #16a34a;
}

.change-tag.no-change {
    background: #f1f5f9;
    color: #94a3b8;
}

/* 手动变更标记 */
.change-tag.manual-change {
    background: #fce7f3;
    color: #db2777;
}

/* AI变更标记 */
.change-tag.ai-change {
    background: #dcfce7;
    color: #16a34a;
}

/* 变更指示器小标签 */
.change-indicator {
    display: inline-block;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
    margin-left: 4px;
    vertical-align: middle;
}

.change-indicator.ai-indicator {
    background: #22c55e;
    color: white;
}

.change-indicator.manual-indicator {
    background: #ec4899;
    color: white;
}

/* AI变更行高亮 */
.ai-changed-row {
    background: #f0fdf4 !important;
}

.ai-changed-row:hover {
    background: #dcfce7 !important;
}

/* 手动变更行高亮 */
.manual-changed-row {
    background: #fdf2f8 !important;
}

.manual-changed-row:hover {
    background: #fce7f3 !important;
}

/* AI变更单元格高亮 */
.ai-changed {
    background: #f0fdf4;
    font-weight: 600;
    color: #15803d;
}

/* AI分析原因列样式 */
.ai-reason-cell {
    font-size: 0.8rem;
    color: #475569;
    max-width: 200px;
    line-height: 1.4;
    background: #f8fafc;
}

.ai-reason-cell:hover {
    background: #f1f5f9;
}

/* 原始值变更标记 */
.data-table td.original-value.changed {
    background: #fef2f2;
    color: #dc2626;
    text-decoration: line-through;
    font-weight: 500;
}

/* 调整表单 */
.adjust-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.data-table select,
.data-table input[type="text"] {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.88rem;
    width: 100%;
    background: white;
}

.data-table select:focus,
.data-table input[type="text"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===== 状态提示 ===== */
.status-success {
    color: #16a34a;
    font-weight: 500;
    margin-top: 10px;
    font-size: 0.9rem;
}

.status-error {
    color: #dc2626;
    font-weight: 500;
    margin-top: 10px;
    font-size: 0.9rem;
}

.status-uploading {
    color: #d97706;
    font-weight: 500;
    margin-top: 10px;
    font-size: 0.9rem;
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }
    
    .page-header {
        padding: 32px 16px;
        border-radius: 12px;
    }
    
    .page-header h1 {
        font-size: 1.6rem;
    }
    
    .section-group {
        padding: 18px;
        border-radius: 10px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .ai-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .demo-buttons {
        flex-direction: column;
    }
}
