/* ==========================================
   PRINT STYLES - Modern delivery receipt
   Works on 80mm thermal AND A4
   ========================================== */

@page {
  size: auto;
  margin: 8mm;
}

/* Hide receipt on screen by default */
@media screen {
  .print-only {
    display: none !important;
  }
}

@media print {
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    color: #111 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Hide everything except the receipt */
  body * { visibility: hidden !important; }
  .print-only, .print-only * { visibility: visible !important; }

  .print-only {
    display: block !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
  }

  /* Hide UI chrome */
  [data-radix-popper-content-wrapper],
  [role="dialog"]:not(:has(.print-only)),
  .toaster,
  [data-sonner-toaster] {
    display: none !important;
  }
}

/* ==========================================
   Receipt visual styles
   ========================================== */
.receipt {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  color: #111;
  background: #fff;
  max-width: 78mm;
  margin: 0 auto;
  padding: 4mm;
  font-size: 11pt;
  line-height: 1.4;
}

@media print {
  /* On wider paper (A4), allow a bit more breathing room */
  @page { size: auto; }
  .receipt { max-width: 90mm; }
}

.receipt-header {
  text-align: center;
  margin-bottom: 6px;
}

.receipt-logo {
  display: block;
  margin: 0 auto 6px;
  width: 70px;
  height: 70px;
  object-fit: contain;
  border-radius: 8px;
}

.receipt-store {
  font-size: 14pt;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin: 2px 0;
}

.receipt-store-info {
  font-size: 9.5pt;
  margin: 0;
  color: #333;
}

.receipt-rule {
  border-top: 1px dashed #444;
  margin: 8px 0;
}

.receipt-meta { font-size: 10.5pt; }
.receipt-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0;
}
.receipt-numero {
  font-weight: 700;
  background: #111;
  color: #fff !important;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 10pt;
}
.receipt-address { margin-top: 4px; }
.receipt-address p { margin: 2px 0 0; white-space: pre-line; }

.receipt-urgent {
  margin-top: 6px;
  text-align: center;
  font-weight: 800;
  border: 1.5px solid #111;
  padding: 3px;
  letter-spacing: 0.1em;
}

.receipt-section-title {
  text-align: center;
  font-size: 10pt;
  font-weight: 700;
  letter-spacing: 0.2em;
  margin: 2px 0 6px;
  color: #555;
}

.receipt-items { list-style: none; margin: 0; padding: 0; }
.receipt-item {
  margin: 6px 0;
  padding-bottom: 6px;
  border-bottom: 1px dotted #bbb;
  page-break-inside: avoid;
}
.receipt-item:last-child { border-bottom: none; }

.receipt-item-name {
  font-weight: 700;
  font-size: 11pt;
  letter-spacing: 0.02em;
}
.receipt-item-detail {
  font-size: 9.5pt;
  color: #555;
  margin: 1px 0;
}
.receipt-item-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-top: 2px;
}
.receipt-item-calc {
  font-size: 10pt;
  color: #222;
}
.receipt-unit {
  font-weight: 700;
  text-transform: uppercase;
}
.receipt-item-total {
  font-weight: 700;
  font-size: 11pt;
  white-space: nowrap;
}

.receipt-summary {
  background: #f5f5f5;
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 4px;
}
.receipt-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 10.5pt;
  margin: 2px 0;
}
.receipt-total-row {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1.5px solid #111;
  font-weight: 800;
  font-size: 13pt;
}

.receipt-obs {
  font-size: 10pt;
  font-style: italic;
}
.receipt-obs p { margin: 2px 0 0; white-space: pre-line; }

.receipt-footer {
  text-align: center;
  margin-top: 8px;
}
.receipt-thanks {
  font-size: 11pt;
  font-weight: 600;
  margin: 0;
}

.receipt-pix {
  text-align: center;
  margin: 6px 0;
  padding: 6px;
  border: 1px dashed #444;
  border-radius: 6px;
}
.receipt-pix-title {
  font-size: 9.5pt;
  font-weight: 700;
  letter-spacing: 0.15em;
  margin: 0 0 2px;
  color: #555;
}
.receipt-pix-key {
  font-size: 12pt;
  font-weight: 800;
  margin: 0;
  letter-spacing: 0.05em;
}
.receipt-pix-name {
  font-size: 10pt;
  margin: 2px 0 0;
}
