/* ==========================================================================
   CyFun Tool - Print Stylesheet
   Used for PDF report generation via window.print()
   ========================================================================== */

@page {
  size: A4;
  margin: 18mm 15mm 20mm 15mm;
}

@media print {

  /* ---------- Hide non-content elements ---------- */
  .header,
  .sidebar,
  .side-panel,
  .toast-container,
  .modal-overlay,
  #sidebar-toggle,
  .header__actions,
  .header__org-switcher,
  .tools-menu,
  .org-dropdown,
  .assess-toolbar,
  .assess-validation,
  .assess-batch-bar,
  .sidebar__search,
  .req-context-menu,
  .update-banner,
  .btn,
  button,
  label,
  input,
  textarea {
    display: none !important;
  }

  .score-dots__dot::after {
    display: none !important;
  }

  /* ---------- Layout reset ---------- */
  body {
    margin: 0;
    padding: 0;
    background: #fff !important;
    color: #1a1a1a !important;
    font-family: 'Mulish', Arial, sans-serif;
    font-size: 10pt;
    line-height: 1.45;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  #app-shell,
  .app,
  .app__body,
  .main,
  .main__content {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .app__body {
    grid-template-columns: 1fr !important;
  }

  /* ---------- Report header ---------- */
  .report-header {
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 3px solid #339911;
    padding-bottom: 12px;
    margin-bottom: 20px;
  }

  .report-header__logo {
    width: 50px;
    height: 50px;
  }

  .report-header__info {
    flex: 1;
  }

  .report-header__title {
    font-family: 'Montserrat', Arial, sans-serif;
    font-size: 18pt;
    font-weight: 700;
    color: #339911;
    margin: 0;
  }

  .report-header__subtitle {
    font-size: 10pt;
    color: #555;
    margin: 2px 0 0;
  }

  .report-header__meta {
    text-align: right;
    font-size: 8pt;
    color: #777;
  }

  /* ---------- Section headings ---------- */
  .report-section {
    margin-bottom: 16px;
  }

  /* Avoid page breaks inside table rows, not entire sections
     (avoid on whole section causes blank pages with long tables) */
  .report-section tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .report-section--break {
    page-break-before: always;
  }

  .report-section__title {
    font-family: 'Montserrat', Arial, sans-serif;
    font-size: 13pt;
    font-weight: 700;
    color: #339911;
    border-bottom: 1px solid #ddd;
    padding-bottom: 4px;
    margin: 0 0 10px;
  }

  /* ---------- Status banner ---------- */
  .report-status {
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 10pt;
  }

  .report-status--pass {
    background: #e8f5e9 !important;
    border-left: 4px solid #339911;
  }

  .report-status--fail {
    background: #fce4ec !important;
    border-left: 4px solid #c0392b;
  }

  .report-status--partial {
    background: #fff8e1 !important;
    border-left: 4px solid #e67e22;
  }

  .report-status__title {
    font-weight: 700;
    margin: 0;
  }

  .report-status__desc {
    margin: 2px 0 0;
    font-size: 9pt;
    color: #555;
  }

  /* ---------- KPI grid ---------- */
  .report-kpis {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
  }

  .report-kpi {
    flex: 1 1 30%;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 12px;
    text-align: center;
  }

  .report-kpi__value {
    font-family: 'Montserrat', Arial, sans-serif;
    font-size: 14pt;
    font-weight: 700;
    color: #339911;
  }

  .report-kpi__label {
    font-size: 8pt;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }

  /* ---------- Tables ---------- */
  .report-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
    font-size: 8.5pt;
  }

  .report-table th {
    background: #f5f5f5 !important;
    font-family: 'Montserrat', Arial, sans-serif;
    font-weight: 600;
    font-size: 8pt;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #555;
    padding: 6px 8px;
    border-bottom: 2px solid #ddd;
    text-align: left;
  }

  .report-table td {
    padding: 5px 8px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
  }

  .report-table tr:nth-child(even) td {
    background: #fafafa !important;
  }

  .report-table .score-pass {
    color: #339911;
    font-weight: 600;
  }

  .report-table .score-fail {
    color: #c0392b;
    font-weight: 600;
  }

  .report-table .text-muted {
    color: #999;
  }

  .report-table .badge-key {
    display: inline-block;
    background: #fff3cd !important;
    color: #856404;
    font-size: 7pt;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
  }

  /* ---------- Generic tables: ensure borders when printing ---------- */
  table {
    border-collapse: collapse;
    width: 100%;
  }

  table th,
  table td {
    border: 1px solid #ccc;
    padding: 4px 8px;
  }

  /* ---------- Key measure items ---------- */
  .report-km-list {
    columns: 2;
    column-gap: 16px;
    margin-bottom: 12px;
  }

  .report-km-item {
    break-inside: avoid;
    padding: 4px 0;
    font-size: 8.5pt;
    border-bottom: 1px solid #f0f0f0;
  }

  .report-km-item--pass::before {
    content: "\2713  ";
    color: #339911;
    font-weight: 700;
  }

  .report-km-item--fail::before {
    content: "\2717  ";
    color: #c0392b;
    font-weight: 700;
  }

  /* ---------- Footer ---------- */
  .report-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 7pt;
    color: #999;
    border-top: 1px solid #eee;
    padding: 4px 0;
  }

  /* ---------- Page numbers ---------- */
  @page {
    @bottom-right {
      content: counter(page) " / " counter(pages);
      font-size: 8pt;
      color: #999;
    }
  }

  /* ---------- Evidence text in full req list ---------- */
  .report-evidence {
    font-size: 7.5pt;
    color: #666;
    font-style: italic;
    margin-top: 2px;
  }

  /* ---------- Utility ---------- */
  .report-text-sm {
    font-size: 8.5pt;
  }

  .report-text-muted {
    color: #777;
  }

  a {
    color: #1a1a1a !important;
    text-decoration: none !important;
  }

  /* Prevent elements from being split across pages */
  .report-table tr {
    page-break-inside: avoid;
  }

  .report-no-break {
    page-break-inside: avoid;
  }

}
