/* Print Styles */
@media print {
  /* Basic print setup */
  @page {
    margin: 0.75in;
    size: letter;
  }
  
  /* Hide specific navigation elements */
  nav,
  .breadcrumb,
  wa-breadcrumb,
  wa-button,
  wa-divider,
  .actions,
  header,
  footer,
  .navbar,
  div[slot="navigation"],
  #main-content,
  .wa-visually-hidden,
  .nav {
    display: none !important;
  }

  /* Hide Actions columns in admin tables (not report tables) */
  table:not(.report-table) th:last-child,
  table:not(.report-table) td:last-child {
    display: none !important;
  }
  
  /* Hide multi-column actions areas in admin tables */
  table:not(.report-table) th[colspan],
  table:not(.report-table) td:nth-last-child(2),
  table:not(.report-table) td:nth-last-child(3) {
    display: none !important;
  }
  
  /* Hide corresponding headers for multi-column actions in admin tables */
  table:not(.report-table) th:nth-last-child(2),
  table:not(.report-table) th:nth-last-child(3) {
    display: none !important;
  }

  
  /* Hide Web Awesome component artifacts */
  wa-alert,
  wa-badge,
  wa-callout,
  wa-tooltip,
  wa-popup,
  wa-dropdown,
  wa-menu,
  wa-notification,
  .wa-tooltip,
  .wa-popup,
  .wa-callout,
  .wa-alert,
  .wa-notification,
  [data-wa-tooltip],
  [role="tooltip"],
  [role="alert"],
  [role="alertdialog"],
  .tooltip,
  .popover,
  .dropdown-menu {
    display: none !important;
    visibility: hidden !important;
  }
  
  /* Hide any positioned/floating elements that might be artifacts */
  *[style*="position: fixed"],
  *[style*="position: absolute"] {
    display: none !important;
  }
  
  /* Hide elements that are commonly used for overlays */
  .overlay,
  .modal,
  .modal-backdrop,
  .floating,
  .floating-ui,
  .popper,
  .tippy-box,
  .tippy-content {
    display: none !important;
  }
  
  /* Hide specific report warning badges that shouldn't print */
  wa-badge[data-fulfillment-target="quantityWarning"],
  wa-badge[variant="warning"],
  wa-badge[variant="info"],
  wa-badge[variant="success"],
  wa-badge[variant="danger"],
  wa-badge[appearance*="filled"],
  wa-badge[appearance*="outlined"],
  .quantity-warning,
  .warning-badge,
  .validation-warning {
    display: none !important;
  }
  
  /* Force hide any element with common artifact class patterns */
  [class*="tooltip"],
  [class*="popover"],
  [class*="floating"],
  [class*="overlay"],
  [id*="tooltip"],
  [id*="popover"] {
    display: none !important;
  }
  
  /* Ensure body and main content are visible */
  body {
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
    font-size: 12pt !important;
    line-height: 1.3 !important;
  }
  
  /* Show only the report content */
  h3,
  .report-container {
    display: block !important;
    margin: 0 !important;
    padding: 10px !important;
  }
  
  /* Optimize report for printing */
  .report-container {
    max-width: none;
    z-index: 10001 !important;
  }
  
  /* Section-level page break management */
  .summary-section, .shipping-section, .fulfillment-section, 
  .daf-section, .store-section, .producer-section,
  .pick-list-section, .daf-order-section, .instructions-section {
    border: 1px solid #000;
    border-radius: 0;
    background: white !important;
    margin-bottom: 0.5rem !important;
    padding: 0.5rem !important;
    page-break-inside: avoid;
    orphans: 3;
    widows: 3;
  }
  
  /* Producer blocks with better page breaks */
  .producer-block {
    border: 1px solid #000;
    border-radius: 0;
    background: white !important;
    page-break-inside: avoid;
    margin-bottom: 0.5rem !important;
    padding: 0.5rem !important;
  }
  
  /* Table-specific page break rules */
  .report-table {
    border: 1px solid #000;
    border-collapse: collapse !important;
    width: 100% !important;
    page-break-inside: auto;
  }
  
  .report-table thead {
    display: table-header-group;
    page-break-inside: avoid;
    page-break-after: avoid;
  }
  
  .report-table tbody {
    display: table-row-group;
    page-break-inside: auto;
  }
  
  .report-table tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }
  
  .report-table th {
    background-color: #f0f0f0 !important;
    -webkit-print-color-adjust: exact;
    color-adjust: exact;
    border: 1px solid #000 !important;
    padding: 0.25rem !important;
    font-weight: bold !important;
    font-size: 10pt !important;
  }
  
  .report-table td {
    border: 1px solid #000 !important;
    padding: 0.25rem !important;
    font-size: 10pt !important;
    vertical-align: top !important;
  }
  
  /* Specific table row handling */
  .pick-item-row, .daf-item-row {
    page-break-inside: avoid !important;
    min-height: 1.5rem;
  }
  
  /* Force table headers to repeat on new pages */
  .pick-list-table thead,
  .daf-order-table thead {
    display: table-header-group !important;
  }
  
  /* Headings and page break management */
  h3, h4, h5, h6 {
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
    margin-top: 0.5rem !important;
    margin-bottom: 0.25rem !important;
    font-weight: bold !important;
  }
  
  h3 {
    font-size: 16pt !important;
    border-bottom: 2px solid #000;
    padding-bottom: 0.25rem;
  }
  
  h4 {
    font-size: 14pt !important;
  }
  
  h5 {
    font-size: 12pt !important;
  }
  
  /* Paragraph and list handling */
  p, li {
    orphans: 2;
    widows: 2;
    page-break-inside: avoid;
  }
  
  ol, ul {
    page-break-inside: avoid;
  }
  
  /* Special handling for long producer lists */
  .producer-section {
    page-break-inside: auto !important;
  }
  
  .producer-block:first-child {
    page-break-before: avoid;
  }
  
  /* Checkbox and notes styling for print */
  .checkbox-cell {
    font-size: 14pt !important;
    text-align: center !important;
    width: 30px !important;
  }
  
  .notes-line {
    border-bottom: 1px solid #000 !important;
    height: 1rem !important;
    margin-bottom: 0.25rem !important;
  }
  
  .status-options {
    font-size: 9pt !important;
    line-height: 1.2 !important;
  }
  
  /* Force page breaks before major sections if needed */
  .daf-order-section,
  .pick-list-section {
    page-break-before: auto;
  }
  
  /* Prevent very small sections at bottom of page */
  .instructions-section {
    page-break-before: auto;
    min-height: 3in;
  }
  
  /* Remove shadows and rounded corners for print */
  * {
    box-shadow: none !important;
    border-radius: 0 !important;
  }
  
  /* Ensure critical content doesn't break badly */
  .no-data {
    page-break-inside: avoid !important;
    text-align: center !important;
    padding: 2rem !important;
  }
}
