/* ================================================================
 * PDF Snapshot Export Styles — Wave 1
 * ----------------------------------------------------------------
 * Scoped to .pdf-snapshot-root (the cloned export tree). These styles
 * apply only to the off-screen clone that html2canvas captures, never
 * to the live screen.
 *
 * Strategy: re-map the dark-theme CSS variables to light values inside
 * the snapshot scope. Result-card / table / typography styles authored
 * against var(--text), var(--card-bg), etc. resolve to print-friendly
 * values without rewriting every rule.
 * ================================================================ */

.pdf-snapshot-root {
  /* Re-map tokens to light values for print */
  --dark-bg: #ffffff;
  --dark: #1a1a1a;
  --text: #1a1a1a;
  --text-secondary: #6b7280;
  --card-bg: #ffffff;
  --surface: #f5f7fa;
  --border-color: #d0d5dd;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --sidebar-bg: #ffffff;
  --sidebar-border: #d0d5dd;
  --sidebar-hover: rgba(0,0,0,.04);
  --topbar-bg: #ffffff;
  --shadow: 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 2px 6px rgba(0,0,0,.08);

  width: 760px;
  max-width: 760px;
  margin: 0;
  padding: 0;
  background: #ffffff;
  color: #1a1a1a;
  display: block !important;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Result cards: white background, light border, no shadow, page-break safety */
.pdf-snapshot-root .result-card {
  background: #ffffff !important;
  border: 1px solid #d0d5dd !important;
  border-radius: 8px;
  margin: 12px 0;
  box-shadow: none !important;
  page-break-inside: auto;
}
.pdf-snapshot-root .result-card-header {
  background: #f5f7fa !important;
  border-bottom: 1px solid #d0d5dd !important;
  cursor: default !important;
  page-break-after: avoid;
}
.pdf-snapshot-root .result-card-header::after { content: '' !important; display: none !important; }
.pdf-snapshot-root .result-card-body {
  display: block !important;
  padding: 16px 20px !important;
  background: #ffffff !important;
}

/* Table page-break hints: keep rows intact, allow tables to span pages */
.pdf-snapshot-root table { page-break-inside: auto; }
.pdf-snapshot-root tr { page-break-inside: avoid; page-break-after: auto; }
.pdf-snapshot-root thead { display: table-header-group; }
.pdf-snapshot-root tfoot { display: table-row-group; }

.pdf-snapshot-root h1, .pdf-snapshot-root h2, .pdf-snapshot-root h3, .pdf-snapshot-root h4 {
  page-break-after: avoid;
}

/* Hide residual chrome that wasn't deleted by the JS pass */
.pdf-snapshot-root .toggle-arrow,
.pdf-snapshot-root .uipt-edit-btn,
.pdf-snapshot-root .lifecycle-step,
.pdf-snapshot-root .lifecycle-connector,
.pdf-snapshot-root .results-header-actions,
.pdf-snapshot-root .bid-lifecycle-stepper { display: none !important; }

/* ================================================================
 * Cover page
 * ================================================================ */
.pdf-snapshot-root .pdf-cover {
  text-align: center;
  padding: 60px 40px 40px;
  background: #ffffff;
}
.pdf-snapshot-root .pdf-brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #14b8a6;
  margin-bottom: 56px;
}
.pdf-snapshot-root .pdf-project-name {
  font-size: 30px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 32px;
  line-height: 1.2;
}
.pdf-snapshot-root .pdf-cover-meta {
  margin: 0 auto 32px;
  max-width: 480px;
  text-align: left;
  font-size: 13px;
}
.pdf-snapshot-root .pdf-meta-row {
  padding: 8px 0;
  border-bottom: 1px solid #e4e7eb;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.pdf-snapshot-root .pdf-meta-row:last-child { border-bottom: none; }
.pdf-snapshot-root .pdf-meta-label {
  font-weight: 600;
  color: #6b7280;
  letter-spacing: 0.3px;
}
.pdf-snapshot-root .pdf-meta-value {
  color: #1a1a1a;
  text-align: right;
}
.pdf-snapshot-root .pdf-total-block {
  background: #f5f7fa;
  border-radius: 12px;
  padding: 24px;
  margin: 24px auto;
  max-width: 480px;
}
.pdf-snapshot-root .pdf-total-label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.pdf-snapshot-root .pdf-total-value {
  font-size: 36px;
  font-weight: 700;
  color: #14b8a6;
  margin: 8px 0;
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
}
.pdf-snapshot-root .pdf-honest-confidence {
  font-size: 12px;
  color: #4b5563;
  margin-top: 8px;
  letter-spacing: 0.3px;
}
.pdf-snapshot-root .pdf-preliminary-tag {
  display: inline-block;
  margin: 12px 0 24px;
  padding: 6px 14px;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
  letter-spacing: 0.5px;
}
.pdf-snapshot-root .pdf-cover-footer {
  margin-top: 32px;
  font-size: 11px;
  color: #6b7280;
}
.pdf-snapshot-root .pdf-cover-footer div { margin: 4px 0; }

/* ================================================================
 * Table of Contents
 * ================================================================ */
.pdf-snapshot-root .pdf-toc {
  padding: 40px 40px 20px;
}
.pdf-snapshot-root .pdf-toc-title {
  font-size: 22px;
  color: #14b8a6;
  border-bottom: 2px solid #14b8a6;
  padding-bottom: 8px;
  margin: 0 0 20px;
  font-weight: 700;
}
.pdf-snapshot-root .pdf-toc-list { font-size: 13px; }
.pdf-snapshot-root .pdf-toc-entry {
  display: flex;
  align-items: baseline;
  padding: 8px 0;
  gap: 8px;
  border-bottom: 1px dotted #d0d5dd;
}
.pdf-snapshot-root .pdf-toc-entry:last-child { border-bottom: none; }
.pdf-snapshot-root .pdf-toc-label {
  flex: 0 0 auto;
  color: #1a1a1a;
  font-weight: 500;
}
.pdf-snapshot-root .pdf-toc-leader { flex: 1 1 auto; }
.pdf-snapshot-root .pdf-toc-page {
  flex: 0 0 auto;
  color: #6b7280;
  font-size: 11px;
}

/* ================================================================
 * Back-to-top markers + page breaks
 * ================================================================ */
.pdf-snapshot-root .pdf-back-to-top {
  text-align: right;
  margin: 12px 20px 4px;
  font-size: 10px;
  color: #6b7280;
  font-style: italic;
}
.pdf-snapshot-root .pdf-page-break {
  page-break-after: always;
  height: 0;
}

/* ================================================================
 * Reset focus / contenteditable artifacts
 * ================================================================ */
.pdf-snapshot-root *:focus { outline: none !important; }
.pdf-snapshot-root [contenteditable="true"] {
  border: none !important;
  outline: none !important;
  background: transparent !important;
}
