/* EcoSignal GBP Instant Score — [ecosignal_gbp_score]
   Own prefix (esgbp-) so seo-audit.css changes can never regress this widget
   and vice versa. Brand color arrives via --esgbp-brand custom property. */

.esgbp-wrap {
  --esgbp-brand: #0f9e6e; /* fallback only — PHP injects the per-site brand */
  max-width: 560px;
  margin: 0 auto;
  padding: 28px;
  border-radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  box-sizing: border-box;
}
.esgbp-wrap *, .esgbp-wrap *::before, .esgbp-wrap *::after { box-sizing: inherit; }

.esgbp-dark  { background: #0b1220; color: #e2e8f0; border: 1px solid rgba(255,255,255,0.08); }
.esgbp-light { background: #ffffff; color: #0f172a; border: 1px solid #e2e8f0; }

/* Doubled-up selectors on the tag-styled elements (h2/p/label): host themes
   style bare tags inside their content wrappers (e.g. .ey-content p) at
   specificity 0,1,1 — these must win at 0,2,0+ or the widget renders in the
   host's palette (dark-slate subtitle on our navy background). */
.esgbp-wrap .esgbp-title { font-size: 22px; font-weight: 800; margin: 0 0 6px; line-height: 1.25; }
.esgbp-wrap .esgbp-subtitle { font-size: 14px; line-height: 1.5; opacity: 0.75; margin: 0 0 18px; }
.esgbp-wrap.esgbp-dark .esgbp-title, .esgbp-wrap.esgbp-dark .esgbp-subtitle,
.esgbp-wrap.esgbp-dark .esgbp-consent { color: #e2e8f0; }
.esgbp-wrap.esgbp-light .esgbp-title, .esgbp-wrap.esgbp-light .esgbp-subtitle,
.esgbp-wrap.esgbp-light .esgbp-consent { color: #0f172a; }

.esgbp-alert {
  background: rgba(220, 38, 38, 0.12);
  color: #f87171;
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}
.esgbp-light .esgbp-alert { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }

.esgbp-row { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.esgbp-row .esgbp-input { flex: 1 1 180px; }

.esgbp-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  outline: none;
}
.esgbp-light .esgbp-input { background: #f8fafc; }
.esgbp-input:focus { border-color: var(--esgbp-brand); }

.esgbp-btn {
  display: inline-block;
  width: 100%;
  padding: 13px 22px;
  border: 0;
  border-radius: 10px;
  background: var(--esgbp-brand);
  /* Derived, never hardcoded: a light brand needs a dark label (white on gold
     is 2.28:1). Falls back to white if the var is missing (cached markup). */
  color: var(--esgbp-btn-text, #ffffff);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.esgbp-btn:hover { opacity: 0.9; }
.esgbp-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.esgbp-link-btn {
  display: block;
  margin: 10px auto 0;
  background: none;
  border: 0;
  color: inherit;
  opacity: 0.6;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
}

.esgbp-candidates { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.esgbp-cand-hint { font-size: 13px; opacity: 0.7; margin-bottom: 2px; }
.esgbp-candidate {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s;
}
.esgbp-light .esgbp-candidate { background: #f8fafc; }
.esgbp-candidate:hover { border-color: var(--esgbp-brand); }
.esgbp-cand-name { font-size: 14px; font-weight: 700; }
.esgbp-cand-addr { font-size: 12px; opacity: 0.65; }
.esgbp-cand-rating { font-size: 12px; color: #f59e0b; font-weight: 600; }

.esgbp-picked {
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px dashed rgba(148, 163, 184, 0.4);
  margin-bottom: 14px;
}
.esgbp-picked-addr { opacity: 0.65; font-size: 12px; }
.esgbp-picked-label { opacity: 0.65; }

.esgbp-consent { display: flex; align-items: center; gap: 8px; font-size: 12.5px; opacity: 0.8; margin: 2px 0 14px; cursor: pointer; }

.esgbp-spinner {
  width: 38px; height: 38px;
  margin: 8px auto 14px;
  border: 3px solid rgba(148, 163, 184, 0.25);
  border-top-color: var(--esgbp-brand);
  border-radius: 50%;
  animation: esgbp-spin 0.8s linear infinite;
}
@keyframes esgbp-spin { to { transform: rotate(360deg); } }

#esgbp-loading { text-align: center; padding: 18px 0 8px; }
.esgbp-loading-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.esgbp-loading-msg { font-size: 13px; opacity: 0.65; margin-bottom: 14px; }
.esgbp-progress { height: 8px; border-radius: 6px; background: rgba(148, 163, 184, 0.2); overflow: hidden; }
.esgbp-progress-bar { height: 8px; width: 5%; border-radius: 6px; background: var(--esgbp-brand); transition: width 0.6s ease; }

#esgbp-results { text-align: center; padding-top: 8px; }
.esgbp-score-ring {
  width: 108px; height: 108px;
  margin: 4px auto 8px;
  border: 6px solid;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 800;
}
.esgbp-score-caption { font-size: 13px; opacity: 0.7; margin-bottom: 16px; }

.esgbp-subs { text-align: left; margin: 0 0 16px; }
.esgbp-sub { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.esgbp-sub-label { flex: 0 0 105px; font-size: 13px; }
.esgbp-sub-track { flex: 1; height: 9px; border-radius: 6px; background: rgba(148, 163, 184, 0.2); overflow: hidden; }
.esgbp-sub-fill { display: block; height: 9px; border-radius: 6px; }
.esgbp-sub-num { flex: 0 0 30px; text-align: right; font-size: 13px; font-weight: 700; }

.esgbp-recs-title { text-align: left; font-size: 14px; font-weight: 800; margin: 0 0 8px; }
.esgbp-rec {
  text-align: left;
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  margin-bottom: 8px;
  font-size: 13px;
}
.esgbp-rec span { opacity: 0.75; font-size: 12.5px; }

.esgbp-btn-secondary {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid var(--esgbp-brand);
  background: transparent;
  /* Brand AS text needs the darkened step on a light card. */
  color: var(--esgbp-brand-text, var(--esgbp-brand));
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
  transition: opacity 0.15s;
}
.esgbp-btn-secondary:hover { opacity: 0.8; }

.esgbp-emailed {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  /* Brand tint, not EcoSignal green — this is a delivery confirmation inside a
     branded widget, so it follows the brand. Fallbacks keep cached markup sane. */
  background: var(--esgbp-brand-soft, rgba(15, 158, 110, 0.12));
  border: 1px solid var(--esgbp-brand-soft-line, rgba(15, 158, 110, 0.3));
  font-size: 13px;
}

@media (max-width: 480px) {
  .esgbp-wrap { padding: 20px 16px; }
  .esgbp-row { flex-direction: column; }
}
