/* =========================================
   GNOWISE — PRINT-ONLY STYLES (forceful)
   ========================================= */

/* Hide print-only things on screen by default */
.print-only { display: none !important; }

/* Ensure exact colors in print */
* {
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

@page {
  size: A4;
  margin: 10mm 12mm 14mm 12mm; /* tighter top margin */
}

@media print {

  /* Show print-only header in print */
  .print-only,
  .print-header { display: block !important; }

  /* Strip site chrome / controls */
  header, footer, nav, #wpadminbar,
  .site-header, .site-footer,
  .ast-mobile-header, .ast-desktop-header,
  .ast-breadcrumbs, .ast-archive-description,
  .secondary, #secondary,
  #drop-area, #creditMsg,
  #downloadCsvBtn, #printPdfBtn, #batchProcessBtn,
  input[type="file"], input[type="button"], input[type="submit"],
  .file-info,
  #batchPropertySearch,
  .entry-header .entry-title,
  .ast-plain-container .entry-header,
  .ast-plain-container .site-header {
    display: none !important;
  }

  body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    color: #111 !important;
    font-size: 12px !important;
  }

  /* One authority width for everything */
  #primary,
  .site-content,
  .content-area,
  .site-main,
  .ast-container,
  .entry-content {
    margin: 0 auto !important;
    padding: 0 !important;
    max-width: 1040px !important;
    width: 100% !important;
    background: #fff !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  /* ---------- PRINT HEADER (Logo) ---------- */
  .print-header {
    margin: 0 0 6px 0 !important;  /* reduces top whitespace */
    padding: 0 !important;
  }
  .print-header img {
    height: 18px !important;       /* small logo */
    width: auto !important;
    display: block !important;
  }

  /* ---------- Section headings ---------- */
  .resultsSection h4,
  .portfolioSummary h4 {
    margin: 6px 0 10px 0 !important;
    padding: 0 !important;
    font-size: 15px !important;
    line-height: 1.25 !important;
    color: #111 !important;
    font-weight: 600 !important;
  }

  /* Keep summary & results same width and aligned */
  .portfolioSummary,
  .resultsSection {
    max-width: 1040px !important;
    width: 100% !important;
    margin: 0 auto 10px auto !important;
    padding: 0 !important;
    background: #fff !important;
    border: 0 !important; /* row border invisible */
  }

  /* Kill any borders/lines in the chart/insights row */
  .portfolioSummary,
  .portfolioSummary * {
    border: 0 !important;
    outline: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  /* 2 clean columns */
  .portfolioSummary {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 16px !important;
  }
  .portfolioSummary .summaryColumn,
  .portfolioSummary .chartColumn {
    flex: 1 1 0 !important;
    width: 50% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .portfolioSummary .portfolioMetrics {
    margin: 2px 0 0 0 !important;
    padding: 0 !important;
  }
  .portfolioSummary .portfolioMetrics div {
    margin: 0 0 6px 0 !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
    color: #222 !important;
  }

  #highRiskPostalList {
    margin: 4px 0 0 16px !important;
    padding: 0 !important;
  }
  #highRiskPostalList li {
    margin: 0 0 4px 0 !important;
    font-size: 12px !important;
  }

  .portfolioSummary .chartBox {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
  }
  #riskDistributionChart {
    display: block !important;
    width: 100% !important;
    height: 230px !important; /* tidy fixed height */
  }

  /* ---------- Results Table ---------- */
  .resultsSection .resultsTable {
    width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    background: #fff !important;
    margin: 6px 0 0 0 !important;
    font-size: 11px !important;
  }

  .resultsSection .resultsTable thead th {
    text-align: left !important;
    font-weight: 600 !important;
    border-bottom: 1px solid #ddd !important;
    padding: 6px 8px !important;
    vertical-align: bottom !important;
    background: #fff !important;
    color: #111 !important;
  }

  .resultsSection .resultsTable tbody td {
    border-bottom: 1px solid #eee !important;
    padding: 6px 8px !important;
    vertical-align: top !important;
    color: #111 !important;
    word-break: break-word !important;
  }

  /* Column widths */
  .resultsSection .resultsTable th:nth-child(1),
  .resultsSection .resultsTable td:nth-child(1) { width: 10% !important; }
  .resultsSection .resultsTable th:nth-child(2),
  .resultsSection .resultsTable td:nth-child(2) { width: 40% !important; }
  .resultsSection .resultsTable th:nth-child(3),
  .resultsSection .resultsTable td:nth-child(3) { width: 13% !important; text-align: right !important; }
  .resultsSection .resultsTable th:nth-child(4),
  .resultsSection .resultsTable td:nth-child(4) { width: 13% !important; text-align: right !important; }
  .resultsSection .resultsTable th:nth-child(5),
  .resultsSection .resultsTable td:nth-child(5) { width: 13% !important; text-align: right !important; }
  .resultsSection .resultsTable th:nth-child(6),
  .resultsSection .resultsTable td:nth-child(6) { width: 11% !important; }

  /* Risk bar sizing */
  .resultsTable td div[style*="linear-gradient"],
  .resultsTable td .risk-bar,
  .resultsTable td .barometer {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Page-break hygiene */
  .portfolioSummary,
  .resultsSection,
  .resultsSection .resultsTable,
  .resultsSection .resultsTable thead,
  .resultsSection .resultsTable tbody,
  .resultsSection .resultsTable tr {
    page-break-inside: avoid !important;
  }
  .portfolioSummary { page-break-after: avoid !important; }

  /* Remove extra theme spacing */
  .ast-container,
  .entry-content,
  .entry-header,
  .ast-plain-container .site-content .entry-header,
  .ast-separate-container .ast-article-post,
  .ast-separate-container .ast-article-single {
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: #fff !important;
  }

  .entry-content > *:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  /* Tighten spacing between logo and summary row */
  .print-header + .portfolioSummary {
    margin-top: 2px !important;
  }

  /* Links as plain text */
  a, a:visited {
    color: #111 !important;
    text-decoration: none !important;
  }
}
