/**
 * reports-print.css — Print-friendly styles for all report pages
 *
 * Loaded globally but scoped entirely within @media print,
 * so it has zero impact on screen rendering.
 *
 * Chunk 460: Add print-friendly CSS for all reports.
 */

/* A4-friendly page setup with comfortable margins */
@page {
  size: A4 portrait;
  margin: 12mm 15mm;
}

@media print {

  /* ===================================================================
   * 1. Base print normalization
   * Ensure clean, readable output on paper regardless of screen theme.
   * =================================================================== */

  *,
  *::before,
  *::after {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  html, body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
    line-height: 1.45;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* ===================================================================
   * 2. Hide non-report UI chrome
   * Navigation, sidebars, toolbars, and interactive controls are
   * meaningless on paper — hide them to maximise report content area.
   * =================================================================== */

  .navbar,
  .nav,
  .topbar,
  .sidebar,
  .breadcrumb,
  .pagination,
  .filters,
  .actions,
  .action-bar,
  .app-header,
  .app-footer,
  .bottom-nav,
  .search-bar,
  .search-form,
  .no-print,
  .btn,
  .btn-group,
  .dropdown,
  .modal,
  .modal-backdrop,
  .toast,
  .tooltip,
  .popover,
  footer,
  nav {
    display: none !important;
  }

  /* Reveal elements that are explicitly marked for print only */
  .print-only {
    display: block !important;
  }

  /* ===================================================================
   * 3. Table print behaviour
   * Financial reports are predominantly tables — ensure headers repeat
   * across pages and rows are never split mid-content.
   * =================================================================== */

  table {
    width: 100% !important;
    border-collapse: collapse;
  }

  thead {
    display: table-header-group;
  }

  tfoot {
    display: table-footer-group;
  }

  tr,
  td,
  th {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  th,
  td {
    padding: 4pt 6pt;
    border: 0.5pt solid #999;
    font-size: 10pt;
  }

  th {
    background: #eee !important;
    font-weight: bold;
  }

  /* ===================================================================
   * 4. Page-break utilities for report templates
   * Even if not yet used in views, these classes give template authors
   * predictable page-break control without writing inline styles.
   * =================================================================== */

  .print-break-before {
    break-before: page;
    page-break-before: always;
  }

  .print-break-after {
    break-after: page;
    page-break-after: always;
  }

  .print-avoid-break {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* ===================================================================
   * 5. Prevent awkward page breaks in headings and summary blocks
   * Headings orphaned at the bottom of a page are hard to read;
   * keep them attached to the content that follows.
   * =================================================================== */

  h1, h2, h3, h4 {
    break-after: avoid;
    page-break-after: avoid;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .report-summary,
  .card,
  .card-body,
  .summary-block,
  .metric-card,
  .report-header {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* ===================================================================
   * 6. Link handling
   * Remove bright UI link colouring so text stays legible on paper.
   * Underlines are kept so links remain identifiable.
   * =================================================================== */

  a,
  a:visited {
    color: #000 !important;
    text-decoration: underline;
  }

  /* ===================================================================
   * 7. Layout adjustments
   * Reports should use the full page width when printed, not be
   * constrained by narrow responsive containers.
   * =================================================================== */

  .container,
  .container-fluid,
  .content-wrapper,
  .main-content {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
}
