/* WSSI Print Styles */
@media print {
  /* Disable maxwidth-full and overflow-auto classes for print */
  .no-print {
    display: none;
  }

  .maxwidth-full {
    max-width: none !important;
  }

  .overflow-auto {
    overflow: visible !important;
  }

  html {
    height: 100% !important;
    overflow: visible !important;
  }

  body {
    padding: 0 !important;
    overflow: visible !important;
  }

  .main {
    overflow: visible !important;
    padding: 0 !important;
  }

  .main__content {
    overflow: visible !important;
    padding: 0 !important;
  }

  /* Hide elements not needed for printing */
  .wssi-header__actions,
  .wssi-table__formula-box,
  #saveButton,
  weav-dropdown,
  .button-group,
  header {
    display: none !important;
  }

  /* Ensure the WSSI table spans across pages */
  weav-wssi-table {
    overflow: visible !important;
    /*page-break-inside: auto !important;*/
    border: none !important;
  }

  /* Ensure table wrapper is visible and full width */
  .table-wrapper {
    width: 100% !important;
    overflow: visible !important;
    border: none !important;
  }

  /* Adjust container to full width */
  .container {
    width: 100% !important;
    max-width: none !important;
    overflow: visible !important;
  }
  .container.is-wssi {
    width: 100% !important;
    max-width: none !important;
    overflow: visible !important;
  }
  .container.is-wssi .overflow-hidden {
    overflow: visible !important;
  }

  /* Add footer with seasonality info */
  @page {
    margin-bottom: 2cm;
  }

  /* Hide Gap analysis link */
  a[href*="GapAnalysis"] {
    display: none !important;
  }

  /* Hide season navigation in footer */
  footer .button-group {
    display: none !important;
  }

  main {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  /* Force each WSSI print section to render on a new page */
  .wssi-print-section {
    page-break-before: always;
    padding: 0 !important;
  }

  /* Prevent page breaks within tables inside WSSI print sections */
  .wssi-print-section table {
    page-break-inside: avoid;
  }

  /* Additional table page break prevention */
  table {
    width: auto !important;
    max-width: 100% !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  table:first-of-type {
    width: 100% !important;
  }

  /* Prevent page breaks within table rows */
  tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Prevent page breaks within table cells */
  td,
  th {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .table {
    background-color: var(--table-th-bg);
  }

  .table__th,
  .table__td {
    padding: 0 2px !important;
    color: var(--table-text) !important;
    font-size: 0.5rem !important;
  }

  /* Keep table headers with content */
  thead {
    display: table-header-group !important;
  }

  /* Keep table footers with content */
  tfoot {
    display: table-footer-group !important;
  }

  /* Don't force page break for the first print section */
  .wssi-print-section:first-of-type {
    page-break-before: auto;
  }

  /* Prevent wssi-nav__row elements from wrapping to new lines */
  .wssi-header__categories .wssi-nav__row {
    display: inline-block !important;
    vertical-align: top !important;
  }
}
