/* PrairieFlow — print-only stylesheet
 * Renders ONLY #print-report contents when the user prints the page.
 * Used by Phase B6 "Download PDF Report" button: window.print() after
 * populating the hidden #print-report div with CFIA_Report + AI_Review.
 *
 * IMPORTANT: hide the #print-report div ONLY on screen. Do not use an inline
 * style="display:none" on the element — that inline rule has higher specificity
 * than the @media print { display: block } rule below, and would result in an
 * empty PDF. The screen-mode rule below is the only thing hiding it.
 */

@media not print {
  #print-report { display: none; }
}

@media print {
  body > *:not(#print-report) { display: none !important; }
  #print-report { display: block; font-family: Arial, sans-serif; font-size: 10pt; color: #1a1a1a; }
  #print-report h1, #print-report h2 { font-size: 13pt; margin: 8pt 0 4pt; }
  #print-report h3 { font-size: 11pt; margin: 6pt 0 3pt; }
  #print-report table { border-collapse: collapse; width: 100%; margin: 4pt 0 8pt; }
  #print-report th, #print-report td {
    border: 1px solid #ccc;
    padding: 4px 6px;
    vertical-align: top;
    word-break: break-word;
  }
  #print-report th {
    background: #2B5797;
    color: #fff;
    font-weight: 600;
    font-size: 9pt;
  }

  /* Status colors mirror Excel conditional formatting */
  .status-hold     { background: #DC3545; color: #fff; font-weight: 600; }
  .status-pending  { background: #F8D7DA; color: #721C24; font-weight: 600; }
  .status-caveat   { background: #FFF3CD; color: #856404; }
  .status-pendver  { background: #FFF3CD; color: #856404; }
  .status-ok       { background: #C6EFCE; color: #006100; }
  .status-resolved { background: #C6EFCE; color: #006100; }
  .status-autofix  { background: #E0E0E0; color: #444; }
  .status-voided   { background: #E0E0E0; color: #666; font-style: italic; }

  /* Page header on every page */
  #print-report header.print-page-head {
    position: running(header);
    border-bottom: 1px solid #999;
    padding-bottom: 4pt;
    font-size: 9pt;
    display: flex;
    justify-content: space-between;
  }
  #print-report header .print-logo {
    color: #888;
    font-style: italic;
  }

  /* ADVISORY footnote on every page */
  @page {
    margin: 0.5in;
    @top-left { content: element(header); }
    @bottom-center {
      content: "ADVISORY ONLY — AI-generated compliance review. Page " counter(page) " of " counter(pages);
      font-size: 8pt;
      color: #888;
    }
  }

  /* Force a page break before the AI_Review section */
  #print-report .ai-review-section { break-before: page; }

  /* ⚠ @page running headers (@top-left, @bottom-center) require
     Chrome/Chromium print-to-PDF. Firefox and Safari will silently
     omit the page header and footer. This is expected behavior —
     do not spend time debugging in non-Chromium browsers. */
}
