/* ================================================================
   NexPOS — Print Stylesheet (A4 + 80mm)
   ================================================================ */

@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  body { background: white !important; color: #000 !important; font-family: 'Arial', sans-serif; overflow: auto; height: auto; }

  #app, .sidebar, .topbar, .modal-overlay { display: none !important; }

  .print-container { display: block !important; }
}

/* ── Print Container ──────────────────────────────────────────── */
.print-container { display: none; }

/* ── A4 Document ──────────────────────────────────────────────── */
.doc-a4 {
  width: 210mm;
  min-height: 297mm;
  padding: 15mm 20mm;
  background: white;
  color: #1a1a1a;
  font-family: 'Arial', 'Cairo', sans-serif;
  font-size: 10pt;
  line-height: 1.5;
  position: relative;
}

.doc-a4.landscape {
  width: 297mm;
  min-height: 210mm;
}

/* A4 Header */
.doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid #0055CC;
}

.doc-company-logo {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.doc-company-info h2 { font-size: 16pt; font-weight: 700; color: #0055CC; margin-bottom: 4px; }
.doc-company-info p  { font-size: 9pt; color: #666; margin: 1px 0; }

.doc-title-block { text-align: right; }
.doc-title-block h1 { font-size: 18pt; font-weight: 800; color: #0055CC; margin-bottom: 6px; }
.doc-title-block .doc-number { font-size: 11pt; font-weight: 600; color: #333; }
.doc-title-block .doc-date   { font-size: 9pt; color: #666; margin-top: 3px; }

/* A4 Party Info */
.doc-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.doc-party { background: #f8f9fa; padding: 12px; border-radius: 6px; border-left: 3px solid #0055CC; }
.doc-party h3 { font-size: 8pt; font-weight: 700; text-transform: uppercase; color: #666; margin-bottom: 6px; }
.doc-party p  { font-size: 10pt; font-weight: 600; margin-bottom: 2px; }
.doc-party span { font-size: 9pt; color: #555; display: block; }

/* A4 Items Table */
.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.doc-table thead th {
  background: #0055CC; color: white;
  font-size: 8pt; font-weight: 700; text-transform: uppercase;
  padding: 8px 10px; text-align: left;
}
.doc-table tbody td { padding: 7px 10px; border-bottom: 1px solid #e9ecef; font-size: 9pt; vertical-align: top; }
.doc-table tbody tr:nth-child(even) td { background: #f8f9fa; }
.doc-table tfoot td { padding: 6px 10px; font-weight: 600; font-size: 9pt; border-top: 1px solid #dee2e6; }

/* A4 Totals */
.doc-totals { float: right; width: 280px; margin-bottom: 20px; }
.doc-totals table { width: 100%; border-collapse: collapse; }
.doc-totals td { padding: 5px 10px; font-size: 9pt; }
.doc-totals .total-row td { font-size: 12pt; font-weight: 800; color: #0055CC; border-top: 2px solid #0055CC; padding-top: 8px; }
.doc-totals .subtotal-row td { border-top: 1px solid #dee2e6; }

/* A4 Footer */
.doc-footer {
  clear: both;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #dee2e6;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}

.doc-footer-section h4 { font-size: 8pt; font-weight: 700; color: #666; text-transform: uppercase; margin-bottom: 4px; }
.doc-footer-section p  { font-size: 9pt; color: #333; }

.doc-signature { border-top: 1px solid #999; padding-top: 8px; margin-top: 30px; font-size: 8pt; color: #666; text-align: center; }

/* A4 QR Code area */
.doc-qr { position: absolute; bottom: 15mm; right: 20mm; }

/* ── 80mm Thermal Receipt ─────────────────────────────────────── */
.receipt-80mm {
  width: 72mm;
  padding: 3mm 4mm;
  background: white;
  color: #000;
  font-family: 'Courier New', 'Arial', monospace;
  font-size: 8pt;
  line-height: 1.4;
}

.receipt-header { text-align: center; margin-bottom: 4mm; }
.receipt-logo-text {
  font-size: 14pt; font-weight: 900;
  letter-spacing: 2px; margin-bottom: 2px;
}
.receipt-header h3 { font-size: 10pt; font-weight: 700; margin-bottom: 2px; }
.receipt-header p  { font-size: 7pt; margin: 1px 0; }

.receipt-divider { border-top: 1px dashed #000; margin: 3mm 0; }
.receipt-divider-solid { border-top: 1px solid #000; margin: 2mm 0; }

.receipt-info { margin-bottom: 3mm; }
.receipt-info table { width: 100%; font-size: 7.5pt; }
.receipt-info td { padding: 1px 0; }
.receipt-info td:last-child { text-align: right; font-weight: 600; }

.receipt-items { margin-bottom: 3mm; }
.receipt-item { margin-bottom: 2mm; }
.receipt-item-name { font-size: 8pt; font-weight: 600; margin-bottom: 1px; }
.receipt-item-detail { display: flex; justify-content: space-between; font-size: 7.5pt; color: #333; padding-left: 3mm; }

.receipt-totals { margin-top: 3mm; }
.receipt-totals table { width: 100%; font-size: 8pt; }
.receipt-totals td { padding: 1.5px 0; }
.receipt-totals td:last-child { text-align: right; font-weight: 600; }
.receipt-totals .grand-total td { font-size: 11pt; font-weight: 900; padding-top: 3mm; border-top: 1px solid #000; }

.receipt-payment { margin: 3mm 0; font-size: 8pt; }
.receipt-payment table { width: 100%; }
.receipt-payment td:last-child { text-align: right; }

.receipt-footer { text-align: center; font-size: 7pt; margin-top: 3mm; }
.receipt-footer p { margin: 1px 0; }

.receipt-barcode { text-align: center; margin: 3mm 0; }

/* Arabic RTL for receipts */
.receipt-80mm[dir="rtl"] { text-align: right; }
.doc-a4[dir="rtl"] .doc-title-block { text-align: left; }
.doc-a4[dir="rtl"] .doc-party { border-left: none; border-right: 3px solid #0055CC; }
.doc-a4[dir="rtl"] .doc-totals { float: left; }
.doc-a4[dir="rtl"] thead th { text-align: right; }
.doc-a4[dir="rtl"] .doc-qr { right: auto; left: 20mm; }
