/**
 * PDF生成专用样式
 * 优化报告在PDF中的显示效果
 */

/* ========== PDF导出专用容器样式 ========== */
.pdf-export-container {
    font-family: 'Microsoft YaHei', 'SimHei', Arial, sans-serif !important;
    font-size: 14px;
    line-height: 1.8;
    color: #333;
    background: white;
}

/* ========== PDF页眉样式 ========== */
.pdf-header {
    page-break-after: avoid;
}

.pdf-header h1 {
    font-size: 26px !important;
    font-weight: 700 !important;
    margin-bottom: 8px !important;
}

.pdf-header p {
    font-size: 14px !important;
}

/* ========== PDF页脚样式 ========== */
.pdf-footer {
    page-break-before: avoid;
    margin-top: auto;
}

/* ========== PDF主体内容样式 ========== */
.pdf-body {
    padding: 20px 30px;
}

.pdf-body h1 {
    font-size: 24px !important;
    color: #1e3a8a !important;
    border-bottom: 3px solid #3b82f6;
    padding-bottom: 10px;
    margin: 25px 0 15px 0;
    page-break-after: avoid;
}

.pdf-body h2 {
    font-size: 20px !important;
    color: #1e40af !important;
    border-left: 4px solid #3b82f6;
    padding-left: 12px;
    margin: 20px 0 12px 0;
    page-break-after: avoid;
}

.pdf-body h3 {
    font-size: 17px !important;
    color: #1e3a8a !important;
    margin: 18px 0 10px 0;
    page-break-after: avoid;
}

.pdf-body h4, .pdf-body h5, .pdf-body h6 {
    font-size: 15px !important;
    color: #374151 !important;
    margin: 15px 0 8px 0;
    page-break-after: avoid;
}

.pdf-body p {
    margin: 10px 0;
    text-align: justify;
}

.pdf-body ul, .pdf-body ol {
    margin: 10px 0;
    padding-left: 25px;
    page-break-inside: avoid;
}

.pdf-body li {
    margin: 6px 0;
    line-height: 1.7;
}

/* ========== PDF表格样式 ========== */
.pdf-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    page-break-inside: avoid;
}

.pdf-body th {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
}

.pdf-body td {
    padding: 10px 15px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 13px;
}

.pdf-body tr:nth-child(even) td {
    background: #f9fafb;
}

.pdf-body tr:hover td {
    background: #f3f4f6;
}

/* ========== PDF卡片/区块样式 ========== */
.pdf-body .card,
.pdf-body .section,
.pdf-body .analysis-section,
.pdf-body [class*="-section"] {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
    page-break-inside: avoid;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* ========== PDF图表容器样式 ========== */
.pdf-body .chart-container,
.pdf-body [class*="chart"] {
    page-break-inside: avoid;
    margin: 15px 0;
    padding: 15px;
    background: #fafafa;
    border-radius: 8px;
}

.pdf-body canvas {
    max-width: 100% !important;
    height: auto !important;
}

/* ========== PDF强调样式 ========== */
.pdf-body strong, .pdf-body b {
    color: #1e3a8a;
    font-weight: 600;
}

.pdf-body em, .pdf-body i {
    color: #6b7280;
}

/* ========== PDF引用块样式 ========== */
.pdf-body blockquote {
    border-left: 4px solid #3b82f6;
    padding: 15px 20px;
    margin: 15px 0;
    background: #eff6ff;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #1e40af;
}

/* ========== PDF代码块样式 ========== */
.pdf-body code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    font-size: 13px;
    color: #dc2626;
}

.pdf-body pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 12px;
    page-break-inside: avoid;
}

/* ========== PDF分页控制 ========== */
.pdf-page-break-before {
    page-break-before: always;
}

.pdf-page-break-after {
    page-break-after: always;
}

.pdf-avoid-break {
    page-break-inside: avoid;
}

/* ========== PDF隐藏元素 ========== */
.pdf-hide,
.no-print {
    display: none !important;
}

/* ========== 模块特定颜色 ========== */

/* 品牌分析 - 蓝色系 */
.pdf-brand .pdf-header {
    background: linear-gradient(135deg, #1E3A8A, #3B82F6) !important;
}

.pdf-brand h2 {
    border-left-color: #3b82f6 !important;
}

.pdf-brand th {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8) !important;
}

/* 商圈调研 - 紫色系 */
.pdf-market .pdf-header {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6) !important;
}

.pdf-market h2 {
    border-left-color: #8b5cf6 !important;
    color: #6d28d9 !important;
}

.pdf-market th {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed) !important;
}

.pdf-market blockquote {
    border-left-color: #8b5cf6;
    background: #f5f3ff;
    color: #6d28d9;
}

/* 店铺活动 - 橙色系 */
.pdf-store-activity .pdf-header {
    background: linear-gradient(135deg, #ef4444, #f97316) !important;
}

.pdf-store-activity h2 {
    border-left-color: #f97316 !important;
    color: #c2410c !important;
}

.pdf-store-activity th {
    background: linear-gradient(135deg, #f97316, #ef4444) !important;
}

.pdf-store-activity blockquote {
    border-left-color: #f97316;
    background: #fff7ed;
    color: #c2410c;
}

/* 数据统计 - 渐变紫色系 */
.pdf-data-statistics .pdf-header {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
}

.pdf-data-statistics h2 {
    border-left-color: #667eea !important;
    color: #5b21b6 !important;
}

.pdf-data-statistics th {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
}

.pdf-data-statistics blockquote {
    border-left-color: #667eea;
    background: #f5f3ff;
    color: #5b21b6;
}

/* ========== PDF响应式图表 ========== */
.pdf-body .echarts-container,
.pdf-body .chart-wrapper {
    width: 100%;
    min-height: 300px;
    page-break-inside: avoid;
}

/* ========== PDF信息卡片 ========== */
.pdf-body .info-card {
    display: flex;
    background: #f9fafb;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    border: 1px solid #e5e7eb;
}

.pdf-body .info-card .icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    flex-shrink: 0;
}

.pdf-body .info-card .content {
    flex: 1;
}

/* ========== PDF评分/进度条 ========== */
.pdf-body .score-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.pdf-body .score-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: none;
}

/* ========== PDF打印媒体查询 ========== */
@media print {
    body {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .pdf-header,
    .pdf-footer {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .no-print,
    .pdf-hide {
        display: none !important;
    }

    a[href]:after {
        content: none !important;
    }
}
