/* ================================================
   PRINT STYLESHEET
   Matches the Excel sample EXACTLY on A4 paper
   ================================================ */

@media print {

  /* ---- Hide everything except print area ---- */
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }

  /* ---- Page Setup (Hiding browser headers/footers) ---- */
  @page {
    size: A4 portrait;
    margin: 0;
  }
  
  body {
    margin: 0;
    background: white !important;
    color: #000 !important;
    font-family: 'Noto Sans SC', 'SimSun', 'Arial', sans-serif !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* ---- Print Document Wrapper ---- */
  .print-doc {
    width: 100%;
    padding: 10mm 12mm 14mm 12mm;
    box-sizing: border-box;
    font-size: 9pt;
    color: #000;
  }

  /* ---- Header ---- */
  .print-header-title {
    text-align: center;
    margin-bottom: 4pt;
  }
  .print-header-title .company-name {
    font-size: 14pt;
    font-weight: bold;
    display: block;
  }
  .print-header-title .form-name {
    font-size: 11pt;
    font-weight: bold;
    display: block;
    margin-top: 2pt;
  }

  /* ---- All tables share this ---- */
  .print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
  }
  .print-table td,
  .print-table th {
    border: 1px solid #000;
    padding: 3pt 4pt;
    vertical-align: middle;
    line-height: 1.3;
  }

  /* ---- Meta Info Table ---- */
  .meta-table td {
    font-size: 9pt;
  }
  .meta-label {
    background: #f0f0f0;
    font-weight: bold;
    white-space: nowrap;
    width: 90pt;
    text-align: center;
  }
  .meta-value { text-align: center; }
  .meta-highlight { color: #c00; font-weight: bold; }
  .meta-date-value { text-align: center; font-weight: bold; }

  /* ---- Column Headers ---- */
  .print-table thead tr th {
    background: #f5f5f5;
    font-weight: bold;
    text-align: center;
    font-size: 8.5pt;
    border: 1px solid #000;
  }
  .print-table thead th .cn { display: block; }
  .print-table thead th .en { display: block; font-size: 7.5pt; }

  /* ---- Items Column Widths ---- */
  .print-table th:nth-child(1) { width: 28pt; } /* Item */
  .print-table th:nth-child(2) { width: 65pt; } /* Desc */
  .print-table th:nth-child(3) { width: 90pt; } /* English */
  .print-table th:nth-child(4) { width: 75pt; } /* Spec */
  .print-table th:nth-child(5) { width: 32pt; } /* Unit */
  .print-table th:nth-child(6) { width: 32pt; } /* Qty */
  .print-table th:nth-child(7) { width: 55pt; } /* Notes */
  .print-table th:nth-child(8) { width: 55pt; } /* Using Date */
  .print-table th:nth-child(9) { width: 55pt; } /* Remark (Img) */

  /* ---- Items Body ---- */
  .print-table tbody td {
    text-align: center;
    font-size: 9pt;
    height: 38pt; /* Slightly taller for images */
    padding: 1pt;
    vertical-align: middle;
  }
  .print-table tbody td.td-en {
    font-style: italic;
    font-family: 'Arial', sans-serif;
    color: #b00; /* Dark red as requested for clarity */
    font-weight: 500;
  }
  .td-remark-img {
    padding: 0 !important; /* Reset padding to let image sit perfectly */
  }
  .td-remark-img img {
    max-width: 50pt;
    max-height: 36pt;
    object-fit: contain;
    display: block;
    margin: auto;
  }

  /* ---- Footer note ---- */
  .print-footer-note {
    font-size: 8pt;
    padding: 3pt 4pt;
    border: 1px solid #000;
    border-top: none;
    font-style: italic;
  }

  /* ---- Signature Row ---- */
  .print-sign-table td {
    height: 52pt;
    font-size: 8.5pt;
    padding: 6pt 4pt;
    border: 1px solid #000;
  }
  .print-sign-table .sign-label-cell { 
    background: #f5f5f5 !important;
    font-weight: bold;
    vertical-align: middle;
    text-align: left;
  }
  .print-sign-table .sign-space-cell {
    vertical-align: bottom;
    text-align: center;
    font-weight: bold;
    color: #c00;
  }
}
