/**
 * Browser receipt printing — isolate #receipt_section from app/POS chrome.
 * Loaded globally wherever layouts include #receipt_section.
 *
 * Tailwind layouts do not ship Bootstrap grid/table CSS. Legacy invoice designs
 * (classic, elegant, slim, etc.) still use .row / .col-xs-* / .table-slim —
 * restore those utilities here, scoped to the receipt mount only.
 */

.print_section {
  display: none;
}

/* --- Bootstrap-ish layout for receipt HTML (screen + print) --- */
#receipt_section {
  box-sizing: border-box;
  color: #000;
  background: #fff;
  font-size: 13px;
  line-height: 1.35;
}

#receipt_section *,
#receipt_section *::before,
#receipt_section *::after {
  box-sizing: border-box;
}

#receipt_section .row {
  margin-left: -8px;
  margin-right: -8px;
}

#receipt_section .row::before,
#receipt_section .row::after {
  content: " ";
  display: table;
}

#receipt_section .row::after {
  clear: both;
}

#receipt_section [class*="col-xs-"] {
  float: left;
  position: relative;
  min-height: 1px;
  padding-left: 8px;
  padding-right: 8px;
}

#receipt_section .col-xs-12 { width: 100%; }
#receipt_section .col-xs-11 { width: 91.66666667%; }
#receipt_section .col-xs-10 { width: 83.33333333%; }
#receipt_section .col-xs-9 { width: 75%; }
#receipt_section .col-xs-8 { width: 66.66666667%; }
#receipt_section .col-xs-7 { width: 58.33333333%; }
#receipt_section .col-xs-6 { width: 50%; }
#receipt_section .col-xs-5 { width: 41.66666667%; }
#receipt_section .col-xs-4 { width: 33.33333333%; }
#receipt_section .col-xs-3 { width: 25%; }
#receipt_section .col-xs-2 { width: 16.66666667%; }
#receipt_section .col-xs-1 { width: 8.33333333%; }

#receipt_section .text-center { text-align: center !important; }
#receipt_section .text-left { text-align: left !important; }
#receipt_section .text-right { text-align: right !important; }
#receipt_section .text-bold,
#receipt_section .font-bold,
#receipt_section strong { font-weight: 700; }

#receipt_section .pull-left { float: left !important; }
#receipt_section .pull-right { float: right !important; }
#receipt_section .center-block {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

#receipt_section .img-responsive,
#receipt_section img.img {
  display: block;
  max-width: 100%;
  height: auto;
}

#receipt_section .table {
  width: 100%;
  max-width: 100%;
  margin-bottom: 8px;
  border-collapse: collapse;
  border-spacing: 0;
  background-color: transparent;
}

#receipt_section .table > thead > tr > th,
#receipt_section .table > tbody > tr > th,
#receipt_section .table > tfoot > tr > th,
#receipt_section .table > thead > tr > td,
#receipt_section .table > tbody > tr > td,
#receipt_section .table > tfoot > tr > td {
  padding: 4px 6px;
  vertical-align: top;
  border-top: 1px solid #ddd;
}

#receipt_section .table > thead > tr > th {
  vertical-align: bottom;
  border-bottom: 2px solid #ddd;
}

#receipt_section .table-bordered {
  border: 1px solid #ddd;
}

#receipt_section .table-bordered > thead > tr > th,
#receipt_section .table-bordered > tbody > tr > th,
#receipt_section .table-bordered > tfoot > tr > th,
#receipt_section .table-bordered > thead > tr > td,
#receipt_section .table-bordered > tbody > tr > td,
#receipt_section .table-bordered > tfoot > tr > td {
  border: 1px solid #ddd;
}

#receipt_section .table-slim > tbody > tr > td,
#receipt_section .table-slim > tbody > tr > th,
#receipt_section .table-slim > tfoot > tr > td,
#receipt_section .table-slim > tfoot > tr > th,
#receipt_section .table-slim > thead > tr > td,
#receipt_section .table-slim > thead > tr > th {
  padding: 1px 4px;
}

#receipt_section .table-no-top-cell-border td,
#receipt_section .table-no-top-cell-border th {
  border-top: 0 !important;
  border-bottom: 0 !important;
}

#receipt_section .table-no-side-cell-border td,
#receipt_section .table-no-side-cell-border th {
  border-left: 0 !important;
  border-right: 0 !important;
}

#receipt_section .width-100 { width: 100% !important; }
#receipt_section .width-50 { width: 50% !important; }
#receipt_section .mb-12 { margin-bottom: 12px !important; }
#receipt_section .color-555,
#receipt_section .color-555 * { color: #555 !important; }
#receipt_section .word-wrap { word-wrap: break-word; }

#receipt_section h1,
#receipt_section h2,
#receipt_section h3,
#receipt_section h4,
#receipt_section h5 {
  margin: 4px 0;
  font-weight: 700;
  color: inherit;
}

#receipt_section p {
  margin: 0 0 6px;
}

#receipt_section .letterhead-img {
  width: 100%;
  height: auto;
  margin-bottom: 15px;
}

@media print {
  body.bm-receipt-printing * {
    visibility: hidden;
  }

  body.bm-receipt-printing #receipt_section,
  body.bm-receipt-printing #receipt_section * {
    visibility: visible;
  }

  /* Beat POS shell hide: body[data-bm-layout=pos] .bm-app-content > #receipt_section */
  body.bm-receipt-printing #receipt_section,
  body[data-bm-layout='pos'].bm-receipt-printing .bm-app-content > #receipt_section,
  body[data-bm-layout='pos'].bm-receipt-printing .bm-app-content > .print_section,
  body[data-bm-layout='pos'].bm-receipt-printing #receipt_section {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: #fff !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .no-print,
  .bm-pos-modal,
  .bm-pos-modal.is-open,
  #bm-floating-menu-portal,
  #toast-container {
    display: none !important;
  }

  .print_section {
    display: block !important;
  }

  #receipt_section .currency-symbol-aed,
  #receipt_section .currency-symbol.currency-symbol-aed {
    -webkit-mask: none !important;
    mask: none !important;
    background: none !important;
    width: auto !important;
    height: auto !important;
    display: inline !important;
    vertical-align: baseline !important;
  }

  #receipt_section .currency-symbol-aed::before,
  #receipt_section .currency-symbol.currency-symbol-aed::before {
    content: 'AED';
    font-size: inherit;
    font-weight: inherit;
  }

  #receipt_section svg.currency-symbol-inline-aed,
  #receipt_section .currency-symbol-inline-aed {
    display: none !important;
  }

  #receipt_section svg.currency-symbol-inline-aed + *,
  #receipt_section .currency-symbol-inline-aed + * {
    margin-left: 0;
  }

  /* Avoid float collapse in print engines */
  #receipt_section .row {
    page-break-inside: avoid;
    /* Bootstrap .row is margin-left:-15px; that clips Invoice No / Client / logo on A4 print (elegant). */
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  #receipt_section [class*="col-xs-"] {
    float: left !important;
  }

  /* Elegant (and similar) two-column header: keep logo/business on the right in print */
  #receipt_section .invoice-info > .width-50 {
    float: left !important;
    width: 50% !important;
    max-width: 50% !important;
    box-sizing: border-box !important;
  }

  #receipt_section .invoice-info > .width-50 img {
    max-width: 100% !important;
    height: auto !important;
  }
}

body.bm-pos-layout.bm-receipt-printing .bm-pos-shell,
body.bm-pos-layout.bm-receipt-printing .bm-pos-topbar,
body.bm-pos-layout.bm-receipt-printing .bm-pos-modal {
  display: none !important;
}

@media print {
  body.bm-pos-layout {
    margin: 0;
    padding: 0;
    background: #fff !important;
  }
}

#receipt_section .bm-packing-slip {
  padding: 12px 16px 16px 28px;
  box-sizing: border-box;
}

#receipt_section .bm-packing-slip .row {
  margin-left: 0;
  margin-right: 0;
}

@page {
  margin: 4mm;
}

/* Designer Compact pages are width:210mm — do not shrink/center-hack them.
   Preprinted keeps edge-to-edge overrides only. */
@media print {
  body.bm-receipt-printing #receipt_section .bm-packing-slip {
    padding: 12px 16px 16px 28px;
  }

  body.bm-receipt-printing #receipt_section .bm-packing-slip .row {
    margin-left: 0;
    margin-right: 0;
  }

  body.bm-receipt-printing #receipt_section .bm-dd-page:not(.bm-dd-page-preprinted) {
    width: 210mm !important;
    max-width: 210mm !important;
    margin: 0 auto !important;
  }
  body.bm-receipt-printing #receipt_section .bm-dd-page-preprinted,
  body.bm-receipt-printing #receipt_section .bm-dd-preprinted .bm-dd-page {
    margin: 0 !important;
    overflow: visible !important;
    max-width: none !important;
    width: auto !important;
  }
  body.bm-receipt-printing:has(.bm-dd-preprinted) {
    margin: 0;
    padding: 0;
  }
}
