/* ==========================================================================
   Print Stylesheet for Order Invoices & Packing Slips
   ========================================================================== */

@media screen {
  #print-area {
    display: none;
  }
}

@media print {
  body * {
    visibility: hidden;
  }

  #print-area, #print-area * {
    visibility: visible;
  }

  #print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 20px;
    background: #ffffff !important;
    color: #000000 !important;
    font-family: 'Plus Jakarta Sans', Arial, sans-serif;
    display: block !important;
  }

  .no-print {
    display: none !important;
  }

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

/* Printable Invoice Template Design */
.invoice-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 25px;
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 20px;
  border-bottom: 2px solid #4f46e5;
  margin-bottom: 25px;
}

.invoice-logo-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.invoice-store-name {
  font-size: 24px;
  font-weight: 800;
  color: #4f46e5;
  text-transform: uppercase;
  letter-spacing: -0.5px;
}

.invoice-store-sub {
  font-size: 13px;
  color: #64748b;
}

.invoice-title-wrap {
  text-align: right;
}

.invoice-title {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}

.invoice-number {
  font-size: 16px;
  font-weight: 700;
  color: #4f46e5;
  margin-top: 4px;
}

.invoice-date {
  font-size: 12.5px;
  color: #64748b;
}

.invoice-addresses-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 25px;
}

.address-box {
  background: #f8fafc;
  padding: 16px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.address-box-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.address-customer-name {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.address-text {
  font-size: 13px;
  color: #334155;
  line-height: 1.5;
}

.invoice-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 25px;
}

.invoice-items-table th {
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 12px;
  border-bottom: 2px solid #cbd5e1;
  text-align: left;
}

.invoice-items-table td {
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 13.5px;
  color: #1e293b;
}

.invoice-items-table .text-center { text-align: center; }
.invoice-items-table .text-right { text-align: right; }

.invoice-summary-wrap {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 30px;
}

.invoice-summary-table {
  width: 320px;
  border-collapse: collapse;
}

.invoice-summary-table td {
  padding: 6px 12px;
  font-size: 13.5px;
}

.invoice-summary-table .label {
  color: #64748b;
}

.invoice-summary-table .val {
  text-align: right;
  font-weight: 600;
  color: #0f172a;
}

.invoice-summary-table .total-row td {
  border-top: 2px solid #cbd5e1;
  padding-top: 10px;
  font-size: 16px;
  font-weight: 800;
  color: #4f46e5;
}

.invoice-notes-box {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  padding: 14px;
  border-radius: 6px;
  font-size: 12.5px;
  color: #92400e;
  margin-bottom: 30px;
}

.invoice-signatures {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  padding: 0 40px;
  text-align: center;
}

.signature-col {
  display: flex;
  flex-direction: column;
  gap: 60px;
}

.signature-title {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.signature-sub {
  font-size: 11px;
  color: #94a3b8;
  font-style: italic;
}

/* ==========================================================================
   Thermal Shipping & Item Labels (75x100mm / 100x150mm / Continuous Rolls)
   ========================================================================== */

#print-area.is-thermal-mode {
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  background: #ffffff !important;
}

@media print {
  #print-area.is-thermal-mode {
    padding: 0 !important;
    margin: 0 !important;
  }
}

.thermal-print-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #ffffff;
  padding: 5px 0;
}

.thermal-label {
  box-sizing: border-box;
  width: 100%;
  max-width: 380px;
  margin: 0 auto 15px auto;
  padding: 12px 14px;
  background: #ffffff;
  color: #000000 !important;
  border: 2px solid #000000;
  border-radius: 4px;
  font-family: 'Plus Jakarta Sans', Arial, -apple-system, sans-serif;
  font-size: 12px;
  line-height: 1.35;
  page-break-after: always;
  break-after: page;
  break-inside: avoid;
}

.thermal-print-wrapper.bulk-thermal .thermal-label:last-child {
  page-break-after: auto;
  break-after: auto;
}

.thermal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #000000;
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.thermal-store-name {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thermal-order-badge {
  font-size: 15px;
  font-weight: 900;
  color: #000000;
  letter-spacing: -0.2px;
}

.thermal-barcode-wrap {
  text-align: center;
  padding: 4px 0 6px 0;
  border-bottom: 1.5px dashed #000000;
  margin-bottom: 8px;
}

.thermal-barcode-svg {
  max-height: 52px;
  max-width: 100%;
  margin: 0 auto;
  display: block;
}

.thermal-box {
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1.5px solid #000000;
}

.thermal-box-title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: #333333;
  margin-bottom: 3px;
  letter-spacing: 0.3px;
}

.thermal-recipient-box {
  background: #fbfbfb;
  padding: 8px;
  border: 1.5px solid #000000;
  border-radius: 4px;
}

.thermal-recipient-name {
  font-size: 15px;
  font-weight: 800;
  color: #000000;
  margin-bottom: 2px;
}

.thermal-recipient-phone {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 3px;
}

.thermal-recipient-phone strong {
  font-size: 15px;
  font-weight: 900;
}

.thermal-recipient-address {
  font-size: 12px;
  line-height: 1.4;
  color: #111111;
  word-break: break-word;
}

.thermal-items-box {
  border-bottom: 1.5px dashed #000000;
}

.thermal-items-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.thermal-item-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
}

.thermal-item-qty {
  font-weight: 900;
  font-size: 13px;
  background: #000000;
  color: #ffffff !important;
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}

.thermal-item-info {
  flex: 1;
  min-width: 0;
}

.thermal-item-name {
  font-weight: 700;
  color: #000000;
  word-break: break-word;
  line-height: 1.3;
}

.thermal-item-sku {
  font-size: 10.5px;
  color: #333333;
  font-weight: 600;
}

.thermal-item-attrs {
  font-size: 11px;
  color: #111111;
  font-weight: 600;
  margin-top: 1px;
  word-break: break-word;
}

.thermal-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1.5px solid #000000;
}

.thermal-cod-box {
  border: 1.5px solid #000000;
  padding: 6px 8px;
  border-radius: 4px;
}

.thermal-cod-box.is-cod {
  background: #fdfdfd;
}

.thermal-cod-box.is-prepaid {
  background: #f8fafc;
}

.thermal-cod-title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: #222222;
}

.thermal-cod-amount {
  font-size: 14px;
  font-weight: 900;
  color: #000000;
  margin-top: 2px;
}

.thermal-notes-box {
  border: 1px dashed #000000;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.thermal-notes-content {
  font-size: 11px;
  font-style: italic;
  color: #111111;
  line-height: 1.3;
  margin-top: 2px;
}

.thermal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: #444444;
  margin-top: 4px;
}

.thermal-footer-left {
  font-weight: 500;
}

.thermal-footer-right {
  font-weight: 700;
  text-transform: uppercase;
}
