/* ═══════════════════════════════════════════════════════════════════════════════
   PRINT STYLES — Professional Chanza Report
   Loaded separately from Tailwind to avoid tree-shaking by @layer processing.
   ═══════════════════════════════════════════════════════════════════════════════ */

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

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
    animation: none !important;
    transition: none !important;
  }

  body {
    background: white !important;
    font-size: 10pt !important;
    line-height: 1.45 !important;
    color: #1a1a1a !important;
  }

  /* ── Hide non-print elements ────────────────────────────────────────────── */
  header, footer, nav,
  .no-print,
  button,
  a[role="button"],
  [data-print-hide],
  .print-hide {
    display: none !important;
  }

  /* ── Print header (branded) ─────────────────────────────────────────────── */
  .print-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 12pt 0;
    margin-bottom: 14pt;
    border-bottom: 2pt solid #003819;
  }
  .print-header img {
    height: 28pt;
    width: auto;
  }
  .print-header .print-header-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 8pt;
    color: #666;
    text-align: right;
    letter-spacing: 0.5pt;
  }
  .print-header .print-header-text strong {
    display: block;
    font-size: 10pt;
    color: #003819;
    letter-spacing: 0;
  }

  /* ── Print footer (fixed at page bottom) ────────────────────────────────── */
  .print-footer {
    display: block !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6pt 0 0 0;
    border-top: 0.5pt solid #ccc;
    font-family: 'Roboto', sans-serif;
    font-size: 6.5pt;
    color: #999;
    text-align: center;
  }

  /* ── Results container ──────────────────────────────────────────────────── */
  #chanza-results {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }

  /* ── Typography scaling ─────────────────────────────────────────────────── */
  #chanza-results h1 {
    font-size: 22pt !important;
    margin-bottom: 6pt !important;
    line-height: 1.2 !important;
  }
  #chanza-results h2 {
    font-size: 16pt !important;
    margin-bottom: 4pt !important;
    line-height: 1.25 !important;
  }
  #chanza-results h3 {
    font-size: 13pt !important;
    margin-bottom: 3pt !important;
    line-height: 1.3 !important;
  }
  #chanza-results h4 {
    font-size: 10pt !important;
    line-height: 1.3 !important;
  }
  #chanza-results p {
    font-size: 9pt !important;
    line-height: 1.45 !important;
    margin-bottom: 3pt !important;
  }

  /* ── Spacing reduction ──────────────────────────────────────────────────── */
  #chanza-results .mb-14 { margin-bottom: 16pt !important; }
  #chanza-results .mb-10 { margin-bottom: 12pt !important; }
  #chanza-results .mb-8 { margin-bottom: 10pt !important; }
  #chanza-results .mb-6 { margin-bottom: 8pt !important; }
  #chanza-results .mb-5 { margin-bottom: 6pt !important; }
  #chanza-results .mb-4 { margin-bottom: 5pt !important; }
  #chanza-results .mb-3 { margin-bottom: 4pt !important; }
  #chanza-results .mb-2 { margin-bottom: 3pt !important; }
  #chanza-results .py-12 { padding-top: 0 !important; padding-bottom: 0 !important; }
  #chanza-results .py-8 { padding-top: 8pt !important; padding-bottom: 8pt !important; }
  #chanza-results .pb-24 { padding-bottom: 0 !important; }
  #chanza-results .p-8 { padding: 10pt !important; }
  #chanza-results .p-10 { padding: 12pt !important; }
  #chanza-results .p-12 { padding: 12pt !important; }

  /* ── Cards: remove shadows, tighten border radius ───────────────────────── */
  #chanza-results .glass-card,
  #chanza-results .rounded-3xl,
  #chanza-results .rounded-2xl,
  #chanza-results .rounded-xl {
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-radius: 6pt !important;
  }

  /* ── Household breakdown grid (3-col) ───────────────────────────────────── */
  .print-grid-3col {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8pt !important;
  }
  .print-grid-3col > div {
    padding: 8pt !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  /* ── Animated bar tracks: static for print ──────────────────────────────── */
  .print-bar-track {
    height: 5pt !important;
    border-radius: 3pt !important;
  }
  .print-bar-track > div {
    transition: none !important;
    animation: none !important;
  }

  /* ── Page break controls ────────────────────────────────────────────────── */
  #chanza-results .glass-card {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
  .print-break-before {
    break-before: page !important;
    page-break-before: always !important;
  }
  #chanza-results h2,
  #chanza-results h3 {
    break-after: avoid !important;
    page-break-after: avoid !important;
  }

  /* ── Light meals grid (2-col) ───────────────────────────────────────────── */
  .print-grid-2col {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6pt !important;
  }
  .print-grid-2col > div {
    padding: 6pt !important;
    break-inside: avoid !important;
  }

  /* ── CHANZA UPGRADE SECTION: dark theme → light for print ───────────────── */
  #chanza-results .chanza-upgrade-section {
    background: white !important;
    border: 1.5pt solid #003819 !important;
    color: #1a1a1a !important;
    box-shadow: none !important;
    padding: 12pt !important;
  }
  #chanza-results .chanza-upgrade-section h2,
  #chanza-results .chanza-upgrade-section span,
  #chanza-results .chanza-upgrade-section p,
  #chanza-results .chanza-upgrade-section div {
    color: #1a1a1a !important;
  }
  #chanza-results .chanza-upgrade-section .print-accent {
    color: #003819 !important;
  }

  /* ── Upgrade cards: clean print version ─────────────────────────────────── */
  #chanza-results .chanza-upgrade-section .upgrade-card-print {
    background: #f8f8f8 !important;
    border: 0.75pt solid #ddd !important;
    border-radius: 4pt !important;
    margin-bottom: 6pt !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    overflow: visible !important;
  }
  #chanza-results .chanza-upgrade-section .upgrade-card-print .border-b {
    border-color: #e0e0e0 !important;
  }
  #chanza-results .chanza-upgrade-section .upgrade-card-print h4 {
    color: #003819 !important;
    font-size: 10pt !important;
  }
  #chanza-results .chanza-upgrade-section .rounded-full {
    border-radius: 3pt !important;
  }
  #chanza-results .chanza-upgrade-section .bg-stone-500 {
    background-color: #999 !important;
  }

  /* ── Stats grid in upgrade section ──────────────────────────────────────── */
  #chanza-results .chanza-upgrade-section .print-stats-grid {
    border: 0.75pt solid #ddd !important;
    border-radius: 4pt !important;
    background: #f4f4f4 !important;
    padding: 8pt !important;
  }
  #chanza-results .chanza-upgrade-section .print-stats-grid .border-x {
    border-color: #ddd !important;
  }

  /* ── Band badge ─────────────────────────────────────────────────────────── */
  #chanza-results .rounded-full.border-2 {
    font-size: 12pt !important;
    padding: 3pt 10pt !important;
    border-width: 1.5pt !important;
  }

  /* ── "Doing well" and "Opportunity" cards ────────────────────────────────── */
  #chanza-results .glass-card.border-green-200,
  #chanza-results .glass-card.border-amber-200 {
    background: white !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  /* ── CTA section: hide interactive elements ─────────────────────────────── */
  .print-cta-section a,
  .print-cta-section button {
    display: none !important;
  }

  /* ── Icons: scale down for print ────────────────────────────────────────── */
  #chanza-results svg {
    width: 10pt !important;
    height: 10pt !important;
  }

  /* ── Hide email capture forms ───────────────────────────────────────────── */
  .print-hide-capture {
    display: none !important;
  }

  /* ── Print disclaimer (visible only in print) ───────────────────────────── */
  .print-disclaimer {
    display: block !important;
    margin-top: 12pt;
    padding-top: 8pt;
    border-top: 0.5pt solid #ccc;
    font-family: 'Roboto', sans-serif;
    font-size: 7pt;
    color: #888;
    text-align: center;
    line-height: 1.4;
  }

  /* ── Link styling ───────────────────────────────────────────────────────── */
  a {
    color: #003819 !important;
    text-decoration: none !important;
  }
}
