/* =========================
   Mindset Digital · Bulk PageSpeed Checker
   ========================= */

.mdt-pagespeed-checker {
  background: var(--md-background); color: var(--md-foreground);
  min-height: 100vh; display: grid; place-items: start center; padding: 2rem;
}
@supports (height:1dvh) { .mdt-pagespeed-checker { min-height: 100dvh; } }
.mdt-pagespeed-checker .md-card { width: min(1100px, 96vw); background: var(--md-surface,#fff); }

/* Header */
.header-row { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:.75rem; }
.theme-toggle { display:inline-flex; align-items:center; gap:.5rem; padding:.35rem .65rem; border:1px solid var(--md-border,rgba(0,0,0,.12)); border-radius:999px; background:transparent; color:var(--md-foreground); cursor:pointer; line-height:1; }
.theme-toggle:hover { background:rgba(0,0,0,.04); }
[data-theme="dark"] .theme-toggle:hover { background:rgba(255,255,255,.06); }
.theme-toggle svg { width:18px; height:18px; display:block; }
#iconMoon { display:none; } [data-theme="dark"] #iconSun { display:none; } [data-theme="dark"] #iconMoon { display:block; }
@media (max-width:480px) { .theme-toggle__label { display:none; } }

/* Input */
.form-label { font-weight:600; font-size:.9rem; color:var(--md-foreground); margin-bottom:.3rem; }
.urls-textarea {
  width:100%; box-sizing:border-box;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:.85rem; line-height:1.65; resize:vertical; min-height:100px;
  padding:.75rem .85rem; border:1px solid var(--md-border);
  border-radius:var(--md-radius,8px); background:var(--md-surface); color:var(--md-foreground);
}
.urls-textarea:focus { border-color:var(--md-color-primary); }

/* Options */
.options { margin:.75rem 0 1rem; border:1px solid var(--md-border); border-radius:var(--md-radius); padding:.75rem 1rem; }
.opt-row { display:flex; gap:.75rem 1.5rem; flex-wrap:wrap; align-items:center; }
.opt-row label { display:inline-flex; align-items:center; gap:.4rem; cursor:pointer; font-size:.9rem; }
.opt-row select { font-size:.9rem; padding:.4rem .6rem; border:1px solid var(--md-border); border-radius:6px; background:var(--md-surface); color:var(--md-foreground); }

/* Actions */
.actions { display:flex; gap:.65rem; flex-wrap:wrap; margin:1rem 0; align-items:center; position:relative; }
.md-btn { background:var(--md-color-primary,#1063ff); color:var(--md-color-primary-contrast,#fff); }
.md-btn--secondary { background:var(--md-color-secondary,#f0b138); color:var(--md-color-secondary-contrast,#090a08); }

/* Help */
.icon-btn { display:inline-flex; align-items:center; justify-content:center; width:32px; height:32px; padding:0; border:1px solid var(--md-border); border-radius:50%; background:var(--md-surface); color:var(--md-foreground); cursor:pointer; }
.icon-btn svg { width:18px; height:18px; }
.help-popover { position:absolute; right:0; top:100%; margin-top:.5rem; z-index:1000; width:min(560px,86vw); background:var(--md-surface); color:var(--md-foreground); border:1px solid var(--md-border); border-radius:var(--md-radius); box-shadow:0 10px 30px rgba(0,0,0,.12); padding:.85rem 1rem; display:none; }
.help-popover.is-open { display:block; }
.help-popover ul { padding-left:1.2rem; margin:.5rem 0; }
.help-popover li { margin-bottom:.4rem; }
.help-popover code { background:rgba(0,0,0,.06); padding:.1rem .3rem; border-radius:3px; font-size:.85em; }
[data-theme="dark"] .help-popover code { background:rgba(255,255,255,.08); }

/* Progress */
.progress-section { margin:1rem 0; }
.progress-bar-track {
  width:100%; height:8px; border-radius:4px;
  background:var(--md-border); overflow:hidden;
}
.progress-bar-fill {
  height:100%; border-radius:4px; width:0%;
  background:var(--md-color-primary);
  transition:width .4s ease;
}
.progress-text {
  font-size:.85rem; color:var(--md-foreground); opacity:.7;
  margin-top:.4rem;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}

/* Results table */
.results { margin-top:1rem; }
.results-scroll { overflow-x:auto; }

.ps-table { width:100%; border-collapse:collapse; font-size:.85rem; white-space:nowrap; }
.ps-table th {
  text-align:center; padding:.6rem .5rem; font-weight:700; font-size:.78rem;
  color:var(--md-foreground); opacity:.7; border-bottom:2px solid var(--md-border);
  text-transform:uppercase; letter-spacing:.03em;
  position:sticky; top:0; background:var(--md-surface); z-index:1;
}
.ps-table th.th-url { text-align:left; min-width:200px; }
.ps-table th.th-score { min-width:55px; }
.ps-table th.th-metric { min-width:65px; }

.ps-table td { padding:.55rem .5rem; border-bottom:1px solid var(--md-border); text-align:center; vertical-align:middle; }
.ps-table tbody tr:hover { background:rgba(0,0,0,.02); }
[data-theme="dark"] .ps-table tbody tr:hover { background:rgba(255,255,255,.03); }

.td-url {
  text-align:left; max-width:280px; overflow:hidden; text-overflow:ellipsis;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:.8rem; color:var(--md-color-primary);
}
[data-theme="dark"] .td-url { color:#93c5fd; }

/* Score badges */
.score-badge {
  display:inline-flex; align-items:center; justify-content:center;
  width:42px; height:42px; border-radius:50%;
  font-weight:700; font-size:.85rem; line-height:1;
  border:3px solid; background:transparent;
}
.score-green  { color:#0cce6b; border-color:#0cce6b; }
.score-orange { color:#ffa400; border-color:#ffa400; }
.score-red    { color:#ff4e42; border-color:#ff4e42; }
.score-na     { color:var(--md-foreground); border-color:var(--md-border); opacity:.4; }

/* Metric values */
.metric-val {
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:.82rem; font-weight:600;
}
.metric-good { color:#0cce6b; }
.metric-avg  { color:#ffa400; }
.metric-poor { color:#ff4e42; }
.metric-na   { color:var(--md-foreground); opacity:.4; }

/* Row states */
.row-loading td { opacity:.5; }
.row-error .td-url { color:#dc2626; }
.row-error-msg {
  font-size:.78rem; color:#dc2626; font-style:italic;
  font-family:var(--md-font-body); white-space:normal;
}

/* Status */
.status-line { font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size:.95rem; color:var(--md-foreground); display:inline-block; padding:.3rem .5rem; border-radius:6px; background:color-mix(in srgb,var(--md-surface) 85%,transparent); min-height:1.4em; }
.status-line::after { content:"▊"; margin-left:.3rem; opacity:.7; animation:blink 1s steps(2,end) infinite; }
@keyframes blink { 0%,50%{opacity:0} 50.01%,100%{opacity:1} }

/* A11y */
.skip-link { position:absolute; left:.5rem; top:-1000px; background:var(--md-foreground); color:var(--md-background); padding:.5rem .75rem; border-radius:6px; text-decoration:none; }
.skip-link:focus { top:.5rem; z-index:10; }
textarea:focus-visible,input:focus-visible,button:focus-visible,select:focus-visible { outline:3px solid var(--md-focus,#0a57ff); outline-offset:2px; }
:root { color-scheme:light dark; }
.sr-only { position:absolute; width:1px; height:1px; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); }
