/* ============================================================
   Optix Blood Bank — print.css
   Print styles for receipts (.rcpt) and reports (.rpt),
   plus standalone print-window styling.

   Notes:
   - No external resources (no @import, no url() assets) so the
     stylesheet works when linked from a document.write() page
     opened via window.open().
   - Use only class-based selectors below; nothing depends on the
     parent app's stylesheet being present.
   ============================================================ */

@page {
  size: A4;
  margin: 14mm 12mm 16mm 12mm;
  /* Footer with page numbers on every printed page */
  @bottom-center {
    content: "Page " counter(page) " of " counter(pages);
    font-size: 9px;
    font-family: Arial, Helvetica, sans-serif;
    color: #666;
  }
  @bottom-right {
    content: "Powered by System Optix";
    font-size: 9px;
    font-family: Arial, Helvetica, sans-serif;
    color: #999;
  }
}

/* ---------- App-shell print rules (for in-app printing) ---------- */
@media print {
  /* Hide interactive / navigational chrome */
  .bb-sidebar,
  .bb-topbar,
  .toolbar,
  .no-print,
  #toasts,
  .modal-back,
  .modal,
  button,
  .btn,
  input,
  select,
  textarea,
  nav,
  aside,
  header.bb-topbar,
  footer.app-footer {
    display: none !important;
  }

  /* Expand the main area to full width */
  .bb-main,
  main,
  .content,
  .page,
  .print-area {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 13px;
  }

  /* Remove shadows / rounding that waste ink */
  * {
    box-shadow: none !important;
    text-shadow: none !important;
    border-radius: 0 !important;
  }

  a {
    color: #000 !important;
    text-decoration: none !important;
  }

  /* Repeat table headers across pages and keep rows intact */
  thead {
    display: table-header-group !important;
  }
  tfoot {
    display: table-footer-group !important;
  }
  tr {
    page-break-inside: avoid !important;
  }
  table {
    page-break-inside: auto;
  }
}

/* ---------- Standalone print window (document.write via window.open) ---------- */
body.print-doc {
  padding: 24px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  color: #000;
  background: #fff;
  margin: 0;
}

/* ============================================================
   .rcpt — Blood Issue Receipt
   ============================================================ */
.rcpt {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  color: #000;
  background: #fff;
  max-width: 780px;
  margin: 0 auto;
}

/* Centered letterhead */
.rcpt .rcpt-head {
  text-align: center;
  margin-bottom: 6px;
}
.rcpt .rcpt-bank-name {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin: 0 0 2px 0;
}
.rcpt .rcpt-bank-sub {
  font-size: 12px;
  color: #333;
  margin: 0;
}
/* Red accent rule under the letterhead */
.rcpt .rcpt-rule {
  border: 0;
  border-top: 3px solid #b71c1c;
  margin: 8px 0 10px 0;
}

/* Receipt title */
.rcpt .rcpt-title {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0 0 10px 0;
}

/* Meta grid: receipt no / date / issued by / patient / ward */
.rcpt .rcpt-meta {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
  font-size: 12.5px;
}
.rcpt .rcpt-meta td {
  padding: 3px 6px;
  vertical-align: top;
}
.rcpt .rcpt-meta td.k {
  font-weight: 700;
  white-space: nowrap;
  width: 1%;
}

/* Items table with full borders */
.rcpt .rcpt-items {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 10px 0;
  font-size: 12.5px;
}
.rcpt .rcpt-items th,
.rcpt .rcpt-items td {
  border: 1px solid #000;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}
.rcpt .rcpt-items thead th {
  background: #f2f2f2;
  font-weight: 700;
}
.rcpt .rcpt-items td.num,
.rcpt .rcpt-items th.num {
  text-align: right;
  white-space: nowrap;
}

/* Totals block, right-aligned */
.rcpt .rcpt-totals {
  text-align: right;
  margin: 0 0 26px 0;
  font-size: 13px;
}
.rcpt .rcpt-totals .trow {
  margin: 2px 0;
}
.rcpt .rcpt-totals .grand {
  font-size: 15px;
  font-weight: 800;
  border-top: 2px solid #000;
  display: inline-block;
  padding-top: 4px;
  margin-top: 4px;
  min-width: 220px;
}

/* Signature blocks — two columns */
.rcpt .rcpt-sign {
  display: table;
  width: 100%;
  margin: 34px 0 12px 0;
  page-break-inside: avoid;
}
.rcpt .rcpt-sign .sig {
  display: table-cell;
  width: 50%;
  vertical-align: bottom;
}
.rcpt .rcpt-sign .sig .line {
  border-top: 1px solid #000;
  margin-top: 44px;
  padding-top: 4px;
  font-size: 12px;
  font-weight: 700;
}
.rcpt .rcpt-sign .sig:first-child .line {
  margin-right: 24px;
}
.rcpt .rcpt-sign .sig:last-child {
  text-align: right;
}
.rcpt .rcpt-sign .sig:last-child .line {
  margin-left: 24px;
}

/* Footer note — small gray */
.rcpt .rcpt-foot {
  font-size: 10.5px;
  color: #666;
  text-align: center;
  margin-top: 10px;
  border-top: 1px solid #ccc;
  padding-top: 8px;
}

/* ============================================================
   .rpt — Report document
   ============================================================ */
.rpt {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  color: #000;
  background: #fff;
  max-width: 1000px;
  margin: 0 auto;
}

/* Letterhead */
.rpt .rpt-head {
  text-align: center;
  margin-bottom: 6px;
}
.rpt .rpt-bank-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin: 0 0 2px 0;
}
.rpt .rpt-bank-sub {
  font-size: 12px;
  color: #333;
  margin: 0;
}
.rpt .rpt-rule {
  border: 0;
  border-top: 2px solid #0d47a1;
  margin: 8px 0 10px 0;
}

/* Report title + meta line (generated date + filters) */
.rpt .rpt-title {
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin: 0 0 4px 0;
}
.rpt .rpt-meta {
  text-align: center;
  font-size: 11.5px;
  color: #333;
  margin: 0 0 12px 0;
}
.rpt .rpt-meta .f {
  display: inline-block;
  margin: 0 8px;
}
.rpt .rpt-section {
  font-size: 14px;
  font-weight: 700;
  margin: 16px 0 6px 0;
  page-break-after: avoid;
}

/* Tables with borders; thead repeats; rows never split */
.rpt table.rpt-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 14px 0;
  font-size: 12.5px;
  page-break-inside: auto;
}
.rpt .rpt-table th,
.rpt .rpt-table td {
  border: 1px solid #000;
  padding: 5px 7px;
  text-align: left;
  vertical-align: top;
}
.rpt .rpt-table thead {
  display: table-header-group;
}
.rpt .rpt-table thead th {
  background: #f2f2f2;
  font-weight: 700;
  page-break-inside: avoid;
}
.rpt .rpt-table tr {
  page-break-inside: avoid;
}
.rpt .rpt-table td.num,
.rpt .rpt-table th.num {
  text-align: right;
  white-space: nowrap;
}
.rpt .rpt-table td.c,
.rpt .rpt-table th.c {
  text-align: center;
}
.rpt .rpt-table tfoot {
  display: table-footer-group;
}
.rpt .rpt-table tfoot td {
  font-weight: 700;
  background: #fafafa;
}

/* Keep related blocks together */
.rpt .rpt-group,
.rpt .rpt-summary {
  page-break-inside: avoid;
}

/* Report footer (in-flow note; page numbers come from @page) */
.rpt .rpt-foot {
  font-size: 10.5px;
  color: #666;
  text-align: center;
  margin-top: 12px;
  border-top: 1px solid #ccc;
  padding-top: 8px;
}

/* ============================================================
   Small generic print helpers (shared by .rcpt / .rpt docs)
   ============================================================ */
.pb-before { page-break-before: always; }
.pb-avoid  { page-break-inside: avoid; }

@media print {
  .pb-before { page-break-before: always !important; }
  .pb-avoid  { page-break-inside: avoid !important; }
}
