/* =========================================================
   Conversion Diagnostic — page-specific styles (conversion-diagnostic.html)
   Rebranded from the original standalone "Paid Search Funnel
   Diagnostic" app onto alexd.com's design tokens (tokens.css)
   and shared component conventions (style.css / win-pace.css).
   All original .pd-* class names are kept verbatim since
   js/conversion-diagnostic-app.js targets them directly by
   id/class — only color, type, radius, and a few structural
   rules change here.

   Color mapping (brand-color rule: full-opacity red/blue/yellow
   or greys/white/black only, never tinted):
     good     -> var(--blue) text/dot
     warning  -> var(--yellow) dot, but TEXT stays ink (yellow text on
                 white fails contrast)
     critical -> var(--red) text/dot
   Status labels (top diagnosis badge, data-quality chip, per-card
   quality tag) are styled like the site's .eyebrow component — plain
   colored uppercase text with a small dot, no pill/fill — since
   they're labels, not buttons, and shouldn't compete visually with
   the real CTA buttons.
   --pd-brand (blue) drives the app's "inner workings" — progress
   stepper, selected window button, auto-suggested tag, focus rings.
   Only the primary/secondary CTA buttons are deliberately monochrome
   (solid black / unfilled black outline) so they read as actions,
   distinct from the brand-colored data and status elements around them.
   The three funnel-layer categories use all three real brand colors as
   a legend, each fully distinct: Search Demand -> yellow, Google Ads
   -> red, Landing Page -> blue.
   ========================================================= */

.pd-app {
  --pd-ink: var(--ink);
  --pd-ink-soft: #3D3D3D;
  --pd-ink-faint: var(--gray);
  --pd-line: rgba(0, 0, 0, 0.1);
  --pd-bg: var(--light-bg);
  --pd-card: var(--white);
  --pd-brand: var(--blue);
  --pd-brand-soft: rgba(2, 8, 251, 0.07);
  --pd-good: var(--blue);
  --pd-warn: var(--ink);
  --pd-bad: var(--red);
  --pd-bad-tint: rgba(242, 41, 43, 0.08);
  --pd-neutral-bg: var(--light-bg);
  --pd-radius: var(--radius-sm);
  --pd-demand: var(--yellow);
  --pd-ads: var(--red);
  --pd-lp: var(--blue);

  font-family: var(--font-body);
  color: var(--pd-ink);
  background: transparent;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.pd-app * { box-sizing: border-box; }

.pd-app h1, .pd-app h2, .pd-app h3 { margin: 0; font-family: var(--font-heading); font-weight: 900; letter-spacing: -0.01em; }

/* ---------- Shell / layout ---------- */
.pd-shell {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem 6rem;
}

/* ---------- Progress stepper ---------- */
.pd-progress {
  background: var(--pd-card);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--pd-radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  overflow-x: auto;
}
.pd-progress ol { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; min-width: 460px; }
.pd-progress li {
  flex: 1;
  text-align: center;
  font-size: 0.72rem;
  color: var(--pd-ink-faint);
  padding-top: 30px;
  position: relative;
  white-space: nowrap;
  font-family: var(--font-body);
}
.pd-progress-num {
  position: absolute;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--pd-neutral-bg);
  color: var(--pd-ink-faint);
  font-size: 0.72rem;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-family: var(--font-numeral);
}
.pd-progress li.is-active .pd-progress-num { background: var(--pd-brand); color: var(--white); }
.pd-progress li.is-active { color: var(--pd-brand); font-weight: 600; }
.pd-progress li.is-done .pd-progress-num { background: var(--pd-good); color: var(--white); }
.pd-progress li.is-done { color: var(--pd-good); }

/* ---------- Toolbar ---------- */
.pd-toolbar { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 16px; }

/* ---------- Buttons ---------- */
.pd-btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
/* Primary/secondary CTA buttons are deliberately monochrome (not tied
   to --pd-brand) so they read as actions, distinct from the
   brand-colored data/status elements elsewhere on this page. */
.pd-btn-primary { background: var(--black); color: var(--white); }
.pd-btn-primary:hover { opacity: 0.85; }
.pd-btn-primary:disabled { background: rgba(10, 10, 10, 0.3); cursor: not-allowed; }
.pd-btn-secondary { background: transparent; color: var(--pd-ink); border: 1.5px solid var(--pd-ink); }
.pd-btn-secondary:hover { background: rgba(0, 0, 0, 0.05); }
.pd-btn-ghost { background: transparent; color: var(--pd-ink-soft); border-color: rgba(0, 0, 0, 0.2); }
.pd-btn-ghost:hover { background: rgba(0, 0, 0, 0.05); color: var(--pd-ink); }

/* ---------- Card / step container ---------- */
.pd-step {
  background: var(--pd-card);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--pd-radius);
  padding: 24px 20px 20px;
  box-shadow: var(--shadow-card);
}
.pd-step-title { font-size: 1.2rem; margin-bottom: 6px; }
.pd-step-desc { color: var(--pd-ink-soft); font-size: 0.92rem; margin: 0 0 18px; max-width: 640px; font-family: var(--font-body); }

/* ---------- Fields ---------- */
.pd-field { margin-bottom: 22px; }
.pd-field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; font-family: var(--font-body); }
.pd-field input[type="text"],
.pd-field input[type="date"] {
  font-family: var(--font-numeral);
  font-size: 0.95rem;
  padding: 10px 12px;
  border: 1.5px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-sm);
  width: 100%;
  max-width: 260px;
  background: var(--white);
}
.pd-field input:focus { outline: none; border-color: var(--pd-brand); }
.pd-help { color: var(--pd-ink-soft); font-size: 0.85rem; margin: 8px 0 0; font-family: var(--font-body); }
.pd-field-inline { margin: 8px 0 16px; }
.pd-checkbox { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 0.9rem; cursor: pointer; font-family: var(--font-body); }

/* ---------- Window selector ---------- */
.pd-window-options { display: flex; flex-wrap: wrap; gap: 8px; }
.pd-window-btn {
  font-family: var(--font-body); font-weight: 600; font-size: 0.9rem;
  padding: 10px 20px; border-radius: var(--radius-pill);
  border: 1.5px solid rgba(0, 0, 0, 0.12); background: var(--white); cursor: pointer;
}
.pd-window-btn.is-selected { border-color: var(--pd-brand); background: var(--pd-brand-soft); color: var(--pd-brand); }
.pd-window-btn.is-recommended::after { content: " (recommended)"; font-weight: 400; font-size: 0.78rem; }

/* ---------- Periods ---------- */
.pd-periods { margin-top: 20px; padding-top: 18px; border-top: 1px dashed rgba(0, 0, 0, 0.12); }
.pd-period-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.pd-period-label { min-width: 190px; font-weight: 600; font-size: 0.88rem; font-family: var(--font-body); }
.pd-tag { display: inline-block; font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--pd-brand); background: var(--pd-brand-soft); border-radius: 5px; padding: 2px 6px; margin-left: 6px; }
.pd-to { color: var(--pd-ink-faint); font-size: 0.85rem; }
.pd-warning { color: var(--pd-ink); background: var(--white); border: 1px solid rgba(0, 0, 0, 0.08); border-left: 4px solid var(--yellow); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.85rem; margin-top: 8px; font-family: var(--font-body); }

/* ---------- Metric input tables ---------- */
.pd-metric-table { margin-bottom: 18px; }
.pd-metric-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.pd-metric-row.pd-metric-head {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--pd-ink-faint);
  font-weight: 700;
  border-bottom: 2px solid rgba(0, 0, 0, 0.08);
  font-family: var(--font-body);
}
.pd-metric-name { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.9rem; font-family: var(--font-body); }
.pd-metric-name .pd-req { color: var(--pd-bad); font-weight: 700; }
.pd-tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--pd-neutral-bg); color: var(--pd-ink-soft);
  font-size: 0.68rem; font-style: normal; cursor: help; flex: none;
}
.pd-metric-row input {
  font-family: var(--font-numeral); font-size: 0.9rem;
  padding: 8px 10px; border: 1.5px solid rgba(0, 0, 0, 0.12); border-radius: 7px;
  width: 100%; background: var(--white);
}
.pd-metric-row input.is-invalid { border-color: var(--pd-bad); background: var(--pd-bad-tint); }
.pd-metric-row input:focus { outline: none; border-color: var(--pd-brand); }

.pd-calculated-table { background: var(--pd-neutral-bg); border-radius: var(--radius-sm); padding: 4px 12px; margin-bottom: 20px; }
.pd-calculated-table .pd-metric-row { border-bottom: 1px solid rgba(0, 0, 0, 0.06); }
.pd-calculated-table .pd-metric-row:last-child { border-bottom: none; }
.pd-calculated-table .pd-col { display: flex; align-items: baseline; gap: 6px; }
.pd-calculated-table .pd-col-label {
  color: var(--pd-ink-faint);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-family: var(--font-body);
  white-space: nowrap;
}
.pd-calc-val { font-family: var(--font-numeral); font-size: 0.9rem; font-weight: 700; color: var(--pd-ink); font-variant-numeric: tabular-nums; }

@media (max-width: 620px) {
  .pd-metric-row { grid-template-columns: 1fr; gap: 4px; }
  .pd-metric-row.pd-metric-head { display: none; }
  .pd-metric-row { padding: 12px 0; }
  .pd-metric-row .pd-metric-name { margin-bottom: 4px; }
  .pd-metric-row::before { content: none; }
  .pd-metric-row .pd-col { display: flex; align-items: center; gap: 8px; }
  .pd-metric-row .pd-col .pd-col-label { width: 92px; flex: none; font-size: 0.75rem; color: var(--pd-ink-faint); text-transform: uppercase; }
}

/* ---------- Nav row ---------- */
.pd-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; }
.pd-validation-msg { color: var(--pd-bad); font-size: 0.85rem; margin-top: 10px; text-align: right; font-family: var(--font-body); }

/* ==========================================================================
   RESULTS
   ========================================================================== */
.pd-results-header { margin-bottom: 20px; }
/* Styled like the site's .eyebrow component (plain colored uppercase
   text + a small dot), not a filled pill — this is a label, not a button. */
.pd-diag-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.pd-diag-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.pd-diag-badge.badge-bad { color: var(--pd-bad); }
.pd-diag-badge.badge-warn { color: var(--pd-warn); }
.pd-diag-badge.badge-warn::before { background: var(--yellow); }
.pd-diag-badge.badge-good { color: var(--pd-good); }
.pd-diag-badge.badge-neutral { color: var(--pd-ink-soft); }

.pd-diag-title { font-size: 1.3rem; margin-bottom: 8px; }
.pd-diag-summary { color: var(--pd-ink-soft); font-size: 0.95rem; max-width: 720px; font-family: var(--font-body); }
.pd-diag-summary strong { color: var(--pd-ink); }

.pd-meta-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 4px; font-size: 0.82rem; color: var(--pd-ink-soft); font-family: var(--font-body); }
/* Plain colored label, not a filled pill — matches the site's
   understated .eyebrow-style treatment for non-interactive tags. */
.pd-quality-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em;
}
.pd-quality-chip::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.pd-quality-chip.q-strong { color: var(--pd-good); }
.pd-quality-chip.q-moderate { color: var(--pd-warn); }
.pd-quality-chip.q-moderate::before { background: var(--yellow); }
.pd-quality-chip.q-limited { color: var(--pd-bad); }

.pd-section-title { font-size: 1.02rem; margin: 28px 0 12px; padding-top: 18px; border-top: 1px solid rgba(0, 0, 0, 0.1); }

/* Chart */
.pd-chart-wrap { background: var(--pd-card); border: 1px solid rgba(0, 0, 0, 0.08); border-radius: var(--pd-radius); padding: 16px; max-width: 640px; margin: 0 auto; }
.pd-chart-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 8px; font-size: 0.82rem; font-family: var(--font-body); }
.pd-legend-item { display: flex; align-items: center; gap: 6px; }
.pd-legend-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* Index table */
.pd-index-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 0.88rem; font-family: var(--font-numeral); }
.pd-index-table th, .pd-index-table td { text-align: right; padding: 8px 10px; border-bottom: 1px solid rgba(0, 0, 0, 0.08); }
.pd-index-table th:first-child, .pd-index-table td:first-child { text-align: left; font-family: var(--font-body); }
.pd-index-table thead th { color: var(--pd-ink-faint); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; font-family: var(--font-body); }

/* Diagnostic cards */
.pd-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 10px; }
@media (max-width: 760px) { .pd-cards { grid-template-columns: 1fr; } }

.pd-card {
  background: var(--pd-card); border: 1px solid rgba(0, 0, 0, 0.08); border-radius: var(--pd-radius);
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.pd-card-head { display: flex; justify-content: space-between; align-items: flex-start; }
.pd-card-title { font-size: 0.95rem; font-weight: 700; display: flex; align-items: center; gap: 8px; font-family: var(--font-body); }
.pd-card-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.pd-card-index { font-family: var(--font-numeral); font-size: 1.4rem; font-weight: 700; }
.pd-card-deltas { display: flex; gap: 14px; font-size: 0.82rem; }
.pd-delta { display: flex; flex-direction: column; }
.pd-delta-label { color: var(--pd-ink-faint); font-size: 0.7rem; text-transform: uppercase; font-family: var(--font-body); }
.pd-delta-val { font-family: var(--font-numeral); }
.pd-delta-val.up { color: var(--pd-good); }
.pd-delta-val.down { color: var(--pd-bad); }
.pd-delta-val.flat { color: var(--pd-ink-soft); }

.pd-card-metrics { font-size: 0.82rem; border-top: 1px solid rgba(0, 0, 0, 0.08); padding-top: 8px; font-family: var(--font-body); }
.pd-card-metrics .pd-cm-row { display: flex; justify-content: space-between; padding: 3px 0; color: var(--pd-ink-soft); }
.pd-card-metrics .pd-cm-row span:last-child { color: var(--pd-ink); font-family: var(--font-numeral); font-variant-numeric: tabular-nums; }

.pd-card-interp { font-size: 0.85rem; color: var(--pd-ink-soft); border-top: 1px solid rgba(0, 0, 0, 0.08); padding-top: 8px; font-family: var(--font-body); }
.pd-card-tag { display: inline-block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 4px; }
.pd-card-tag.q-limited { color: var(--pd-bad); }
.pd-card-tag.q-moderate { color: var(--pd-warn); }

/* Export toolbar */
.pd-export-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; }
.pd-copy-feedback { font-size: 0.85rem; color: var(--pd-good); margin-left: 6px; font-family: var(--font-body); }

/* Disclaimer note (was a <footer> in the standalone app; the real
   site footer follows below it, so this is a plain note now). */
.pd-footnote { text-align: center; color: var(--pd-ink-faint); font-size: 0.78rem; padding: 20px 16px 0; font-family: var(--font-body); }

/* ---------- Print ---------- */
@media print {
  .nav, .footer, .calc-hero, .pd-toolbar, .pd-progress, .pd-nav, .pd-export-row, .pd-footnote { display: none !important; }
  .pd-shell { margin-top: 0; padding-top: 0; }
  .pd-step { border: none; box-shadow: none; padding: 0; }
  body { background: var(--white); }
}
