/* Auto-paired 1:1 with js/printsheet.js — edit styles for that module here */

/* Font tulisan tangan untuk hasil input (file ada di ./fonts/) */
@font-face { font-family: 'Dancing Script'; font-weight: 500; font-style: normal; font-display: block;
  src: url('../fonts/dancing-script-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Dancing Script'; font-weight: 600; font-style: normal; font-display: block;
  src: url('../fonts/dancing-script-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Dancing Script'; font-weight: 700; font-style: normal; font-display: block;
  src: url('../fonts/dancing-script-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Caveat'; font-weight: 500; font-style: normal; font-display: block;
  src: url('../fonts/caveat-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Caveat'; font-weight: 600; font-style: normal; font-display: block;
  src: url('../fonts/caveat-latin-600-normal.woff2') format('woff2'); }

.print-only { display: none; }

@media print {
  @page {
    size: A4 landscape;
    margin: 8mm 8mm;
  }

  /* Sembunyikan semua kecuali area cetak */
  body { background: #fff !important; margin: 0; padding: 0; }
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  .print-only { display: block; }

  .print-page {
    font-family: Arial, Helvetica, sans-serif;
    color: #111;
    font-size: 8px;
    line-height: 1.25;
    page-break-after: always;
  }
  .print-page:last-child { page-break-after: auto; }
  .print-page-break { page-break-before: always; }

  /* ===== HEADER FIMA ===== */
  .print-header { margin-bottom: 5px; }
  .print-header-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 3px;
    border-bottom: 1.5px solid #111;
    margin-bottom: 4px;
  }

  /* Logo block — mendukung logo gambar atau teks fallback */
  .print-logo-block {
    flex: none;
    text-align: center;
    padding-right: 8px;
    border-right: 1px solid #333;
    min-width: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Logo gambar (dari printsheet.js) */
  .print-logo-img {
    max-width: 60px;
    max-height: 32px;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    margin: 0 auto;
  }

  /* Logo teks (fallback kalau tidak ada gambar) */
  .print-logo {
    font-weight: 900;
    font-size: 17px;
    letter-spacing: 2px;
    line-height: 1;
  }
  .print-logo-sub {
    font-size: 5.5px;
    letter-spacing: 1.5px;
    color: #555;
    margin-top: 1px;
  }

  .print-header-top h2 {
    flex: 1;
    text-align: center;
    font-size: 11.5px;
    margin: 0;
    font-weight: 700;
    letter-spacing: .3px;
  }
  .print-approved {
    flex: none;
    text-align: center;
    font-size: 6.5px;
    padding-left: 8px;
    border-left: 1px solid #333;
  }
  .print-approved-label { font-weight: 700; }
  .print-approved-box { height: 22px; }

  /* ===== TABEL INFO HEADER ===== */
  .print-info-tbl {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 5px;
    font-size: 8px;
  }
  .print-info-tbl td {
    border: 1px solid #333;
    padding: 3px 6px;
    vertical-align: middle;
  }
  .print-info-tbl b { font-weight: 700; }

  /* ===== TABEL LOG SHEET ===== */
  .print-log-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 8px !important;
    table-layout: fixed !important;
    word-wrap: break-word;
  }
  .print-log-tbl th,
  .print-log-tbl td {
    border: 1px solid #333;
    padding: 3px 3px !important;
    vertical-align: middle;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal !important;
    line-height: 1.22;
    text-align: center;
  }
  .print-log-tbl th {
    background: #d9dee3 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    font-size: 7px;
    font-weight: 700;
    padding: 3px 2px !important;
  }
  .print-log-tbl th small {
    font-weight: 500;
    font-size: 5.5px;
    display: block;
    margin-top: 1px;
    color: #333;
  }
  .print-log-tbl thead { display: table-header-group; }
  .print-log-tbl tfoot { display: table-footer-group; }
  .print-log-tbl tbody tr { page-break-inside: avoid; min-height: 18px; }

  .print-log-tbl td.pl { text-align: left; padding-left: 4px !important; }
  .print-log-tbl td.pc { text-align: center; }
  .print-log-tbl td.pt { text-align: center; font-variant-numeric: tabular-nums; }

  /* Lebar kolom proporsional */
  .print-log-tbl .col-kode     { width: 4%; }
  .print-log-tbl .col-op       { width: 4%; }
  .print-log-tbl .col-mulai    { width: 5.5%; }
  .print-log-tbl .col-panggil  { width: 5.5%; }
  .print-log-tbl .col-teknik   { width: 5.5%; }
  .print-log-tbl .col-selesai  { width: 5.5%; }
  .print-log-tbl .col-durasi   { width: 5%; }
  .print-log-tbl .col-kegiatan { width: 17%; }
  .print-log-tbl .col-masalah  { width: 12%; }
  .print-log-tbl .col-disposisi{ width: 13%; }
  .print-log-tbl .col-wo       { width: 7%; }
  .print-log-tbl .col-batch    { width: 12%; }
  .print-log-tbl .col-good     { width: 4%; }
  .print-log-tbl .col-defect   { width: 4%; }

  .print-log-tbl .tot-label {
    text-align: right;
    padding-right: 8px !important;
    font-weight: 700;
    background: #eef2f5 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* ===== HALAMAN 2: 2 KOLOM ===== */
  .print-2col {
    display: flex;
    gap: 10px;
    align-items: flex-start;
  }
  .print-col-left  { flex: 1 1 48%; min-width: 0; }
  .print-col-right { flex: 1 1 52%; min-width: 0; }

  /* ===== KAMUS KECIL ===== */
  .print-kamus-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 7px;
    margin-bottom: 6px;
    table-layout: fixed;
  }
  .print-kamus-tbl th,
  .print-kamus-tbl td {
    border: 1px solid #333;
    padding: 2px 4px;
    vertical-align: top;
    line-height: 1.2;
  }
  .print-kamus-tbl thead th {
    background: #d9dee3 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    font-weight: 700;
    text-align: center;
    font-size: 7.5px;
  }
  .print-kamus-tbl .kamus-k { width: 8%; text-align: center; font-weight: 700; }
  .print-kamus-tbl .kamus-lbl { width: 42%; text-align: left; }

  /* ===== TABEL MINOR STOPPAGES / DEFECT ===== */
  .print-ms-tbl,
  .print-defect-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 7px;
    margin-bottom: 6px;
    table-layout: fixed;
  }
  .print-ms-tbl th, .print-ms-tbl td,
  .print-defect-tbl th, .print-defect-tbl td {
    border: 1px solid #333;
    padding: 2px 4px;
    vertical-align: middle;
    height: 18px;
  }
  .print-ms-tbl thead th,
  .print-defect-tbl thead th {
    background: #d9dee3 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    font-weight: 700;
    text-align: center;
    font-size: 7px;
  }
  .print-ms-tbl th:first-child, .print-ms-tbl td:first-child,
  .print-defect-tbl th:first-child, .print-defect-tbl td:first-child { width: 46%; }
  .print-ms-tbl th:nth-child(2), .print-ms-tbl td:nth-child(2),
  .print-defect-tbl th:nth-child(2), .print-defect-tbl td:nth-child(2) { width: 32%; }
  .print-ms-tbl th:last-child, .print-ms-tbl td:last-child,
  .print-defect-tbl th:last-child, .print-defect-tbl td:last-child { width: 22%; }

  /* ===== TABEL KODE KEGIATAN TKL ===== */
  .print-kktbl-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 7px;
    margin-bottom: 4px;
    table-layout: fixed;
  }
  .print-kktbl-tbl th, .print-kktbl-tbl td {
    border: 1px solid #333;
    padding: 2px 4px;
    vertical-align: middle;
    height: 16px;
  }
  .print-kktbl-tbl thead th {
    background: #d9dee3 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    font-weight: 700;
    text-align: center;
    font-size: 7px;
  }

  /* ===== OEE (kanan) ===== */
  .print-oee-col .oee-matrix-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 7px;
    table-layout: fixed;
  }
  .print-oee-col .oee-matrix-tbl th,
  .print-oee-col .oee-matrix-tbl td {
    border: 1px solid #333;
    padding: 2.5px 4px;
    vertical-align: middle;
    line-height: 1.2;
  }
  .print-oee-col .oee-matrix-tbl th {
    background: #64748b !important;
    color: #fff !important;
    text-align: center;
    font-size: 7.5px;
    font-weight: 700;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-oee-col .oee-matrix-tbl tr.sec-header td {
    background: #d9dee3 !important;
    font-weight: 700;
    font-size: 7.5px;
    text-align: center;
    letter-spacing: .3px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-oee-col .oee-matrix-tbl tr.highlight-res td {
    background: #1a2935 !important;
    color: #fff !important;
    font-size: 9.5px;
    font-weight: 700;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-oee-col .oee-matrix-tbl td.code-col {
    width: 22px;
    text-align: center;
    font-weight: 700;
  }
  .print-oee-col .oee-matrix-tbl td.val-col {
    text-align: right;
    width: 60px;
    font-variant-numeric: tabular-nums;
  }
  .print-oee-col .oee-matrix-tbl small { font-size: 6px; color: #555; }
  .print-oee-col .oee-matrix-tbl tr.highlight-res small { color: #94a3b8; }
  .print-oee-col .badge-avg {
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
    font-weight: inherit !important;
  }

  /* Footer OEE (di bawah tabel) */
  .print-oee-footer {
    margin-top: 6px;
    padding-top: 5px;
    border-top: 1px dashed #333;
    text-align: center;
  }
  .print-oee-formula {
    font-size: 7.5px;
    font-weight: 700;
    margin-bottom: 4px;
  }
  .print-oee-sign {
    font-size: 8px;
    letter-spacing: 2px;
    color: #555;
  }

  /* ===== FORM HALAMAN 1 — meniru form kertas FIMA ===== */
  /* Tinta biru untuk semua tulisan hasil input */
  /* Ganti gaya tulisan: ubah --ink-font ke var(--ink-font-caveat) bila mau Caveat */
  .print-form {
    --ink: #1636b8;
    --ink-font-dancing: 'Dancing Script', 'Segoe Script', 'Lucida Handwriting', cursive;
    --ink-font-caveat: 'Caveat', 'Segoe Print', cursive;
    --ink-font: var(--ink-font-dancing);
    --ink-weight: 600;
    --ink-size: 10px;
  }
  .print-form .ink,
  .print-form .pf-log tbody td {
    color: var(--ink) !important;
    font-family: var(--ink-font);
    font-weight: var(--ink-weight);
    font-size: var(--ink-size);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-form .pf-head .pf-op-box { font-size: 10px; }

  .pf-head {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin-bottom: 2mm;
    font-size: 7.5px;
  }
  .pf-head td { border: 1px solid #222; padding: 1.5mm 2mm; vertical-align: top; }
  .pf-head .pf-c-logo  { width: 11%; }
  .pf-head .pf-c-tgl   { width: 15%; }
  .pf-head .pf-c-mesin { width: 22%; }
  .pf-head .pf-c-kec   { width: 22%; }
  .pf-head .pf-c-ops   { width: 12%; }
  .pf-head .pf-c-ttd   { width: 9%; }
  .pf-head .pf-logo { text-align: center; vertical-align: middle; }
  .pf-head .pf-logo .print-logo-img { max-width: 20mm; max-height: 12mm; }
  .pf-head .pf-title {
    text-align: center;
    vertical-align: middle;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .3px;
    padding: 1.2mm 2mm;
  }
  .pf-head .pf-cell div { line-height: 1.5; }
  .pf-head .pf-cell small { font-size: 6px; font-weight: 400; }
  .pf-head .pf-ops {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1mm;
    margin-top: 1mm;
  }
  .pf-head .pf-op-box {
    border: 1px solid #222;
    height: 5mm;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    overflow: hidden;
  }
  .pf-head .pf-appr-h {
    text-align: center;
    font-size: 6.5px;
    padding: .8mm 1mm;
    height: 4mm;
  }
  .pf-head .pf-sign { height: 9mm; text-align: center; vertical-align: bottom; padding: .6mm; }
  .pf-head .pf-sign small { font-size: 5.5px; }

  .pf-log { font-size: 8px !important; }
  .pf-log th, .pf-log td { border: 1px solid #222; }
  .pf-log thead th {
    background: #fff !important;
    font-size: 6.5px;
    padding: 1mm 1px !important;
  }
  .pf-log thead th small { font-size: 5px; }
  .pf-log tbody tr { height: 5.2mm; }
  .pf-log tbody td { padding: 0 2px !important; line-height: 1.15; }
  .pf-log .col-kode     { width: 3.5%; }
  .pf-log .col-op       { width: 4.5%; }
  .pf-log .col-mulai,
  .pf-log .col-panggil,
  .pf-log .col-teknik,
  .pf-log .col-selesai  { width: 5%; }
  .pf-log .col-durasi   { width: 5%; }
  .pf-log .col-kegiatan { width: 18%; }
  .pf-log .col-masalah  { width: 11.5%; }
  .pf-log .col-disposisi{ width: 11.5%; }
  .pf-log .col-wo       { width: 6.5%; }
  .pf-log .col-batch    { width: 9%; }
  .pf-log .col-good,
  .pf-log .col-defect   { width: 4.5%; }

  /* ===== SEMBUNYIKAN ELEMEN INTERAKTIF ===== */
  .btn, button, .del, .th-bulk-btn, .col-preset-btn,
  .view-toggle, .help-btn, input, select, textarea {
    display: none !important;
  }
  .print-page .tbl-wrap {
    overflow: visible !important;
    max-height: none !important;
  }
  .print-page table {
    max-width: 100% !important;
  }
}