/* Print Stylesheet for Clinical Impact Simulator */

@media print {
  /* Reset page margins */
  @page {
    margin: 1.5cm;
    size: A4 portrait;
  }

  /* Hide non-essential elements */
  header button,
  .no-print,
  [data-no-print],
  footer,
  .sticky,
  button:not(.print-only) {
    display: none !important;
  }

  /* Reset body styles */
  body {
    background: white !important;
    color: black !important;
    font-size: 10pt;
    line-height: 1.4;
  }

  /* Force page breaks */
  .page-break-before {
    page-break-before: always;
  }

  .page-break-after {
    page-break-after: always;
  }

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

  /* Container adjustments */
  .container {
    max-width: 100% !important;
    padding: 0 !important;
  }

  /* Header styling */
  .print-header {
    text-align: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #333;
    padding-bottom: 0.5rem;
  }

  .print-header h1 {
    font-size: 18pt;
    font-weight: bold;
    margin-bottom: 0.25rem;
  }

  .print-header p {
    font-size: 10pt;
    color: #666;
  }

  /* Two-column layout becomes single column */
  .grid {
    display: block !important;
  }

  .grid > * {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Card styling */
  .rounded-2xl,
  .rounded-xl {
    border-radius: 4px !important;
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    margin-bottom: 0.75rem;
    page-break-inside: avoid;
  }

  /* Metric cards in compact grid */
  .metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  .metric-card {
    border: 1px solid #ddd;
    padding: 0.5rem;
    text-align: center;
  }

  .metric-card .label {
    font-size: 8pt;
    color: #666;
    margin-bottom: 0.25rem;
  }

  .metric-card .value {
    font-size: 12pt;
    font-weight: bold;
    color: #000;
  }

  /* Charts - attempt to render, hide if SVG doesn't work */
  .recharts-wrapper {
    max-height: 200px !important;
  }

  svg {
    max-height: 200px !important;
  }

  /* Tables */
  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
    margin-bottom: 1rem;
  }

  table th,
  table td {
    border: 1px solid #ddd;
    padding: 0.25rem 0.5rem;
    text-align: left;
  }

  table th {
    background-color: #f5f5f5;
    font-weight: bold;
  }

  /* Input summary section */
  .input-summary {
    page-break-inside: avoid;
    margin-bottom: 1.5rem;
  }

  .input-summary h3 {
    font-size: 12pt;
    font-weight: bold;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.25rem;
  }

  .input-summary dl {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 1rem;
    font-size: 9pt;
  }

  .input-summary dt {
    font-weight: 600;
    color: #333;
  }

  .input-summary dd {
    color: #666;
    margin: 0;
  }

  /* ROI scenarios compact view */
  .roi-scenarios {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
    page-break-inside: avoid;
  }

  .roi-scenario-card {
    border: 1px solid #ddd;
    padding: 0.5rem;
    font-size: 8pt;
  }

  .roi-scenario-card h4 {
    font-size: 9pt;
    font-weight: bold;
    margin-bottom: 0.25rem;
  }

  /* Hide animations and transitions */
  * {
    animation: none !important;
    transition: none !important;
  }

  /* Force colors for visibility */
  h1, h2, h3, h4, h5, h6 {
    color: #000 !important;
  }

  /* Avoid breaking inside important sections */
  h2, h3, h4 {
    page-break-after: avoid;
  }

  /* Logo/branding area */
  .print-logo {
    text-align: right;
    font-size: 8pt;
    color: #999;
    margin-top: 1rem;
  }
}

/* US mode: the one-page summary replaces the interactive page when printing. */
@media print {
  .us-mode > *:not(.us-print-root) {
    display: none !important;
  }

  .us-print-root {
    display: block !important;
  }

  .us-print-summary,
  .us-print-summary * {
    color: #0f172a !important;
  }

  .us-print-summary table {
    border-collapse: collapse;
  }

  .us-print-summary tr {
    border-bottom: 1px solid #e2e8f0;
    page-break-inside: avoid;
  }
}

@media print {
  /* The summary keeps its two-column layout even though .grid is blocked above. */
  .us-print-summary .grid {
    display: grid !important;
  }

  .us-print-summary .grid > * {
    margin: 0 !important;
  }

  .us-print-summary .grid-cols-4 {
    grid-template-columns: repeat(4, 1fr) !important;
  }

  .us-print-summary .grid-cols-2 {
    grid-template-columns: 1fr 1fr !important;
  }
}
