/* TESSA Enterprise Demo — Print stylesheet
 * Optimised for board-paper / committee-report print-out.
 * Applies when user hits Cmd/Ctrl+P or clicks a "Print" button.
 */

@media print {
  /* Page setup */
  @page {
    size: A4 portrait;
    margin: 18mm 14mm 20mm 14mm;
  }

  /* Hide chrome that doesn't belong on paper */
  .topbar,
  .tab-nav,
  .header-actions,
  .filter-bar,
  .nudge-button,
  .drill-down-button,
  .no-print {
    display: none !important;
  }

  /* Show only the active tab/view */
  .view { display: none !important; }
  .view.active { display: block !important; padding: 0 !important; }

  /* Body & cards */
  body {
    background: white !important;
    color: #000 !important;
    font-size: 10pt;
    line-height: 1.4;
  }

  .card,
  .hero-tile,
  .cost-panel {
    background: white !important;
    border: 1px solid #999 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    break-inside: avoid;
    border-radius: 4px !important;
  }

  /* Hero strip — keep it together */
  .hero-strip {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .hero-tile.feature {
    background: white !important;
    border: 2px solid #001F3F !important;
    color: #000 !important;
  }
  .hero-tile.feature .h-value,
  .hero-tile.feature .h-label,
  .hero-tile.feature .h-note,
  .hero-tile.feature .h-delta {
    color: #000 !important;
    background: transparent !important;
  }

  /* Headings */
  h1, h2, h3, .view-header h1 {
    color: #001F3F !important;
    page-break-after: avoid;
  }

  /* Tables */
  table {
    page-break-inside: auto;
    border-collapse: collapse;
    width: 100%;
  }
  tr { page-break-inside: avoid; page-break-after: auto; }
  thead { display: table-header-group; }
  th, td {
    border: 1px solid #ccc;
    padding: 4px 6px;
    font-size: 9pt;
  }

  /* Charts — let them print */
  canvas, svg {
    max-width: 100% !important;
    height: auto !important;
    page-break-inside: avoid;
  }

  /* Footer on every page */
  body::after {
    content: "Mercia Metropolitan Council | TESSA Ethical AI Training | Generated " attr(data-generated);
    position: fixed;
    bottom: 8mm;
    left: 14mm;
    right: 14mm;
    font-size: 8pt;
    color: #666;
    border-top: 1px solid #ccc;
    padding-top: 4px;
    text-align: center;
  }

  /* Prevent orphaned panel headers */
  .card h3, .panel-title {
    page-break-after: avoid;
  }

  /* Force black text everywhere for print legibility */
  * {
    color: inherit !important;
  }

  /* Status flags — keep colour for the key visual */
  .status-flag.flag,
  .badge.red {
    background: #800000 !important;
    color: white !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .status-flag.amber,
  .badge.amber {
    background: #B8860B !important;
    color: white !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .status-flag.healthy,
  .badge.green {
    background: #1f5c47 !important;
    color: white !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Screen-only print helper button */
.print-button {
  cursor: pointer;
}
