/* ==========================================================================
   FIRE MATRIX - DEDICATED PRINT & PDF GENERATION STYLESHEET (@media print)
   Optimized for BS 9792 / PAS 79 PDF Printing & html2pdf.js Export
   ========================================================================== */

@media print {
  /* 1. HIDE ALL UI INTERACTION CONTROLS */
  .no-print,
  .app-header,
  .summary-stats-bar,
  .presets-toolbar,
  .table-footer-controls,
  .photo-dropzone,
  .canvas-actions,
  .btn-remove-photo,
  .dropdown,
  button {
    display: none !important;
  }

  /* Show Print Footer */
  .print-only,
  .print-footer {
    display: flex !important;
  }

  /* 2. GLOBAL PRINT SETUP */
  @page {
    size: A4 portrait;
    margin: 12mm 15mm 15mm 15mm;
  }

  html, body {
    background: #ffffff !important;
    color: #1e293b !important;
    font-size: 11pt !important;
    line-height: 1.4 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .app-main {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .report-wrapper {
    gap: 1rem !important;
  }

  /* 3. FLATTEN CARDS & BORDERS FOR PRINT */
  .section-card {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
    padding: 1rem !important;
    border-radius: 4px !important;
    page-break-inside: avoid;
  }

  .section-header {
    border-bottom: 2px solid #e11d48 !important;
    margin-bottom: 0.75rem !important;
    padding-bottom: 0.3rem !important;
  }

  .section-title {
    color: #0f172a !important;
    font-size: 1.1rem !important;
  }

  .section-title i {
    color: #e11d48 !important;
  }

  .section-badge {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #cbd5e1 !important;
  }

  /* 4. BRANDING HEADER PRINT FORMATTING */
  .report-header-banner {
    background: #1e293b !important;
    color: #ffffff !important;
    border-left: 6px solid #e11d48 !important;
    padding: 1rem 1.25rem !important;
    page-break-after: avoid;
  }

  .company-title {
    color: #ffffff !important;
    font-size: 1.5rem !important;
  }

  .company-tagline, .company-address {
    color: #cbd5e1 !important;
  }

  .compliance-badge {
    background: #e11d48 !important;
    color: #ffffff !important;
    border: none !important;
  }

  .ref-input {
    border: none !important;
    background: transparent !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 1rem !important;
    width: auto !important;
  }

  /* 5. FORM INPUT CONVERSION FOR CLEAN OUTPUT */
  input, select, textarea {
    border: none !important;
    background: transparent !important;
    color: #0f172a !important;
    padding: 0 !important;
    font-size: 10pt !important;
    font-weight: 600 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    box-shadow: none !important;
    outline: none !important;
  }

  .form-control, .form-select {
    border-bottom: 1px dashed #cbd5e1 !important;
    border-radius: 0 !important;
  }

  .standard-card {
    border: 1px solid #cbd5e1 !important;
    background: #f8fafc !important;
    padding: 0.75rem !important;
  }

  .standard-card.active {
    border: 2px solid #e11d48 !important;
    background: #fff1f2 !important;
  }

  .assessor-card-box {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
  }

  .assessor-avatar {
    border-color: #e11d48 !important;
    color: #e11d48 !important;
    background: #ffffff !important;
  }

  /* 6. RISK MATRIX PRINT FORMATTING */
  .risk-matrix-layout {
    display: grid !important;
    grid-template-columns: 1fr 1.2fr !important;
    gap: 1rem !important;
  }

  .matrix-controls-panel, .matrix-grid-panel {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
  }

  .cell-risk {
    font-size: 8pt !important;
    padding: 0.6rem 0.3rem !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .risk-trivial { background-color: #10b981 !important; color: #fff !important; }
  .risk-tolerable { background-color: #84cc16 !important; color: #1e293b !important; }
  .risk-moderate { background-color: #f59e0b !important; color: #1e293b !important; }
  .risk-substantial { background-color: #f97316 !important; color: #fff !important; }
  .risk-intolerable { background-color: #ef4444 !important; color: #fff !important; }

  .badge-tag {
    color: #ffffff !important;
    font-size: 1.1rem !important;
    padding: 0.4rem 1.2rem !important;
  }

  /* 7. ACTION PLAN TABLE PRINT FORMATTING */
  .table-action-plan {
    border: 1px solid #cbd5e1 !important;
    page-break-inside: auto;
  }

  .table-action-plan tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  .table-action-plan th {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-bottom: 2px solid #cbd5e1 !important;
  }

  .table-action-plan td {
    border-bottom: 1px solid #cbd5e1 !important;
  }

  /* 8. PHOTOGRAPHIC EVIDENCE GRID (2-COLUMN PRINT) */
  .photo-matrix-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.75rem !important;
  }

  .photo-card {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    page-break-inside: avoid !important;
  }

  .photo-preview-wrap {
    height: 180px !important;
  }

  .photo-img {
    object-fit: cover !important;
  }

  /* 9. SIGNATURE & DECLARATION PRINT FORMATTING */
  .signature-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .declaration-text-box {
    background: #f8fafc !important;
    border-left: 4px solid #e11d48 !important;
    color: #1e293b !important;
  }

  .canvas-wrapper {
    border: 1px solid #94a3b8 !important;
  }

  /* 10. PRINT FOOTER BRANDING */
  .print-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem 15mm;
    border-top: 1px solid #cbd5e1;
    font-size: 8pt;
    color: #64748b;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
  }
}
