/* ==========================================================================
   Universe Hub - Official Invoice & Receipt Stylesheet
   Designed for High-Resolution Screen Preview & Precision A4 Paper Printing
   ========================================================================== */

/* Modal Container for Invoice Preview */
.invoice-modal-card {
  max-width: 820px;
  width: 95%;
  background: var(--bg-card, #0f1422);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  max-height: 94vh;
}

.invoice-modal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 24px;
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.invoice-toolbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.invoice-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-invoice-download {
  background: linear-gradient(135deg, #00d2ff, #0072ff);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 16px rgba(0, 210, 255, 0.35);
  transition: all 0.2s ease;
}

.btn-invoice-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 24px rgba(0, 210, 255, 0.55);
}

.btn-invoice-print {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-invoice-print:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-invoice-wa {
  background: #25d366;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-invoice-wa:hover {
  background: #20ba5a;
}

.invoice-preview-scroll {
  overflow-y: auto;
  padding: 24px;
  background: #1e2230;
  display: flex;
  justify-content: center;
}

/* -------------------------------------------------------------------------
   Official Printable Invoice Document (Clean Crisp High-Contrast Paper)
   ------------------------------------------------------------------------- */
.invoice-paper {
  background: #ffffff !important;
  color: #1e293b !important;
  width: 100%;
  max-width: 760px;
  padding: 36px 40px;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.45;
  box-sizing: border-box;
}

.invoice-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e2e8f0;
}

.invoice-logo-group {
  max-width: 360px;
}

.invoice-logo-img {
  height: 44px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  margin-bottom: 8px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.invoice-tagline {
  font-size: 12px;
  font-weight: 700;
  color: #0284c7;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.invoice-address-lines {
  font-size: 11px;
  color: #64748b;
  line-height: 1.5;
}

.invoice-meta-card {
  text-align: right;
  min-width: 220px;
}

.invoice-badge-title {
  font-size: 20px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.invoice-num-tag {
  font-size: 13px;
  font-weight: 800;
  color: #0284c7;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  padding: 3px 8px;
  display: inline-block;
  margin-bottom: 8px;
}

.invoice-meta-list {
  font-size: 11.5px;
  color: #475569;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.invoice-meta-list span strong {
  color: #1e293b;
}

/* Customer & Dispatch Grid */
.invoice-customer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid #e2e8f0;
}

.invoice-info-block h4 {
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 0 0 8px 0;
}

.invoice-cust-name {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}

.invoice-cust-text {
  font-size: 12px;
  color: #475569;
  line-height: 1.5;
}

/* Itemized Products Table */
.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 12px;
}

.invoice-table th {
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.5px;
  padding: 10px 12px;
  border-top: 1px solid #cbd5e1;
  border-bottom: 2px solid #94a3b8;
}

.invoice-table td {
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
  vertical-align: middle;
}

.invoice-item-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 2px;
}

.invoice-item-sub {
  font-size: 11px;
  color: #64748b;
}

.invoice-pill-cond {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 3px;
}

/* Financial Calculations & Summary */
.invoice-totals-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 14px 0;
  margin-bottom: 18px;
}

.invoice-security-qr {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 10px 14px;
  max-width: 320px;
}

.invoice-qr-svg {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}

.invoice-qr-note {
  font-size: 10.5px;
  color: #64748b;
  line-height: 1.4;
}

.invoice-totals-box {
  min-width: 260px;
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px 16px;
  border: 1px solid #e2e8f0;
}

.invoice-line-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #475569;
  margin-bottom: 6px;
}

.invoice-grand-row {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 900;
  color: #0f172a;
  padding-top: 8px;
  border-top: 2px solid #cbd5e1;
  margin-top: 6px;
}

.invoice-grand-row span:last-child {
  color: #0284c7;
}

/* Terms, Guarantee & Verification Policy */
.invoice-terms-box {
  background: #f1f5f9;
  border-left: 3px solid #0284c7;
  padding: 10px 14px;
  border-radius: 0 6px 6px 0;
  margin-bottom: 24px;
  font-size: 10.5px;
  color: #475569;
}

.invoice-terms-box strong {
  color: #0f172a;
}

.invoice-terms-box ul {
  margin: 4px 0 0 16px;
  padding: 0;
}

.invoice-terms-box li {
  margin-bottom: 2px;
}

/* Signatures & Store Official Stamp */
.invoice-signatures-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-top: 14px;
  margin-top: 10px;
}

.invoice-stamp-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.invoice-official-stamp {
  width: 78px;
  height: 78px;
  border: 2px dashed #0284c7;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #0284c7;
  font-size: 8px;
  font-weight: 800;
  transform: rotate(-8deg);
  opacity: 0.85;
}

.invoice-official-stamp span {
  font-size: 9px;
  letter-spacing: 0.5px;
}

.invoice-sign-box {
  text-align: center;
  min-width: 180px;
}

.invoice-sign-signature {
  font-family: 'Brush Script MT', 'Dancing Script', cursive;
  font-size: 24px;
  color: #0284c7;
  margin-bottom: 2px;
}

.invoice-sign-line {
  border-top: 1px solid #94a3b8;
  padding-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}

/* ==========================================================================
   Print Specific Optimization (@media print)
   ========================================================================== */
@media print {
  /* Hide non-invoice elements */
  body * {
    visibility: hidden;
  }

  /* Only display the printable invoice */
  #invoice-printable-doc,
  #invoice-printable-doc * {
    visibility: visible;
  }

  #invoice-printable-doc {
    position: absolute;
    left: 0;
    top: 0;
    width: 100% !important;
    max-width: 100% !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .invoice-modal-toolbar,
  .close-modal-btn,
  .cart-drawer,
  .modal-overlay {
    display: none !important;
  }

  @page {
    size: A4 portrait;
    margin: 12mm;
  }
}
