
/* WP Speed Analyzer - Frontend UI */

.pg-wrap{
  --pg-bg: var(--bde-palette-dark-blue-6f19d90f-3b78-4baf-834c-8967d49071ef-gradient-7, linear-gradient(135deg, #0b0f2b 0%, #141a3a 45%, #0b0f2b 100%));
  --pg-card: rgba(255,255,255,.06);
  --pg-card2: rgba(255,255,255,.08);
  --pg-border: rgba(255,255,255,.10);
  --pg-text: rgba(255,255,255,.92);
  --pg-muted: rgba(255,255,255,.68);
  --pg-yellow: #ffb300;
  --pg-yellow2: #ffcf4d;
  --pg-green: #0CCE6B;
  --pg-orange: #FFA400;
  --pg-red: #FF4E42;

  /* Buttons and tabs. Overridable per install from Branding, so the public
     speed test can wear the agency's colours instead of PulseGuard's. */
  --pg-btn-from: rgba(12,41,137,1);
  --pg-btn-to: rgba(66,151,221,.85);
  --pg-btn-border: rgba(66,151,221,.85);

  background: var(--pg-bg);
  color: var(--pg-text);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}

.pg-form{
  display:flex;
  gap: 6px;
  align-items:center;
  justify-content:center;
  margin-bottom: 10px;
}

.pg-form input{
  /* Slightly shorter field + keeps button close to the input */
  width: min(460px, 100%);
  padding: 12px 14px;
  border-radius: 12px;
  /* More defined (white/grey) border like your Breakdance input styling */
  border: 1px solid rgba(255,255,255,.38);
  background: rgba(0,0,0,.18);
  color: #fff;
  outline: none;
}

.pg-form input::placeholder{ color: rgba(255,255,255,.55); }

.pg-form button{
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid var(--pg-btn-border);
  background: linear-gradient(97deg, var(--pg-btn-from) 2.5%, var(--pg-btn-to) 96.4%);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s ease, box-shadow .15s ease;
}

.pg-form button:hover{
  filter: brightness(1.08);
  box-shadow: 0 8px 22px rgba(0,0,0,.28);
}

.pg-meta{
  display:flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items:center;
  justify-content:center;
  margin: 12px 0 16px;
}

.pg-meta-item{
  display:flex;
  gap: 8px;
  align-items:center;
  background: var(--pg-card);
  border: 1px solid var(--pg-border);
  padding: 8px 12px;
  border-radius: 999px;
}

.pg-meta-label{
  color: var(--pg-yellow2);
  font-weight: 600;
}

.pg-meta-actions{
  margin-left: auto;
}

.pg-btn-secondary{
  display:inline-block;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.18);
  color: #fff !important;
  text-decoration:none;
}

.pg-btn-secondary:hover{
  border-color: rgba(255,255,255,.22);
}

.pg-btn-secondary.is-disabled{
  opacity: .6;
  pointer-events:none;
}

.pg-tabs{
  display:flex;
  gap: 10px;
  justify-content:center;
  margin: 6px 0 18px;
}

.pg-tab{
  border: 1px solid var(--pg-border);
  background: rgba(0,0,0,.18);
  color: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  cursor:pointer;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
}

.pg-tab.is-active{
  background: linear-gradient(90deg, rgba(255,179,0,.20) 0%, rgba(44,164,255,.12) 100%);
  border-color: rgba(255,179,0,.35);
}

/* Device icons are inline SVG (not emoji, which WordPress rewrites to external
   Twemoji images that can 404). Keep them centred against the label. */
.pg-tab-ic{
  display: inline-flex;
  align-items: center;
  margin-right: 2px;
  vertical-align: middle;
}
.pg-tab-ic svg{ display: block; }

.pg-loading{
  display:flex;
  gap: 10px;
  align-items:center;
  justify-content:center;
  padding: 12px;
  margin-bottom: 8px;
  border: 1px solid var(--pg-border);
  border-radius: 14px;
  background: rgba(0,0,0,.18);
  position: relative;
}

.pg-loading-text{
  text-align: center;
  width: auto;
  font-weight: 500;
}

.pg-progress{
  position:absolute;
  left: 12px;
  right: 12px;
  bottom: 8px;
  height: 4px;
  border-radius: 999px;
  overflow:hidden;
  background: rgba(255,255,255,.10);
}

.pg-progress-bar{
  height: 100%;
  width: 40%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pg-yellow2) 0%, var(--pg-btn-to) 100%);
  animation: pgProgress 1.1s ease-in-out infinite;
}

@keyframes pgProgress {
  0% { transform: translateX(-60%); opacity: .55; }
  50% { opacity: 1; }
  100% { transform: translateX(220%); opacity: .55; }
}

.pg-spinner{
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.18);
  border-top-color: var(--pg-yellow2);
  animation: pgSpin .9s linear infinite;
}

@keyframes pgSpin{ to { transform: rotate(360deg);} }

.pg-banner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 14px;
  margin: 10px 0 18px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255,179,0,.30);
  background: linear-gradient(90deg, rgba(255,179,0,.15) 0%, rgba(44,164,255,.12) 70%);
}

.pg-banner-text{
  color: #fff;
  font-weight: 600;
}

.pg-btn{
  display:inline-block;
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(255,179,0,.95) 0%, rgba(44,164,255,.95) 100%);
  color:#111 !important;
  text-decoration:none;
  font-weight: 600;
}

.pg-grid{
  display:grid;
  grid-template-columns: 420px 1fr;
  gap: 18px;
}

.pg-left, .pg-right{
  display:flex;
  flex-direction:column;
  gap: 14px;
}

.pg-screenshot-card, .pg-score-card, .pg-section{
  background: var(--pg-card);
  border: 1px solid var(--pg-border);
  border-radius: 18px;
  padding: 14px;
}

.pg-screenshot-label{
  color: var(--pg-yellow2);
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 10px;
  letter-spacing: .02em;
}

.pg-screenshot-wrap{
  background: rgba(0,0,0,.22);
  border-radius: 14px;
  overflow:hidden;
  border: 1px solid rgba(255,255,255,.08);
}

#pgScreenshot{
  width:100%;
  height:auto;
  display:block;
}

/* Make the mobile screenshot smaller and aligned with right column (requested) */
.pg-wrap.is-mobile .pg-grid{
  grid-template-columns: 320px 1fr;
}

.pg-wrap.is-mobile .pg-screenshot-card{
  padding: 12px;
}

.pg-wrap.is-mobile .pg-screenshot-wrap{
  max-height: 420px;
}

.pg-score-title{
  font-weight: 600;
  color: var(--pg-yellow2);
  letter-spacing: .02em;
  margin-bottom: 10px;
}

.pg-score{
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 8px 0 12px;
}

.pg-score-ring{
  --p: 0;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: conic-gradient(var(--pg-yellow2) calc(var(--p) * 1%), rgba(255,255,255,.10) 0);
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow: inset 0 0 0 10px rgba(0,0,0,.25);
}

.pg-score-value{
  width: 94px;
  height: 94px;
  border-radius: 50%;
  background: rgba(0,0,0,.25);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 34px;
  font-weight: 600;
  color:#fff;
  border: 1px solid rgba(255,255,255,.10);
}

.pg-score-note{
  text-align:center;
  color: var(--pg-muted);
  font-weight: 600;
}

.pg-section-title{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap: 10px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 12px;
}

.pg-section-hint{
  color: var(--pg-yellow2);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .02em;
}

.pg-metrics{
  display:flex;
  flex-direction:column;
  gap: 10px;
}

.pg-metric{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.18);
}

.pg-metric-title{
  font-weight: 600;
  color:#fff;
}

.pg-view{
  background: none;
  border: none;
  color: var(--pg-yellow2);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor:pointer;
  padding: 0 0 0 6px;
}

.pg-metric-detail{
  margin-top: 8px;
  color: var(--pg-muted);
  font-size: 13px;
  line-height: 1.5;
  display:none;
  max-width: 52ch;
}

.pg-metric.is-open .pg-metric-detail{
  display:block;
}

.pg-pill{
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.22);
  font-weight: 600;
  color: #fff;
  min-width: 92px;
  text-align:center;
}

/* PSI-like metric colors */
.pg-pill.good{ border-color: rgba(12,206,107,.55); background: rgba(12,206,107,.14); }
.pg-pill.mid{  border-color: rgba(255,193,7,.55);  background: rgba(255,193,7,.14); }
.pg-pill.bad{  border-color: rgba(255,77,79,.55);  background: rgba(255,77,79,.14); }

.pg-heavy{
  display:flex;
  flex-direction:column;
  gap: 10px;
}

.pg-heavy-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.18);
}

/* Force white text for URLs (requested) */
.pg-heavy-row a{
  color: #fff !important;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,.35);
  word-break: break-all;
}

.pg-heavy-row a:hover{
  text-decoration-color: var(--pg-yellow2);
}

.pg-testdata{
  display:flex;
  flex-direction:column;
  gap: 10px;
}

.pg-td-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.18);
}

.pg-td-k{
  color: var(--pg-muted);
  font-weight: 600;
}

.pg-td-v{
  font-weight: 600;
  color: #fff;
}

.pg-muted{
  color: var(--pg-muted);
  font-size: 13px;
}

@media (max-width: 980px){
  .pg-grid{
    grid-template-columns: 1fr;
  }
  .pg-meta-actions{
    margin-left: 0;
  }
  .pg-wrap.is-mobile .pg-grid{
    grid-template-columns: 1fr;
  }
}



/* --- Fix: honor HTML [hidden] attribute (prevents auto "Analyzing..." bar) --- */
.pg-wrap [hidden]{
  display: none !important;
}

/* --- Buttons: calmer default (transparent) + Breakdance-like hover gradient --- */
.pg-wrap #pgAnalyzeBtn,
.pg-wrap .pg-btn,
.pg-wrap .pg-btn-secondary,
.pg-wrap a.pg-btn,
.pg-wrap a.pg-btn-secondary,
.pg-wrap button.pg-tab{
  background: rgba(0,0,0,.12) !important;
  border: 1px solid rgba(255,255,255,.22) !important;
  color: #ffffff !important;
  font-weight: 600;
}

.pg-wrap #pgAnalyzeBtn:hover,
.pg-wrap .pg-btn:hover,
.pg-wrap .pg-btn-secondary:hover,
.pg-wrap button.pg-tab:hover{
  border-color: var(--pg-btn-border) !important;
  background: linear-gradient(97deg, var(--pg-btn-from) 2.5%, var(--pg-btn-to) 96.4%) !important;
}

.pg-wrap button.pg-tab.is-active{
  border-color: var(--pg-btn-border) !important;
  box-shadow: 0 0 0 1px var(--pg-btn-to) inset, 0 12px 28px rgba(0,0,0,.25) !important;
}

/* PSI score colors */
.pg-score-ring.is-good{
  background: conic-gradient(var(--pg-green) calc(var(--p) * 1%), rgba(255,255,255,.10) 0);
}
.pg-score-ring.is-ni{
  background: conic-gradient(var(--pg-orange) calc(var(--p) * 1%), rgba(255,255,255,.10) 0);
}
.pg-score-ring.is-poor{
  background: conic-gradient(var(--pg-red) calc(var(--p) * 1%), rgba(255,255,255,.10) 0);
}

#pgResults[hidden]{display:none !important;}


/* Button typography (requested) */
.pg-wrap button,
.pg-wrap .pg-btn,
.pg-wrap .pg-btn-secondary,
.pg-wrap .pg-tab{
  font-family: Urbanist, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif !important;
  font-size: 20px !important;
  font-weight: 500 !important;
}


/* Typography tweaks (requested) */
/* (removed in v10 – inherit theme typography) */


/* v10 typography: inherit theme + calmer weights */
.pg-wrap button,
.pg-wrap .pg-btn,
.pg-wrap .pg-btn-secondary,
.pg-wrap .pg-tab,
.pg-wrap #pgAnalyzeBtn,
.pg-wrap #pgPrintBtn{
  font-family: inherit !important;
  font-weight: 500 !important;
  letter-spacing: normal;
}

.pg-wrap #pgAnalyzeBtn,
.pg-wrap #pgPrintBtn,
.pg-wrap .pg-btn,
.pg-wrap .pg-btn-secondary{
  font-size: 15px !important;
}

.pg-wrap .pg-tab{
  font-size: 14px !important;
  font-weight: 500 !important;
}

.pg-wrap .pg-view{
  font-size: 12px !important;
  font-weight: 500 !important;
}

/* Ensure popover text is always left-aligned (theme overrides) */
.pg-popover,
.pg-popover *{
  text-align: left !important;
}

/* v9 tweaks: calmer typography + left alignment + popover explain */
.pg-btn,
.pg-btn-secondary,
.pg-tab{
  font-family: Urbanist, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.pg-btn{
  font-size: 16px;
  font-weight: 600;
}

.pg-btn-secondary{
  font-size: 15px;
  font-weight: 600;
}

.pg-tab{
  font-size: 15px;
  font-weight: 600;
  padding: 9px 12px;
}

.pg-view{
  font-size: 13px;
  font-weight: 600;
  color: var(--pg-yellow2);
  cursor: pointer;
  text-decoration: none;
}

.pg-popover{
  text-align: left;
  position: fixed;
  z-index: 999999;
  max-width: 520px;
  width: min(520px, calc(100vw - 24px));
  background: rgba(15,18,35,.96);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
  padding: 14px 14px 12px;
  color: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
}

.pg-popover h4{font-size:14px !important;line-height:1.25 !important;margin:0 0 8px !important;font-weight:700 !important;letter-spacing:.02em !important;text-transform:none !important;}

.pg-popover p{
  text-align: left;
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255,255,255,.78);
}

.pg-popover-close{
  position:absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.20);
  color: #fff;
  cursor:pointer;
}

/* Slow down analyzing animations a bit */
.pg-progress-bar{ animation-duration: 1.6s !important; }
.pg-spinner{ animation-duration: 1.2s !important; }

/* v13: center the whole widget + ensure key UI parts stay centered (only popover is left aligned) */
.pg-wrap{
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
}

.pg-form{ justify-content: center !important; }
/* Keep the Analyze button close to the URL field */
.pg-form input{ margin-left: 0; margin-right: 0; }

.pg-loading{ justify-content: center !important; }
.pg-loading-text{ text-align: center !important; }

.pg-tabs{ justify-content: center !important; }

.pg-score{ justify-content: center !important; }
.pg-score-ring{ margin-left: auto; margin-right: auto; }
.pg-score-value{ margin-left: auto; margin-right: auto; }
.pg-score-note{ text-align: center !important; }

/* v13: calmer button/tabs typography (avoid theme or old rules forcing heavy fonts) */
.pg-wrap button,
.pg-wrap .pg-btn,
.pg-wrap .pg-btn-secondary,
.pg-wrap .pg-tab,
.pg-wrap #pgAnalyzeBtn,
.pg-wrap #pgPrintBtn{
  font-weight: 500 !important;
  font-size: 14px !important;
}

.pg-wrap #pgAnalyzeBtn,
.pg-wrap #pgPrintBtn{
  font-size: 14px !important;
  padding: 10px 14px !important;
}

.pg-wrap .pg-tab{
  font-size: 13px !important;
  padding: 8px 12px !important;
}


/* Core Web Vitals highlight */
.pg-cwv{display:grid;grid-template-columns:repeat(3, minmax(0,1fr));gap:12px;margin:12px 0 14px;}
.pg-cwv-card{background:rgba(0,0,0,.18);border:1px solid var(--pg-border);border-radius:16px;padding:12px;display:flex;align-items:center;justify-content:space-between;gap:10px;}
.pg-cwv-card .label{font-size:12px;color:var(--pg-muted);font-weight:600;}
.pg-cwv-card .value{font-size:16px;font-weight:700;}
.pg-cwv-card.good{border-color:rgba(12,206,107,.45);}
.pg-cwv-card.mid{border-color:rgba(255,164,0,.45);}
.pg-cwv-card.bad{border-color:rgba(255,78,66,.45);}
@media (max-width: 820px){.pg-cwv{grid-template-columns:1fr;}}

.pg-notice{margin:10px auto 0;max-width:980px;background:rgba(255,164,0,.12);border:1px solid rgba(255,164,0,.35);color:#ffd9a1;padding:10px 14px;border-radius:14px;font-size:13px;line-height:1.4;text-align:left;}


/* v16 fixes: CWV card layout + badge sizing */
.pg-cwv-card{align-items:flex-start;}
.pg-cwv-card > div{flex:1; min-width:0;}
.pg-cwv-card .label{line-height:1.2;}
.pg-cwv-card .value{margin-top:2px;}
.pg-cwv-card .pg-pill{min-width:auto; padding:5px 8px; font-size:12px; white-space:nowrap; align-self:flex-start; margin-left:auto;}
@media (max-width: 640px){
  .pg-cwv{grid-template-columns:1fr;}
}
/* v16: remove redundant hint */
.pg-section-title .pg-section-hint{display:none;}
/* v16: compact URL input + button spacing */
.pg-form{justify-content:center;}
.pg-form input[type="url"], .pg-form input[type="text"]{max-width:720px;}
.pg-form button, .pg-form .pg-btn{margin-left:10px;}
