/**
 * 评价档案打印样式
 * A4纸优化，每页独立分页，打印效果与PDF模版一致
 */

/* ===== 档案视图容器 ===== */
#archiveView {
  display: none;
  background: #e8e8e8;
  min-height: 100vh;
  padding: 20px 0;
}

#archiveView.active {
  display: block;
}

/* 档案工具栏 */
.archive-toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.archive-toolbar .toolbar-title {
  font-size: 16px;
  font-weight: 600;
  margin-right: auto;
}

.archive-toolbar button {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.archive-toolbar .btn-primary {
  background: #1890ff;
  color: #fff;
}

.archive-toolbar .btn-primary:hover {
  background: #40a9ff;
}

.archive-toolbar .btn-secondary {
  background: #f0f0f0;
  color: #333;
}

.archive-toolbar .btn-secondary:hover {
  background: #d9d9d9;
}

.archive-toolbar .btn-success {
  background: #52c41a;
  color: #fff;
}

.archive-toolbar .btn-success:hover {
  background: #73d13d;
}

/* ===== 档案文档区域 ===== */
.archive-document {
  max-width: 210mm;
  margin: 0 auto;
  padding: 0;
}

/* ===== A4页面 ===== */
.archive-page {
  width: 210mm;
  min-height: 297mm;
  background: #fff;
  margin: 0 auto 20px;
  padding: 20mm 18mm;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  position: relative;
  box-sizing: border-box;
  page-break-after: always;
  break-after: page;
}

.archive-page:last-child {
  page-break-after: auto;
  break-after: auto;
}

/* ===== 通用排版 ===== */
.archive-page .page-header {
  text-align: center;
  font-size: 12pt;
  margin-bottom: 4px;
  color: #333;
}

.archive-page .page-title {
  text-align: center;
  font-size: 18pt;
  font-weight: 700;
  margin: 20px 0 16px;
  color: #1a1a1a;
}

.archive-page .page-footer {
  position: absolute;
  bottom: 10mm;
  left: 18mm;
  right: 18mm;
  text-align: center;
  font-size: 9pt;
  color: #666;
  border-top: 1px solid #ddd;
  padding-top: 4px;
}

.archive-page .attachment-label {
  text-align: center;
  font-size: 10pt;
  color: #666;
  margin-bottom: 8px;
}

.archive-page .doc-title {
  text-align: center;
  font-size: 16pt;
  font-weight: 700;
  margin: 12px 0 20px;
}

/* ===== 封面 ===== */
.cover-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 40mm;
}

.cover-page .cover-org {
  font-size: 14pt;
  margin-bottom: 30px;
}

.cover-page .cover-grade {
  font-size: 16pt;
  font-weight: 600;
  margin-bottom: 40px;
}

.cover-page .cover-main-title {
  font-size: 28pt;
  font-weight: 700;
  margin: 40px 0;
  letter-spacing: 4px;
}

.cover-page .cover-fields {
  margin-top: 40px;
  width: 80%;
}

.cover-page .cover-field {
  display: flex;
  align-items: baseline;
  margin-bottom: 16px;
  font-size: 14pt;
}

.cover-page .cover-field-label {
  min-width: 100px;
  text-align: justify;
  text-align-last: justify;
  margin-right: 8px;
}

.cover-page .cover-field-line {
  flex: 1;
  border-bottom: 1px solid #333;
  min-height: 24px;
  padding: 0 8px;
}

.cover-page .cover-footer {
  margin-top: 60px;
  text-align: center;
  font-size: 12pt;
}

.cover-page .cover-cert {
  font-size: 11pt;
  color: #555;
  margin-top: 8px;
}

/* ===== 目录 ===== */
.toc-list {
  list-style: none;
  padding: 0;
  margin: 20px 0;
}

.toc-list li {
  display: flex;
  align-items: baseline;
  font-size: 12pt;
  margin-bottom: 12px;
  line-height: 1.8;
}

.toc-list .toc-name {
  flex: 1;
}

.toc-list .toc-dots {
  flex: 1;
  border-bottom: 1px dotted #999;
  margin: 0 8px;
  position: relative;
  top: -4px;
}

.toc-list .toc-pages {
  min-width: 60px;
  text-align: right;
}

/* ===== 表格通用样式 ===== */
.archive-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5pt;
  margin: 8px 0;
}

.archive-table th,
.archive-table td {
  border: 1px solid #333;
  padding: 6px 8px;
  text-align: left;
  line-height: 1.5;
  vertical-align: top;
}

.archive-table th {
  background: #f5f5f5;
  font-weight: 600;
  text-align: center;
}

.archive-table .label-cell {
  background: #f9f9f9;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  width: 90px;
}

.archive-table .center {
  text-align: center;
}

.archive-table .fill-cell {
  min-height: 24px;
}

/* 信息表（企业名称、行业类别等） */
.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11pt;
  margin: 8px 0;
}

.info-table td {
  border: 1px solid #333;
  padding: 8px 10px;
  line-height: 1.6;
}

.info-table .info-label {
  background: #f5f5f5;
  font-weight: 600;
  text-align: center;
  width: 100px;
  white-space: nowrap;
}

/* ===== 复选框 ===== */
.checkbox-item {
  display: inline-block;
  margin-right: 16px;
  font-size: 11pt;
  white-space: nowrap;
}

.checkbox-item .cb {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1.5px solid #333;
  margin-right: 4px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.checkbox-item .cb.checked::after {
  content: '\2713';
  position: absolute;
  top: -4px;
  left: 1px;
  font-size: 16px;
  font-weight: 700;
}

/* ===== 签字区域 ===== */
.signature-area {
  margin-top: 24px;
  display: flex;
  justify-content: space-around;
  gap: 40px;
}

.signature-block {
  text-align: center;
  font-size: 11pt;
}

.signature-block .sig-line {
  border-bottom: 1px solid #333;
  min-width: 120px;
  height: 32px;
  margin: 4px auto;
}

.signature-block .sig-date {
  font-size: 10pt;
  color: #555;
  margin-top: 4px;
}

/* ===== 评价分汇总表 ===== */
.score-summary-table th {
  text-align: center;
  padding: 8px 6px;
}

.score-summary-table td {
  text-align: center;
  padding: 6px;
}

.score-summary-table .chapter-name {
  text-align: left;
  padding-left: 12px;
}

.score-summary-table .total-row td {
  font-weight: 700;
  background: #f0f0f0;
}

/* ===== 扣分项汇总表 ===== */
.deduction-table th {
  text-align: center;
  padding: 6px 4px;
  font-size: 10pt;
}

.deduction-table td {
  padding: 5px 6px;
  font-size: 10pt;
}

.deduction-table .seq-col {
  width: 40px;
  text-align: center;
}

.deduction-table .dept-col {
  width: 70px;
  text-align: center;
}

.deduction-table .deduct-col {
  width: 50px;
  text-align: center;
}

.deduction-table .ar-col {
  width: 50px;
  text-align: center;
}

.deduction-table .fix-col {
  width: 50px;
  text-align: center;
}

/* ===== 综述文字 ===== */
.narrative-section {
  font-size: 11pt;
  line-height: 1.8;
  margin: 12px 0;
}

.narrative-section .narrative-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.narrative-section .narrative-content {
  text-indent: 2em;
  margin-bottom: 8px;
}

.narrative-section .narrative-improve {
  color: #444;
  text-indent: 2em;
}

/* ===== 可编辑字段 ===== */
.editable-field {
  background: #fffde6;
  border-bottom: 1px dashed #d4b106;
  min-width: 60px;
  display: inline-block;
  padding: 0 4px;
  cursor: text;
}

.editable-field:empty::before {
  content: attr(data-placeholder);
  color: #bbb;
}

.editable-field:focus {
  background: #fffbe6;
  outline: 1px solid #d4b106;
}

/* 输入框样式（编辑模式） */
.archive-input {
  border: none;
  border-bottom: 1px solid #333;
  background: transparent;
  font-size: inherit;
  font-family: inherit;
  padding: 2px 4px;
  min-width: 80px;
  outline: none;
}

.archive-input:focus {
  background: #fffde6;
}

.archive-textarea {
  border: 1px solid #ddd;
  background: #fafafa;
  font-size: 11pt;
  font-family: inherit;
  padding: 6px 8px;
  width: 100%;
  min-height: 60px;
  resize: vertical;
  outline: none;
}

.archive-textarea:focus {
  background: #fffde6;
  border-color: #d4b106;
}

/* ===== 打印优化 ===== */
@media print {
  @page {
    size: A4;
    margin: 0;
  }

  body {
    background: #fff !important;
    margin: 0;
    padding: 0;
  }

  .archive-toolbar,
  .app-header,
  .nav-bar,
  #homeView,
  #projectView,
  .no-print {
    display: none !important;
  }

  #archiveView {
    display: block !important;
    background: #fff !important;
    padding: 0 !important;
  }

  .archive-document {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .archive-page {
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    padding: 20mm 18mm;
    box-shadow: none;
    page-break-after: always;
    break-after: page;
  }

  .archive-page:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  .editable-field {
    background: transparent !important;
    border-bottom: none !important;
  }

  .archive-input {
    border-bottom: 1px solid #333;
  }

  .archive-textarea {
    background: transparent !important;
    border: none !important;
  }

  .archive-table th {
    background: #f5f5f5 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .info-table .info-label,
  .archive-table .label-cell {
    background: #f9f9f9 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ===== 签到表 ===== */
.signin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10pt;
}

.signin-table th,
.signin-table td {
  border: 1px solid #333;
  padding: 6px 4px;
  text-align: center;
  height: 28px;
}

.signin-table .seq {
  width: 36px;
  font-weight: 600;
  background: #f5f5f5;
}

/* ===== 会议记录 ===== */
.meeting-record {
  font-size: 11pt;
  line-height: 1.8;
}

.meeting-record .record-section {
  margin: 10px 0;
}

.meeting-record .record-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.meeting-record .record-content {
  text-indent: 2em;
}

/* ===== 评价日程表 ===== */
.schedule-table th {
  text-align: center;
  padding: 6px 4px;
  font-size: 10pt;
}

.schedule-table td {
  padding: 5px 6px;
  font-size: 10pt;
  vertical-align: top;
}

/* ===== 评价报告 ===== */
.report-section-title {
  font-size: 14pt;
  font-weight: 700;
  margin: 16px 0 10px;
  padding-bottom: 4px;
  border-bottom: 2px solid #333;
}

.report-subsection {
  font-size: 12pt;
  font-weight: 600;
  margin: 12px 0 6px;
}

.report-content {
  font-size: 11pt;
  line-height: 1.8;
  text-indent: 2em;
  margin-bottom: 8px;
}
