/* PDF report button + preview modal — same design as the Trending page's (views/insights/trending.ejs),
   shared here for the Compare Projects report. Keep the two in step if either changes. */
.pdf-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--prp-surface-card);
  border: 1px solid var(--prp-border-default);
  color: var(--prp-text-primary);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.pdf-download-btn:hover {
  background: var(--prp-surface-body);
  border-color: var(--prp-text-muted);
  color: var(--prp-text-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}
.pdf-download-btn > svg { flex-shrink: 0; }
.pdf-download-chevron {
  margin-left: 1px;
  color: var(--prp-text-muted);
}
.pdf-download-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.pdf-download-btn:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}
.pdf-pro-badge {
  background: #c9a227;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  line-height: 1;
}
.pdf-coin-balance { color: #9A6D00; }
.pdf-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(5px);
}
.pdf-preview-overlay.show {
  display: flex;
}
.pdf-preview-modal {
  width: min(1080px, 96vw);
  height: min(900px, 92vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--prp-surface-card);
  border: 1px solid var(--prp-border-default);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  animation: modalSlideIn 0.25s ease;
}
.pdf-preview-header {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px 12px 20px;
  border-bottom: 1px solid var(--prp-border-default);
  background: var(--prp-surface-card);
}
.pdf-preview-heading {
  min-width: 0;
}
.pdf-preview-heading h3 {
  margin: 0;
  color: var(--prp-text-primary);
  font-size: 16px;
  font-weight: 700;
}
.pdf-preview-heading p {
  max-width: 520px;
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--prp-text-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pdf-preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.pdf-preview-action,
.pdf-preview-close {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 6px;
  cursor: pointer;
}
.pdf-preview-action {
  padding: 0 13px;
  border: 1px solid #1FAD5D;
  background: #1FAD5D;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.pdf-preview-action.secondary {
  border-color: var(--prp-border-default);
  background: var(--prp-surface-card);
  color: var(--prp-text-secondary);
}
.pdf-preview-action:hover {
  filter: brightness(0.95);
}
/* Mobile-only, native-share trigger — styled to match the Weekly Signals report's
   share icon button (.sig-report-menu-icon-btn) rather than the boxy pdf-preview-action. */
.pdf-preview-share-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--prp-surface-card);
  color: var(--prp-text-secondary);
  border: 1px solid var(--prp-border-default);
  border-radius: 9999px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.pdf-preview-share-btn:hover {
  background: var(--prp-surface-body);
  border-color: var(--prp-border-default);
}
.pdf-preview-close {
  width: 36px;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--prp-text-secondary);
}
.pdf-preview-close:hover {
  border-color: var(--prp-border-default);
  background: var(--prp-surface-body);
}
.pdf-preview-body {
  min-height: 0;
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #525659;
}
/* Mobile browsers largely can't render a full, scrollable PDF inside an iframe (Mobile
   Safari and Android Chrome both stop at a static first page, no pagination) — page 1 still
   shows fine, so instead of hiding the iframe this docks a slim, non-blocking banner over its
   bottom edge pointing at the (already-working) download action. Shown only on real mobile
   devices via JS (user-agent detection, not a width media query — a narrow desktop window
   still renders the iframe's full pagination fine). */
.pdf-preview-mobile-banner {
  display: none; position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; background: rgba(23, 58, 100, 0.94); backdrop-filter: blur(4px);
}
.pdf-preview-mobile-banner span { font-size: 12px; font-weight: 600; color: #fff; }
.pdf-preview-mobile-open-btn {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  padding: 7px 14px; border: 0; border-radius: 999px;
  background: #1FAD5D; color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.pdf-preview-mobile-open-btn:hover { filter: brightness(0.95); }
.pdf-preview-options-bar {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--prp-border-default);
  background: var(--prp-surface-body);
  color: var(--prp-text-secondary);
  font-size: 12px;
}
.pdf-preview-options-title {
  color: var(--prp-text-primary);
  font-weight: 700;
}
.pdf-preview-option-groups {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 16px;
}
.pdf-preview-option-group {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.pdf-preview-select {
  min-height: 30px;
  padding: 4px 26px 4px 8px;
  border: 1px solid var(--prp-border-default);
  border-radius: 5px;
  background: var(--prp-surface-card);
  color: var(--prp-text-primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.pdf-preview-metric-toggle {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--prp-border-default);
  border-radius: 5px;
  background: var(--prp-surface-card);
}
.pdf-preview-metric-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.pdf-preview-metric-toggle label {
  margin: 0;
  padding: 4px 8px;
  border-radius: 3px;
  color: var(--prp-text-muted);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}
.pdf-preview-metric-toggle input:checked + label {
  background: var(--prp-brand-primary);
  color: var(--prp-text-inverse);
}
.pdf-preview-metric-toggle input:disabled + label,
.pdf-preview-select:disabled {
  cursor: wait;
  opacity: 0.6;
}
.pdf-preview-option {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  cursor: pointer;
  white-space: nowrap;
}
.pdf-preview-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #1FAD5D;
  cursor: pointer;
}
.pdf-preview-option input:disabled {
  cursor: wait;
}
.pdf-preview-update-status {
  margin-left: 0;
  color: var(--prp-text-muted);
  font-size: 11px;
}
.pdf-preview-update-status:empty {
  display: none;
}
.pdf-preview-frame {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #525659;
}
@media (max-width: 768px) {
  /* PDF button stays compact on mobile — it's a secondary action, not a primary CTA.
     Show the label but keep it auto-width and visually lighter than View Sales Data. */
  .pdf-btn-label { display: inline !important; }
  .pdf-download-btn {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    gap: 6px;
    position: static;
    justify-content: center;
  }
  .pdf-download-btn svg { width: 13px; height: 13px; }
  .pdf-pro-badge {
    position: static;
    top: auto;
    right: auto;
    font-size: 8px;
    padding: 2px 5px;
    border-radius: 4px;
  }
  .pdf-download-wrapper {
    align-items: center;
  }
  .pdf-download-wrapper .valuation-coin-note {
    font-size: 10px;
    text-align: center;
  }
  .pdf-preview-overlay {
    padding: 0;
  }
  .pdf-preview-modal {
    width: 100%;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }
  .pdf-preview-header {
    min-height: 58px;
    padding: 10px 10px 10px 14px;
  }
  .pdf-preview-heading p {
    max-width: 180px;
  }
  .pdf-preview-action {
    width: 36px;
    padding: 0;
  }
  .pdf-preview-action > span:not(.pdf-pro-badge) {
    display: none;
  }
  .pdf-preview-options-bar {
    min-height: 50px;
    gap: 8px;
    padding: 8px 14px;
    overflow-x: visible;
    justify-content: flex-start;
  }
  .pdf-preview-options-title {
    display: none;
  }
  /* "Branding" (Cover/Pages 2+) stays labeled on mobile even though Unit/Report data don't —
     those two are still visually self-explanatory from their control alone (a unit dropdown,
     a Sales/Value/Both toggle), but a bare "Cover"/"Pages 2+" pair reads as unlabeled noise
     without it. */
  .pdf-preview-option-group-branding .pdf-preview-options-title {
    display: inline;
  }
  .pdf-preview-option-groups {
    width: 100%;
    margin-left: 0;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 10px;
  }
  .pdf-preview-update-status {
    margin-left: 0;
  }
  .pdf-preview-mobile-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .pdf-preview-mobile-open-btn {
    justify-content: center;
  }
}
