/* Shared result export controls and a readable, paginated print report. */
.cp-test-print-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 16px 0;
}

.cp-test-print-actions button[data-cp-test-print] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 18px;
  border: 1px solid #173454;
  border-radius: 10px;
  background: #173454;
  color: #fff;
  font: inherit;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  white-space: normal;
  cursor: pointer;
}

.cp-test-print-actions button[data-cp-test-print]:hover:not(:disabled) {
  border-color: #0f253e;
  background: #0f253e;
}

.cp-test-print-actions button[data-cp-test-print]:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 3px;
}

.cp-test-print-actions button[data-cp-test-print]:disabled {
  border-color: #cbd5e1;
  background: #e2e8f0;
  color: #475569;
  cursor: not-allowed;
  box-shadow: none;
}

.cp-test-print-note {
  flex: 1 1 240px;
  margin: 0;
  color: #475569;
  font-size: 0.875rem;
  line-height: 1.5;
}

#cp-test-print-report {
  display: none;
}

.cp-test-print-replaced {
  display: none !important;
}

@media print {
  @page {
    size: A4;
    margin: 14mm;
  }

  html:has(body.cp-printing-test),
  body.cp-printing-test {
    position: static !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
    color: #111 !important;
  }

  body.cp-printing-test > * {
    display: none !important;
  }

  html body.cp-printing-test > :not(#cp-test-print-report) {
    display: none !important;
    visibility: hidden !important;
  }

  body.cp-printing-test > #cp-test-print-report {
    display: block !important;
    position: static !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    font: 10.5pt/1.5 Arial, Helvetica, sans-serif !important;
    overflow-wrap: anywhere;
  }

  #cp-test-print-report,
  #cp-test-print-report * {
    visibility: visible !important;
    background: #fff !important;
    color: #111 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    animation: none !important;
    transition: none !important;
  }

  #cp-test-print-report h1,
  #cp-test-print-report h2,
  #cp-test-print-report h3,
  #cp-test-print-report h4 {
    margin: 1em 0 0.4em;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 700;
    line-height: 1.3;
    break-after: avoid;
    page-break-after: avoid;
  }

  #cp-test-print-report h1 {
    margin-top: 0;
    font-size: 19pt;
  }

  #cp-test-print-report h2 {
    padding-bottom: 5px;
    border-bottom: 1px solid #9ca3af;
    font-size: 14pt;
  }

  #cp-test-print-report h3 {
    font-size: 12pt;
  }

  #cp-test-print-report h4 {
    font-size: 11pt;
  }

  #cp-test-print-report p,
  #cp-test-print-report ul,
  #cp-test-print-report ol {
    margin: 0.45em 0 0.8em;
    orphans: 3;
    widows: 3;
  }

  #cp-test-print-report ul,
  #cp-test-print-report ol {
    padding-left: 1.5em;
  }

  #cp-test-print-report .cp-pdf-results {
    margin: 12px 0 18px;
  }

  #cp-test-print-report section {
    padding: 0 !important;
    border: 0 !important;
  }

  #cp-test-print-report .cp-pdf-results > div,
  #cp-test-print-report .cp-pdf-results > section {
    margin: 0 0 12px;
  }

  #cp-test-print-report .cp-pdf-chart {
    margin: 12px 0 18px;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  #cp-test-print-report .cp-pdf-chart img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 100mm;
    object-fit: contain;
  }

  #cp-test-print-report figcaption {
    margin-top: 5px;
    font-size: 9pt;
  }

  #cp-test-print-report .cp-pdf-answer {
    margin: 0 0 10px;
    padding: 0 0 9px;
    border-bottom: 1px solid #d1d5db;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  #cp-test-print-report .cp-pdf-question {
    margin: 0 0 3px;
    font-weight: 700;
  }

  #cp-test-print-report .cp-pdf-response {
    margin: 0;
    padding-left: 12px;
    white-space: pre-wrap;
  }

  #cp-test-print-report .cp-pdf-pre {
    white-space: pre-wrap;
  }
}
