/* print.css - quy dinh in */
@media print {
  @page {
    /* Anh mau 1: giay doc (Portrait), gon 1 trang, nen trang. */
    size: A4 portrait;
    margin: 10mm 8mm;
  }
  body.print-giachu {
    background: #fff;
  }
  /* Trang in gia chu: chi giu lai to giay, an het chrome xung quanh.
     Dung display:none (thay vi visibility) de Edge/Chrome khong in trang trang. */
  body.print-giachu header,
  body.print-giachu nav,
  body.print-giachu .giatop button {
    display: none !important;
  }
  body.print-giachu .giatop,
  body.print-giachu .giawrap {
    background: none;
    border: 0;
    padding: 0;
  }
  body.print-giachu .giapaper {
    margin: 0;
    max-width: none;
    width: 100%;
    box-shadow: none;
    min-height: auto;
  }
  body.print-giachu .giarow,
  body.print-giachu .giablock,
  body.print-giachu .giaperson,
  body.print-giachu .giayear {
    break-inside: avoid;
  }
  body.print-giachu .giatable thead th {
    background: #fff !important;
    color: #000 !important;
  }
  body.print-giachu .giatable tbody tr {
    break-inside: avoid;
  }
}
@media print {
  /* Man Xem (#xem): chi in cac la so, an het thanh cong cu/chan trang.
     Khong dung visibility:hidden de tranh ke thua visibility lam trang giay. */
  body:not(.print-giachu) header,
  body:not(.print-giachu) .pv-bar,
  body:not(.print-giachu) .pv-title,
  body:not(.print-giachu) .sheet-foot,
  body:not(.print-giachu) .pv-note {
    display: none !important;
  }
  body:not(.print-giachu) #preview,
  body:not(.print-giachu) #pv_sheets {
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
  }
  body:not(.print-giachu) .pv-item {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    background: #fff !important;
    page-break-inside: avoid;
    break-inside: avoid;
    page-break-after: auto;
    break-after: auto;
  }
  body:not(.print-giachu) .pv-item + .pv-item {
    page-break-before: always;
    break-before: page;
  }
  /* To so thuong: nen trang, chu den, can deu nhu anh mau 1.
     Dung zoom (do JS dat) thay vi transform:scale de khong du
     chieu cao ao -> khong lot trang trang thu 2. */
  body:not(.print-giachu) .pv-item .sheet {
    position: static !important;
    overflow: visible !important;
    max-height: none !important;
    width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    gap: 10px !important;
    border: 0 !important;
    background: #fff !important;
    color: #000 !important;
    transform: none !important;
    justify-content: space-between;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  body:not(.print-giachu) .pv-item .sheet .grp {
    gap: 6px !important;
  }
  body:not(.print-giachu) .pv-item .sheet i {
    color: #000 !important;
  }
}
@media print {
  /* So Phat Duong: cung nen trang, giay doc nhu anh mau 1.
     Canvas goc 1226x874 nam ngang -> thu ve vua rong giay doc:
     vung in A4 doc le 8mm = 194mm ~ 733px => 733/1226 = 0.598.
     Khung ngoai giu dung kich thuoc sau thu (733x523) de khong
     trang trang, khong lot trang thu 2. */
  body:not(.print-giachu) .sopd-frame {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: 733px !important;
    max-width: 100% !important;
    height: 523px !important;
    overflow: hidden !important;
    transform: none !important;
    margin: 0 auto !important;
    background: #fff !important;
  }
  body:not(.print-giachu) .sopd-scale {
    width: 1226px !important;
    height: 874px !important;
    transform: scale(0.598) !important;
    transform-origin: top left !important;
  }
  body:not(.print-giachu) #so-canvas {
    transform: none !important;
    background: #fff !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
@media print {
  /* Che do chinh sua: khong dua UI sua vao PDF/in */
  body:not(.print-giachu) .sopd-bar,
  body:not(.print-giachu) .sopd-guide,
  body:not(.print-giachu) .sopd-input {
    display: none !important;
  }
  body:not(.print-giachu) .sopd-w.sopd-sel,
  body:not(.print-giachu) .sopd-col.sopd-colsel,
  body:not(.print-giachu) .sopd-editing .sopd-col:hover {
    outline: none !important;
  }
}
