﻿/* 钲鹏机床ERP - 打印模板 & 标签样式 */

/* === 打印页面通用 === */
@media print {
  @page {
    size: A4;
    margin: 10mm;
  }
  body {
    background: white !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .no-print {
    display: none !important;
  }
}

/* === A4 单据打印模板 === */
.print-doc {
  width: 190mm;
  min-height: 270mm;
  padding: 15mm;
  margin: 0 auto;
  background: white;
  font-family: 'SimSun', '宋体', serif;
  font-size: 12pt;
  border: 1px solid #ccc;
  page-break-after: always;
}

.print-header {
  text-align: center;
  margin-bottom: 10mm;
  padding-bottom: 5mm;
  border-bottom: 2px solid #333;
}

.print-header h1 {
  font-size: 20pt;
  font-weight: bold;
  margin: 0 0 4mm 0;
  letter-spacing: 3mm;
}

.print-company {
  font-size: 14pt;
  color: #333;
}

.print-info {
  margin-bottom: 8mm;
}

.print-info-row {
  display: flex;
  padding: 2mm 0;
  font-size: 11pt;
  border-bottom: 1px dotted #ddd;
}

.print-info-row span {
  min-width: 25mm;
  color: #666;
}

.print-info-row strong {
  flex: 1;
  border-bottom: 1px solid #999;
  padding: 0 2mm;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8mm;
}

.print-table th,
.print-table td {
  border: 1px solid #333;
  padding: 3mm 2mm;
  font-size: 10pt;
  text-align: center;
}

.print-table thead th {
  background: #f0f0f0;
  font-weight: bold;
}

.print-table tfoot td {
  border: none;
  padding: 3mm 2mm;
  text-align: right;
}

.print-table tfoot td strong {
  font-size: 12pt;
}

.print-footer {
  margin-top: 10mm;
}

.print-sign {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6mm;
  font-size: 11pt;
}

.print-sign span {
  min-width: 40%;
}

/* === 正文内容区域（合同条款、注意事项等） === */
.print-body-content {
  margin: 5mm 0;
  padding: 3mm 0;
  border-top: 1px dashed #ccc;
  border-bottom: 1px dashed #ccc;
  line-height: 1.8;
}

.print-body-content p {
  text-indent: 2em;
  margin: 2mm 0;
  line-height: 1.8;
}

/* === 标签打印模板 === */
.label-print-sheet {
  display: flex;
  flex-wrap: wrap;
  gap: 3mm;
  padding: 5mm;
  justify-content: flex-start;
}

/* === 新版标签（renderPrintContent 渲染，含 CODE128 一维码） === */
.label-doc {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0;
  padding: 2mm;
  border: 1.5px solid #333;
  border-radius: 2px;
  background: white;
  font-family: 'Microsoft YaHei', '微软雅黑', sans-serif;
  page-break-after: auto;
  page-break-inside: avoid;
  box-sizing: border-box;
}

.label-print-header {
  font-size: 7pt;
  color: #999;
  text-align: center;
  letter-spacing: 1mm;
  margin-bottom: 1mm;
}

.label-main-title {
  font-size: 13pt;
  font-weight: bold;
  text-align: center;
  color: #000;
  line-height: 1.2;
  margin: 1mm 0;
  word-break: break-all;
}

.label-print-info {
  display: flex;
  gap: 2mm;
  margin: 0;
}

.label-print-info .print-info-row {
  padding: 0.7mm 0;
  font-size: 7.5pt;
  border-bottom: none;
}

.label-print-info .print-info-row span {
  min-width: auto;
  color: #555;
}

.label-print-info .print-info-row strong {
  flex: 1;
  border-bottom: none;
  padding: 0;
  color: #000;
}

/* CODE128 一维码区（扫码枪可扫） */
.label-barcode-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: auto;
}

.label-barcode {
  width: 100%;
  height: auto;
  display: block;
}

.label-barcode-text {
  font-size: 8pt;
  font-weight: bold;
  text-align: center;
  letter-spacing: 1px;
  margin-top: 0.5mm;
}

.label-barcode-fallback {
  font-size: 10pt;
  font-weight: bold;
  text-align: center;
  padding: 2mm;
}

.print-label {
  display: inline-flex;
  flex-direction: column;
  border: 1.5px solid #333;
  border-radius: 3px;
  overflow: hidden;
  font-family: 'Microsoft YaHei', '微软雅黑', sans-serif;
  page-break-inside: avoid;
}

/* 物料标签 - 70x40mm */
.material-label {
  width: 70mm;
  height: 40mm;
  padding: 2mm;
}

/* 仓库标签 - 80x50mm */
.warehouse-label {
  width: 80mm;
  height: 50mm;
  padding: 2.5mm;
}

/* 仓位标签 - 60x30mm */
.location-label {
  width: 60mm;
  height: 30mm;
  padding: 2mm;
}

/* 库存标签 - 70x50mm */
.inventory-label {
  width: 70mm;
  height: 50mm;
  padding: 2.5mm;
}

/* 装箱标签 - 80x60mm */
.box-label {
  width: 80mm;
  height: 60mm;
  padding: 3mm;
}

.label-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5mm;
  padding-bottom: 1mm;
  border-bottom: 1px solid #ddd;
}

.label-company {
  font-size: 8pt;
  font-weight: bold;
  color: var(--primary);
}

.label-type {
  font-size: 7pt;
  background: var(--primary);
  color: white;
  padding: 0.5mm 2mm;
  border-radius: 2px;
}

.label-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.label-code {
  font-size: 12pt;
  font-weight: bold;
  color: #333;
  margin-bottom: 1mm;
}

.label-name {
  font-size: 10pt;
  color: #555;
  margin-bottom: 1mm;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.label-spec {
  font-size: 8pt;
  color: #888;
}

.label-footer {
  margin-top: 1.5mm;
  padding-top: 1mm;
  border-top: 1px solid #ddd;
}

.label-row {
  font-size: 7pt;
  color: #555;
  padding: 0.3mm 0;
}

.label-row span {
  color: #999;
}

.label-barcode {
  text-align: center;
  font-family: 'Libre Barcode 39', 'Courier New', monospace;
  font-size: 16pt;
  letter-spacing: 1px;
  color: #333;
  padding: 1mm 0;
  margin-top: 0.5mm;
}

/* === 选择系统工具栏 === */
.selection-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #e8f0fe, var(--primary-bg));
  border: 1px solid #c6dafc;
  border-radius: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.sel-count {
  font-size: 14px;
  color: var(--primary);
  font-weight: 500;
  margin-right: 8px;
  white-space: nowrap;
}

.sel-count strong {
  font-size: 18px;
  color: #1a73e8;
}

/* 选择表格 */
.selectable-table .select-all-checkbox,
.selectable-table .row-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

.selectable-table .selectable-row:hover {
  background: #f0f6ff;
}

.selectable-table .selectable-row:has(.row-checkbox:checked) {
  background: #e8f0fe;
}

/* === 模块工具栏 === */
.module-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* === 打印预览容器 === */
.print-preview-container {
  background: #f5f5f5;
  padding: 20px;
  border-radius: 8px;
  max-height: 70vh;
  overflow-y: auto;
}

/* === 响应式调整 === */
@media (max-width: 768px) {
  .selection-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .module-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .label-print-sheet {
    justify-content: center;
  }
}
