/* The paper formats of the printed fiscal receipt beside the 80 mm roll: a 58 mm roll (57 mm paper,
   48 mm printable) and A4 (docs/superpowers/specs/2026-09-27-receipt-paper-58-a4-design.md §4.3).
   PRINT ONLY, and only while js/receipt-paper.js has marked #fiscal-modal with data-paper for the print
   job ("58" from the Admin setting receipt_paper, "a4" from the "Štampaj A4" button). Without the
   attribute - the 80 mm roll - nothing here applies and the frozen print block of index.html decides
   the paper alone, exactly as accredited.

   The receipt is the same receipt: the 40-column PFR journal, the QR data and the order of the parts
   do not change, only their printed size. Two-id selectors with !important outrank the frozen one-class
   and one-id rules and css/receipt-ad.css (the pattern of css/receipt-ad.css and css/receipt-preview.css).
   Loaded in <head> after css/receipt-preview.css; css/kasir.css stays the last element there.
   Listed in docs/superpowers/specs/receipt-changes-v2.md. */
@media print {
  /* The receipt at the top of the page. The frozen overlay rules centre it vertically (display:flex,
     align-items:center, top:0, bottom:0): on a 1000 mm roll page that is some 40 cm down the paper. */
  #fiscal-modal[data-paper="58"], #fiscal-modal[data-paper="a4"] { align-items: flex-start !important; bottom: auto !important; }

  /* 58 mm roll: the head prints 48 mm. 40 characters of 7.5px Courier New = 47.6 mm, no side padding. */
  #fiscal-modal[data-paper="58"] .receipt-modal { max-width: 48mm !important; max-height: none !important; padding: 3mm 0 !important; }
  #fiscal-modal[data-paper="58"] #receipt-text-content,
  #fiscal-modal[data-paper="58"] #receipt-text-closing { font-size: 7.5px !important; }
  /* Pravilnik čl. 10 st. 2: a square of 40-50 mm; 45 mm fits the 48 mm the head prints. */
  #fiscal-modal[data-paper="58"] #receipt-qr-img { width: 45mm !important; height: 45mm !important; }
  /* "ОВО НИЈЕ ФИСКАЛНИ РАЧУН" keeps 2em - twice the receipt font (TAP bab 117) - but one line of it
     is 55 mm: two balanced lines ("ОВО НИЈЕ" / "ФИСКАЛНИ РАЧУН") inside the column instead. */
  #fiscal-modal[data-paper="58"] #receipt-text-content .r-nonfiscal { white-space: normal !important; width: auto !important; max-width: 100% !important; left: 0 !important; transform: none !important; text-wrap: balance; }
  /* Pravilnik čl. 12 st. 2: smaller than the receipt font and not the receipt font (css/receipt-ad.css). */
  #fiscal-modal[data-paper="58"] #receipt-ad-text { font-size: 6.5px !important; }

  /* A4: the receipt column in the middle of the page, 40 characters of 12px = 76.2 mm. The QR keeps
     the frozen 50 mm; a long receipt continues on the next page, but never through the QR.
     max-height: the frozen screen rule caps the modal at 85vh also in print - 850 mm on a roll page,
     227 mm on A4, where a long receipt was squeezed and its QR drawn over the items.
     The A4 page has no margin (js/receipt-paper.js: Edge prints its own header and footer into one),
     so the 15 mm margin is this padding, cloned onto the top and bottom of every page. */
  #fiscal-modal[data-paper="a4"] .receipt-modal { max-width: none !important; max-height: none !important; padding: 15mm 0 !important; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
  #fiscal-modal[data-paper="a4"] #receipt-text-content,
  #fiscal-modal[data-paper="a4"] #receipt-text-closing { font-size: 12px !important; }
  #fiscal-modal[data-paper="a4"] #receipt-extras { break-inside: avoid; }
  #fiscal-modal[data-paper="a4"] #receipt-ad-text { font-size: 10px !important; }
}
