/* Print stylesheet — activated both by `@media print` (Ctrl+P in a browser)
 * and by `body.print-mode` when Playwright renders with ?print=1. */

body.print-mode .sidebar,
body.print-mode .toast,
body.print-mode .modal-backdrop,
body.print-mode .range-wrap,
body.print-mode .page-header .controls,
body.print-mode .card .platform-picker,
body.print-mode .export-menu,
body.print-mode .export-btn,
body.print-mode button.chip {
  display: none !important;
}

body.print-mode .app,
body.print-mode .app.sidebar-collapsed {
  grid-template-columns: 1fr !important;
}
body.print-mode main {
  padding: 0 28px 24px !important;
}

/* Branded page header printed on every page */
body.print-mode .pdf-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 3px solid var(--stc-purple);
  margin-bottom: 20px;
}
body.print-mode .pdf-page-header .brand-block {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 22px; color: var(--stc-purple);
  letter-spacing: -0.01em;
}
body.print-mode .pdf-page-header .report-title {
  font-size: 13px; color: var(--color-text-muted); text-align: end;
}
body.print-mode .pdf-page-header .report-title strong {
  display: block; color: var(--color-text); font-size: 15px;
}

/* Normal dashboard hides this header */
.pdf-page-header { display: none; }
.pdf-cover, .pdf-toc, .pdf-summary { display: none; }

/* ---- Executive template extras (only when body has .print-executive) ---- */
body.print-executive .pdf-cover {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 1050px;                  /* ~ A4 minus margins */
  padding: 80px 60px;
  background: linear-gradient(160deg, var(--stc-purple-900) 0%, var(--stc-purple) 60%, var(--stc-purple-500) 100%);
  color: var(--stc-white);
  page-break-after: always;
  border-radius: 0;
  margin: 0 -28px 0 -28px;             /* bleed to page edges */
}
body.print-executive .pdf-cover .eyebrow {
  font-size: 14px; letter-spacing: 0.24em; text-transform: uppercase;
  opacity: 0.85;
}
body.print-executive .pdf-cover .big-title {
  font-size: 72px; font-weight: 800; line-height: 1.04;
  letter-spacing: -0.02em;
  margin-top: 24px;
}
body.print-executive .pdf-cover .range {
  margin-top: 20px; font-size: 22px; opacity: 0.9;
}
body.print-executive .pdf-cover .mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 84px; height: 64px; border-radius: 12px;
  background: var(--stc-white); color: var(--stc-purple);
  font-weight: 800; font-size: 38px; letter-spacing: -0.02em;
}
body.print-executive .pdf-cover .footer-line {
  font-size: 13px; opacity: 0.8; letter-spacing: 0.04em;
}

body.print-executive .pdf-toc {
  display: block;
  padding: 40px 20px;
  page-break-after: always;
}
body.print-executive .pdf-toc h2 {
  font-size: 28px; margin: 0 0 24px; color: var(--stc-purple);
}
body.print-executive .pdf-toc ol {
  list-style: none; padding: 0; margin: 0;
  border-top: 1px solid var(--color-border);
}
body.print-executive .pdf-toc li {
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 15px;
}
body.print-executive .pdf-toc .num {
  display: inline-block; width: 28px; color: var(--stc-coral); font-weight: 700;
}

body.print-executive .pdf-summary {
  display: block;
  padding: 20px 22px;
  background: var(--stc-purple-50);
  border-left: 4px solid var(--stc-purple);
  border-radius: var(--radius-md);
  margin: 0 0 24px;
}
html[dir="rtl"] body.print-executive .pdf-summary {
  border-left: 0;
  border-right: 4px solid var(--stc-purple);
}
body.print-executive .pdf-summary h3 {
  margin: 0 0 10px; font-size: 13px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--stc-purple);
}
body.print-executive .pdf-summary ul {
  margin: 0; padding-inline-start: 20px;
}
body.print-executive .pdf-summary li {
  font-size: 14px; line-height: 1.6; margin-bottom: 6px;
}

/* Never break a card/kpi/chart across pages */
body.print-mode .card,
body.print-mode .kpi,
body.print-mode .chart-wrap {
  break-inside: avoid;
  page-break-inside: avoid;
}
body.print-mode .kpi-grid { break-inside: avoid; }

/* Keep Chart.js canvases visible + sized for print */
body.print-mode .chart-wrap { height: 300px; }
body.print-mode .chart-wrap.tall { height: 360px; }

/* Hide post-modal, demo banner in print */
body.print-mode [x-show="postModalOpen"],
body.print-mode [x-show="compareModalOpen"] { display: none !important; }

/* Section title tags above each section in the PDF */
body.print-mode .pdf-section-title {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--stc-purple);
  margin: 28px 0 12px;
  letter-spacing: -0.01em;
}
.pdf-section-title { display: none; }

@media print {
  @page { size: A4; margin: 14mm 12mm; }
  body { background: #fff !important; }
}
