﻿/* Print styles for store order receipts (Success page) */
@media print {
  /* Preserve colors as much as possible */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  /* Hide global chrome and non-essential UI */
  header.store-header,
  footer.store-footer,
  .store-mobile-drawer,
  .store-breadcrumb-under-header,
  .store-top-bar,
  .store-category-nav,
  .store-actions,
  .mobile-header,
  nav.store-nav {
    display: none !important;
  }

  /* Make the printable area full width and plain white */
  html, body {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #000 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  }

  /* Target Success page container */
  .page-container,
  .page-main,
  .store-container {
    background: #fff !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 6mm 8mm !important;
    box-shadow: none !important;
  }

  /* Hide elements that aren't part of the receipt */
  .success-header,
  .next-steps,
  .shipping-info,
  .support-info,
  .error-section,
  .order-status,
  .action-buttons {
    display: none !important;
  }

  /* Cards: simple borders and full width */
  sl-card,
  .order-summary-card,
  .order-items-card,
  .order-totals-card {
    display: block !important;
    width: 100% !important;
    background: #fff !important;
    box-shadow: none !important;
    border: 1px solid #000 !important;
    border-radius: 4px !important;
    padding: 8px !important;
    margin: 0 0 8px 0 !important;
    page-break-inside: avoid !important;
  }

  /* Header slot styles inside cards */
  .order-summary-card [slot="header"] h2,
  .order-items-card [slot="header"] h2,
  .order-totals-card [slot="header"] h2 {
    color: #000 !important;
    font-size: 14pt !important;
    margin: 0 0 6px 0 !important;
    padding: 0 !important;
  }

  /* Order info rows */
  .order-info {
    display: block !important;
    margin: 0 0 6px 0 !important;
  }

  .order-info > div {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 6px 0 !important;
    border-bottom: 1px solid #ddd !important;
    page-break-inside: avoid !important;
    font-size: 11pt !important;
  }

  .order-info > div:last-child {
    border-bottom: none !important;
  }

  /* Items list compact layout */
  .order-items-list {
    display: block !important;
    margin: 0 !important;
  }

  .order-item {
    display: flex !important;
    gap: 8px !important;
    padding: 6px 0 !important;
    border-bottom: 1px solid #eee !important;
    align-items: center !important;
    page-break-inside: avoid !important;
  }

  .order-item:last-child {
    border-bottom: none !important;
  }

  .order-item-image {
    width: 56px !important;
    height: 56px !important;
    flex: 0 0 56px !important;
    overflow: hidden !important;
    border-radius: 4px !important;
    background: #f4f4f4 !important;
  }

  .order-item-image img {
    width: 56px !important;
    height: 56px !important;
    object-fit: cover !important;
    display: block !important;
  }

  .order-item-details {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  .order-item-title {
    font-size: 11pt !important;
    margin: 0 !important;
    font-weight: 600 !important;
  }

  .order-item-description,
  .order-item-sku {
    font-size: 9pt !important;
    margin: 0 !important;
    color: #333 !important;
  }

  .order-item-quantity,
  .order-item-pricing {
    flex: 0 0 72px !important;
    text-align: right !important;
    font-size: 11pt !important;
  }

  .quantity-value,
  .line-price {
    font-weight: 700 !important;
  }

  /* Totals compacted */
  .order-totals {
    display: block !important;
    margin: 6px 0 0 0 !important;
  }

  .total-row {
    display: flex !important;
    justify-content: space-between !important;
    padding: 4px 0 !important;
    font-size: 11pt !important;
  }

  .total-row.grand-total {
    border-top: 1px solid #000 !important;
    margin-top: 6px !important;
    padding-top: 6px !important;
    font-size: 12pt !important;
    font-weight: 700 !important;
  }

  /* Slightly reduce base font-size to improve fit */
  body.store-body, .page-main, .page-container {
    font-size: 11px !important;
    line-height: 1.15 !important;
  }

  /* Avoid splitting cards across pages */
  .order-summary-card, .order-items-card, .order-totals-card { page-break-inside: avoid !important; }

  /* Force shoelace cards full width */
  sl-card { width: 100% !important; display: block !important; }

  /* Page size and margins */
  @page {
    size: A4 portrait;
    margin: 12mm;
  }
}
