/* Shared print styles for Farm Manager calculators */

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  body {
    background: #ffffff !important;
    color: #111111 !important;
    font-size: 11pt;
    line-height: 1.4;
  }

  .page-wrap {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .no-print,
  .tool-page-header__bar,
  .tool-page-header__title-row .tool-home-btn,
  .button-row,
  .saved-list,
  .saved-empty,
  .error-panel,
  .option-grid,
  .input-grid,
  .checkbox-group,
  .warning-box:not(.print-warning),
  .pdf-export-hidden {
    display: none !important;
  }

  .print-only,
  .pdf-export-root {
    display: block !important;
  }

  .results-section {
    display: block !important;
    overflow: visible !important;
    max-height: none !important;
  }

  .results-section .card,
  .result-card,
  .result-mini,
  .sensitivity-wrap,
  .warnings-panel {
    overflow: visible !important;
    max-height: none !important;
    break-inside: avoid-page;
    page-break-inside: avoid;
    box-shadow: none !important;
    background: #ffffff !important;
    border-color: #cccccc !important;
  }

  .results-hero,
  .results-secondary,
  .results-layout {
    display: block !important;
    overflow: visible !important;
  }

  .result-card,
  .result-mini {
    margin-bottom: 0.5rem;
    border: 1px solid #cccccc;
  }

  .result-card .value,
  .result-mini .value,
  .sensitivity-table td,
  .sensitivity-table th {
    color: #111111 !important;
  }

  .result-card.positive .value,
  .sensitivity-table .positive {
    color: #1f7a3a !important;
  }

  .result-card.negative .value,
  .sensitivity-table .negative {
    color: #b83232 !important;
  }

  .sensitivity-wrap {
    overflow: visible !important;
  }

  .sensitivity-table {
    width: 100% !important;
    min-width: 0 !important;
    font-size: 9pt;
  }

  .sensitivity-table thead {
    display: table-header-group;
  }

  .sensitivity-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-export-header {
    border-bottom: 1px solid #cccccc;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }

  .print-export-header img {
    max-width: 160px;
    height: auto;
  }

  .print-export-meta {
    color: #444444;
    font-size: 10pt;
    margin: 0.35rem 0 0;
  }

  .print-warning {
    margin: 0.75rem 0;
    padding: 0.65rem 0.85rem;
    border: 1px solid #cccccc;
    background: #fffef5;
    font-size: 10pt;
  }
}

.pdf-export-hidden {
  display: none !important;
}

/* Visible clone used briefly while PDF capture runs */
.pdf-export-capture {
  position: absolute;
  left: 0;
  top: 0;
  width: 794px;
  max-width: 794px;
  padding: 24px;
  box-sizing: border-box;
  background: #ffffff;
  color: #111111;
  pointer-events: none;
  z-index: 2147483646;
  overflow: visible;
}

.pdf-export-root h2,
.pdf-export-root h3 {
  color: #214d21;
  margin: 1rem 0 0.5rem;
}

.pdf-export-root p,
.pdf-export-root table {
  font-size: 14px;
  line-height: 1.45;
}

.pdf-export-root table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 1rem;
}

.pdf-export-root th,
.pdf-export-root td {
  border: 1px solid #dddddd;
  padding: 0.45rem 0.55rem;
  text-align: left;
}

.pdf-export-root th {
  background: #eef5ee;
}
