/* 全局样式设置 */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --border-color: #bdc3c7;
    --hover-color: #f5f6fa;
    --text-color: #333;
    --content-width: 1200px;
    --content-padding: 40px;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
    line-height: 1.8;
    color: var(--text-color);
    margin: 0;
    padding: 0;
    background-color: #f5f7fa;
    -webkit-font-smoothing: antialiased;  /* 字体平滑 */
    -moz-osx-font-smoothing: grayscale;
}

/* 修改页面基础布局 */
.page {
    width: 210mm;
    min-height: 297mm;
    padding: 20mm;
    margin: 20mm auto;
    background: white;
    box-sizing: border-box;
    position: relative;
}

/* 修改内容容器样式 */
.container,
.cover-container,
.toc-content,
.preface-content,
.basic-info-section,
.analysis-section {
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    background: white;
    box-sizing: border-box;
}

/* 调整表格布局 */
.table-container {
    width: 100%;
    margin: 15px 0;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    margin-bottom: 1em;
    border-collapse: collapse;
}

/* 打印样式优化 */
@media print {
    @page {
        size: A4;
        margin: 0;
    }
    
    body {
        width: 210mm;
        height: 297mm;
        margin: 0;
        padding: 0;
    }
    
    .page {
        margin: 0;
        padding: 20mm;
        page-break-after: always;
    }
    
    /* 表格分页处理 */
    table {
        page-break-inside: auto;
    }
    
    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
    
    thead {
        display: table-header-group;
    }
    
    tfoot {
        display: table-footer-group;
    }
}

/* 移除重复的宽度定义 */
.cover-container {
    height: 800px;
    position: relative;
    overflow: hidden;
}

.toc-content {
    position: relative;
}

.preface-content {
    position: relative;
}

.basic-info-section {
    margin: 0;
}

.analysis-section {
    position: relative;
}

/* 确保页面级容器不影响内容宽度 */
.cover-page,
.toc-page,
.preface-page {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 50px 0;
    page-break-before: always;
    page-break-after: always;
}

/* 标题样式 */
h2 {
    color: var(--primary-color);
    font-size: 28px;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
}

h3 {
    color: var(--secondary-color);
    font-size: 22px;
    margin: 25px 0;
    font-weight: 500;
}

/* 描述文本样式 */
.description {
    margin: 20px 0;
    line-height: 2;
    color: var(--text-color);
    font-size: 16px;
    letter-spacing: 0.5px;
}

/* 表格容器样式 */
.table-container {
    margin: 30px 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

/* 表格样式 */
.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: center;
    border: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table th[rowspan] {
    vertical-align: middle;
}

.data-table th[colspan] {
    text-align: center;
}

.data-table th {
    background-color: var(--secondary-color);
    color: white;
    font-weight: 500;
    padding: 15px;
    font-size: 15px;
}

.data-table td {
    padding: 12px 15px;
    font-size: 14px;
    color: var(--text-color);
}

.data-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.data-table tbody tr:hover {
    background-color: var(--hover-color);
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px;
        font-size: 14px;
    }
}

/* 年龄段表格特殊样式 */
.age-table {
    font-size: 14px; /* 由于列数较多，适当减小字体 */
}

.age-table th,
.age-table td {
    padding: 8px 10px; /* 减小内边距以适应更多列 */
}

/* 响应式设计更新 */
@media screen and (max-width: 1024px) {
    .age-table {
        font-size: 12px;
    }
    
    .age-table th,
    .age-table td {
        padding: 6px 8px;
    }
}

/* 封面页样式 */
.cover-page {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 50px;
    page-break-after: always;
}

/* 封面容器 - 调整为与内容区域相同的宽度 */
.cover-container {
    width: 100%;
    max-width: 1200px;  /* 与 .container 相同 */
    height: 800px;      /* 减小高度 */
    position: relative;
    background: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    padding: 20px;      /* 与 .container 相同 */
    box-sizing: border-box;
}

/* 封面内容 */
.cover-content {
    position: absolute;
    top: 45%;  /* 从50%调整到45%，整体上移一点 */
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    text-align: center;
    z-index: 1;
    height: 100%;
}

/* Logo样式 */
.logo-container {
    margin-top: 60px;
    margin-bottom: 80px;  /* 增加与标题的间距 */
    text-align: center;
}

.logo {
    width: 200px;
    height: auto;
    display: inline-block;
}

/* 报告标题 */
.report-title {
    position: absolute;  /* 添加绝对定位 */
    top: 50%;           /* 垂直居中 */
    left: 50%;          /* 水平居中 */
    transform: translate(-50%, -50%);  /* 完全居中 */
    width: 100%;
    text-align: center;
}

.report-title h1 {
    font-size: 48px;
    color: var(--primary-color);
    margin: 0 0 30px 0;  /* 增加与年度的间距 */
    font-weight: bold;
}

.year {
    font-size: 32px;
    color: var(--primary-color);
}

/* 公司信息 */
.company-info {
    font-size: 24px;
    color: var(--primary-color);
    line-height: 1.8;
    text-align: center;
    position: absolute;
    bottom: 60px;       /* 调整底部距离 */
    left: 0;
    width: 100%;
    margin: 0;
    padding: 0;
}

.company-info p {
    margin: 5px 0;
}

/* 响应式封面 */
@media screen and (max-width: 768px) {
    .cover-container {
        width: 100%;
        height: 100vh;
    }
    
    .report-title h1 {
        font-size: 36px;
    }
    
    .year {
        font-size: 24px;
    }
    
    .company-info {
        font-size: 18px;
    }
}

/* 装饰元素容器 */
.corner-decorations {
    display: none;
}

/* 右上角装饰 */
.corner-top-right {
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 300px;
    overflow: hidden;
}

.corner-top-right::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: #8BC34A;
    border-radius: 400px 0 0 0;
    transform: rotate(0deg);
}

.corner-top-right::after {
    content: '';
    position: absolute;
    top: -70px;
    right: -70px;
    width: 300px;
    height: 300px;
    background: #4CAF50;
    border-radius: 300px 0 0 0;
    transform: rotate(0deg);
}

/* 左下角装饰 */
.corner-bottom-left {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200px;
    height: 100px;
    overflow: hidden;
}

.corner-bottom-left::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 100px 0 0 200px;
    border-color: transparent transparent transparent #FF5722;
    opacity: 0.8;
}

/* 前言页面样式 */
.preface-page {
    width: 100%;
    margin: 50px 0;
    page-break-before: always;
}

.preface-content {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: var(--content-padding);
    background: white;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    position: relative;  /* 添加相对定位 */
}

.preface-title {
    text-align: center;
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 50px;
    font-weight: 600;
    position: relative;
}

.preface-title::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--primary-color);
}

.preface-text {
    font-size: 16px;
    line-height: 2.2;
    color: var(--text-color);
    text-align: justify;
    letter-spacing: 0.5px;
}

.preface-text .greeting {
    margin-bottom: 40px;
    font-weight: 500;
    font-size: 18px;
    color: var(--primary-color);
}

.preface-text p {
    margin-bottom: 25px;
    text-indent: 2em;
}

/* 提示框样式 */
.notice-box {
    margin-top: 40px;
    padding: 25px 30px;
    background-color: #f8f9fa;
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.notice-box p {
    margin: 0;
    color: var(--primary-color);
    font-size: 16px;
    line-height: 2;
    text-indent: 2em;
    letter-spacing: 0.5px;
}

/* 打印样式适配 */
@media print {
    .preface-page {
        margin: 0;
        page-break-after: always;
    }
    
    .preface-content {
        box-shadow: none;
    }
    
    body {
        background: white;
    }
    
    .content-wrapper,
    .preface-content,
    .analysis-section {
        box-shadow: none;
        padding: 20px;
    }
    
    .notice-box {
        background-color: transparent;
        border: 1px solid var(--border-color);
        box-shadow: none;
    }
}

/* 数据分析部分样式更新 */
.analysis-section {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: var(--content-padding);
    background: white;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

/* 目录页样式 */
.toc-page {
    width: 100%;
    margin: 50px 0;
    page-break-before: always;
    page-break-after: always;
}

.toc-content {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: var(--content-padding);
    background: white;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.toc-title {
    text-align: center;
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 50px;
    font-weight: 600;
    border-bottom: none;
}

.toc-list {
    margin-top: 40px;
}

.toc-item {
    margin-bottom: 20px;
}

.toc-link {
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    align-items: baseline;
}

.toc-text {
    font-size: 18px;
    flex: 1;
}

.toc-page-num {
    margin-left: 15px;
}

.toc-sub-items {
    margin-left: 30px;
    margin-top: 10px;
}

.toc-sub-item {
    margin-bottom: 10px;
}

.toc-sub-item .toc-text {
    font-size: 16px;
}

.toc-sub-sub-items {
    margin-left: 30px;
    margin-top: 5px;
}

.toc-sub-sub-item {
    margin-bottom: 8px;
}

.toc-link:hover {
    color: var(--primary-color);
}

/* 确保文本在虚线之上 */
.toc-text,
.toc-page-num {
    background: white;
    z-index: 1;
    position: relative;
}

.toc-text {
    padding-right: 5px;
}

.toc-page-num {
    padding-left: 5px;
}

/* 确保每个可能包含页码的容器都是相对定位 */
.preface-page,
.basic-info-section,
.analysis-section,
.gender-analysis,
.age-analysis,
.trend-analysis {
    position: relative;
    margin-bottom: 50px;  /* 添加底部间距，确保页码有足够空间 */
    page-break-after: always;  /* 确保打印时每个部分都另起一页 */
}

/* 打印样式适配 */
@media print {
    .page-number {
        position: absolute;
        bottom: 20px;
        right: 20px;
    }
    
    @page {
        margin: 20mm;
    }
}

/* 基本资料部分样式 */
.basic-info-section {
    margin: 0;  /* 只保留这个，覆盖可能的其他margin */
}

.section-desc {
    color: var(--text-color);
    font-size: 16px;
    line-height: 1.8;
    margin: 20px 0 30px;
}

/* 体检时间样式 */
.exam-time {
    margin: 30px 0;
}

.time-info {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 4px;
}

.time-row {
    display: flex;
    margin: 10px 0;
    font-size: 16px;
    line-height: 1.8;
}

.time-label {
    width: 100px;
    color: var(--secondary-color);
}

.time-value {
    color: var(--text-color);
    font-weight: 500;
}

/* 体检数据汇总表格样式 */
.summary-table {
    font-size: 14px;
}

.summary-table caption {
    font-size: 16px;
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: 15px;
}

.summary-table th {
    white-space: nowrap;
    padding: 12px 8px;
}

.summary-table td {
    padding: 10px 8px;
}

.summary-desc {
    margin: 20px 0;
    line-height: 1.8;
    color: var(--text-color);
}

/* 目录链接样式 */
.toc-link:hover {
    color: var(--primary-color);
}

/* 目录点击时的平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 为各个章节添加锚点定位的偏移量，避免被固定导航栏遮挡 */
section[id],
article[id],
div[id] {
    scroll-margin-top: 20px;
}

.toc-item {
    margin-bottom: 20px;
    display: flex;
    align-items: baseline;
}

.toc-text {
    font-size: 18px;
    color: var(--text-color);
    flex: 1;
}

.toc-sub-items {
    margin-left: 30px;
    margin-top: 10px;
}

.toc-sub-item {
    margin-bottom: 10px;
    display: flex;
    align-items: baseline;
}

.toc-sub-item .toc-text {
    font-size: 16px;
}

.page-number {
    position: absolute;
    bottom: 30px;
    right: 30px;
    font-size: 14px;
    color: var(--text-color);
}

/* 返回目录按钮样式 */
.back-to-toc {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    border: none;
    outline: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    z-index: 1000;
    cursor: pointer;
}

.back-to-toc:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* 在小屏幕上调整按钮大小和位置 */
@media screen and (max-width: 768px) {
    .back-to-toc {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }
}

.page-num {
    float: right;
    font-weight: normal;
    color: #666;
}

.toc-page-num {
    float: right;
    color: #666;
    margin-left: 1em;
}

/* 可视化按钮样式 */
.visualization-btn {
    position: absolute;
    top: 30px;
    right: 30px;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 20px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 15px rgba(0, 82, 204, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.visualization-btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 82, 204, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-text {
    font-weight: 500;
    letter-spacing: 0.5px;
}

.btn-icon {
    font-size: 18px;
    margin-left: 2px;
}

/* 在小屏幕上调整按钮位置和大小 */
@media screen and (max-width: 768px) {
    .visualization-btn {
        top: 20px;
        right: 20px;
        padding: 8px 15px;
        font-size: 14px;
        border-radius: 15px;
    }

    .btn-icon {
        font-size: 15px;
    }
}

/* 添加A4纸张样式 */
@page {
  size: A4;
  margin: 0;
}

/* 设置每个页面的容器 */
.page {
  width: 210mm;  /* A4纸的宽度 */
  height: 297mm; /* A4纸的高度 */
  padding: 20mm; /* 页面边距 */
  margin: 0 auto;
  background: white;
  box-sizing: border-box;
  page-break-after: always; /* 强制分页 */
}

@media print {
  /* 打印时的样式 */
  html, body {
    width: 210mm;
    height: 297mm;
    margin: 0;
    padding: 0;
  }
  
  .page {
    margin: 0;
    border: none;
    break-after: page;
  }
  
  /* 隐藏不需要打印的元素 */
  .visualization-btn,
  .back-to-toc {
    display: none !important;
  }
  
  /* 表格跨页时重复表头 */
  thead {
    display: table-header-group;
  }
} 