/* ============================================================
   gauge.css — Speed Test HUD, Diagnostics & Competitor Feature Styles
   ============================================================ */

/* ── Speed Test HUD Container ───────────────────────────── */
.speed-test-hud {
  background: var(--bg-surface, #0f172a);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: var(--radius-lg, 20px);
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 760px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  contain: layout paint;
}

.speed-test-hud::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, color-mix(in srgb, var(--primary-color, #e10a0a) 12%, transparent), transparent);
  pointer-events: none;
}

/* ── ISP Detection Badge (Pillar 10) ────────────────────── */
.isp-badge {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--bg-card, rgba(255,255,255,0.05));
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 99px;
  padding: 0.45rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text-secondary, #94a3b8);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

/* ── Gauge & Waveform Canvases ─────────────────────────── */
#speed-gauge {
  display: block;
  margin: 0 auto 0.5rem;
  max-width: 400px;
  width: 100%;
  contain: layout paint;
}

#speed-graph {
  display: block;
  width: 100%;
  height: 90px;
  border-radius: var(--radius-sm, 6px);
  background: rgba(255,255,255,0.02);
  margin-bottom: 1.5rem;
  contain: layout paint;
}

/* ── Test Phase Label ────────────────────────────────────── */
.test-phase-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted, #64748b);
  margin-bottom: 0.5rem;
  min-height: 1.5em;
  transition: color 0.3s ease;
}

.test-status--ping        #test-phase { color: var(--info, #38bdf8); }
.test-status--download    #test-phase { color: var(--success, #22c55e); }
.test-status--upload      #test-phase { color: var(--warning, #f59e0b); }
.test-status--bufferbloat #test-phase { color: #a855f7; }
.test-status--done        #test-phase { color: var(--success, #22c55e); }
.test-status--error       #test-phase { color: var(--danger, #ef4444); }

/* ── Start Button ────────────────────────────────────────── */
#btn-start-test {
  background: linear-gradient(135deg, var(--primary-color, #e10a0a), var(--accent-color, #f59e0b));
  color: #fff;
  border: none;
  border-radius: 99px;
  padding: 1rem 3rem;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-sans, Inter, sans-serif);
  letter-spacing: 0.02em;
  box-shadow: 0 8px 32px color-mix(in srgb, var(--primary-color, #e10a0a) 35%, transparent);
  transition: all 0.25s ease;
  margin-bottom: 2rem;
}

#btn-start-test:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 40px color-mix(in srgb, var(--primary-color, #e10a0a) 45%, transparent);
}

#btn-start-test:disabled {
  opacity: 0.75;
  cursor: not-allowed;
  transform: none;
}

/* ── Results Grid ────────────────────────────────────────── */
.results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
  contain: layout paint;
}

@media (max-width: 540px) { .results-grid { grid-template-columns: 1fr; } }

.result-card {
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: var(--radius, 12px);
  padding: 1.25rem;
  text-align: left;
  transition: border-color 0.2s;
  contain: layout paint;
}

.result-card:hover { border-color: var(--primary-color, #e10a0a); }

.result-card-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted, #64748b);
  margin-bottom: 0.35rem;
}

.result-card-value {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text-primary, #f8fafc);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.result-card-unit {
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
  margin-top: 0.2rem;
}

.result-card--download .result-card-value { color: #38bdf8; }
.result-card--upload   .result-card-value { color: #10b981; }
.result-card--ping     .result-card-value { color: #f59e0b; }
.result-card--jitter   .result-card-value { color: var(--accent-color, #f59e0b); }

/* ── Bufferbloat Badge Pill (Pillar 1) ───────────────────── */
.bb-grade-pill {
  display: inline-block;
  padding: 0.4rem 1.2rem;
  border-radius: 99px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

/* ── Scorecard Action Bar (Pillar 2 & 3) ─────────────────── */
.scorecard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border, rgba(255,255,255,0.08));
}

.btn-scorecard {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  color: var(--text-primary, #f8fafc);
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm, 6px);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans, Inter, sans-serif);
}

.btn-scorecard:hover {
  background: var(--bg-card-hover, #334155);
  border-color: var(--primary-color, #e10a0a);
  transform: translateY(-1px);
}

.btn-scorecard-primary {
  background: var(--primary-color, #e10a0a);
  border-color: var(--primary-color, #e10a0a);
  color: #fff;
}

.btn-scorecard-primary:hover {
  background: var(--primary-dark, #e10a0a);
}

/* ── Activity Viability Grid (Pillar 4) ──────────────────── */
.viability-section { margin: 3rem 0; }
.viability-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.viability-card {
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: var(--radius, 12px);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.2s;
}

.viability-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.viability-card-icon { font-size: 1.5rem; }
.viability-card h4 { font-size: 0.95rem; margin: 0; color: var(--text-primary, #f8fafc); }
.viability-card p { font-size: 0.85rem; color: var(--text-secondary, #94a3b8); margin: 0; }

.viability-card--pass { border-left: 4px solid var(--success, #22c55e); }
.viability-card--warn { border-left: 4px solid var(--warning, #f59e0b); }

/* ── Plan Compliance Checker (Pillar 6) ─────────────────── */
.plan-compliance-section { margin: 3rem 0; }
.plan-compliance-card {
  background: var(--bg-surface, #0f172a);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: var(--radius, 12px);
  padding: 1.5rem;
}

.plan-inputs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
}

.plan-select, .plan-custom-input {
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  color: var(--text-primary, #f8fafc);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm, 6px);
  font-size: 0.95rem;
  font-family: var(--font-sans, Inter, sans-serif);
}

.compliance-box {
  margin-top: 1.25rem;
  padding: 1.25rem;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border);
}

.compliance-box.badge-success { background: rgba(34,197,94,0.08); border-color: rgba(34,197,94,0.3); }
.compliance-box.badge-warning { background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.3); }
.compliance-box.badge-danger  { background: rgba(239,68,68,0.08);  border-color: rgba(239,68,68,0.3); }

.compliance-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ── Device Test History Table (Pillar 5) ────────────────── */
.history-section { margin: 3rem 0; }
.history-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ── Embed Modal Popup (Pillar 3) ────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-content {
  background: var(--bg-surface, #0f172a);
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: var(--radius-lg, 20px);
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted, #64748b);
  font-size: 1.5rem;
  cursor: pointer;
}

.embed-textarea {
  width: 100%;
  height: 110px;
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: var(--radius-sm, 6px);
  color: var(--text-primary, #f8fafc);
  font-family: var(--font-mono, monospace);
  font-size: 0.85rem;
  padding: 0.75rem;
  margin: 1rem 0;
  resize: none;
}

/* ── Module 1: AI Overview (SGE) Direct Answer Callout Box ── */
.aio-snippet-box {
  border-left: 4px solid var(--primary-color, #e10a0a);
  background: var(--bg-card, #1e293b);
  padding: 18px 22px;
  border-radius: 8px;
  margin: 20px 0 30px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.aio-snippet-badge {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary-color, #e10a0a);
  margin-bottom: 6px;
}

.aio-snippet-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary, #f8fafc);
}

/* ── Module 4: Multi-Cloud & Gaming Ping Matrix ──────────── */
.multicloud-section { margin: 3rem 0; }
.multicloud-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.multicloud-card {
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: var(--radius, 12px);
  padding: 1.25rem;
}

.multicloud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.multicloud-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary, #f8fafc);
  margin: 0;
}

.multicloud-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 99px;
  overflow: hidden;
  margin: 0.75rem 0 0.5rem;
}

.multicloud-bar {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  transition: width 0.6s ease, background-color 0.3s ease;
}

.multicloud-bar--optimal  { background: #22c55e; }
.multicloud-bar--good     { background: #f59e0b; }
.multicloud-bar--elevated { background: #ef4444; }

/* ── Module 5: Wi-Fi vs Ethernet Comparison Mode ─────────── */
.compare-section { margin: 3rem 0; }
.compare-card {
  background: var(--bg-surface, #0f172a);
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: var(--radius, 12px);
  padding: 1.75rem;
}

.compare-banner {
  background: rgba(56,189,248,0.1);
  border: 1px solid rgba(56,189,248,0.3);
  color: var(--text-primary, #f8fafc);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* ── Module 2: "Why Is My Internet Slow?" Wizard ─────────── */
.diagnostic-wizard-section { margin: 3.5rem 0; }
.wizard-card {
  background: var(--bg-surface, #0f172a);
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: var(--radius-lg, 16px);
  padding: 2rem;
}

.wizard-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.wizard-step h4 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #94a3b8);
  margin: 0 0 0.75rem;
}

.wizard-btn-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.wizard-btn {
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  color: var(--text-secondary, #94a3b8);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.wizard-btn:hover {
  background: var(--bg-card-hover, #334155);
  color: var(--text-primary, #f8fafc);
}

.wizard-btn.active {
  background: var(--primary-color, #e10a0a);
  border-color: var(--primary-color, #e10a0a);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color, #e10a0a) 30%, transparent);
}

.wizard-verdict-box {
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-strong, rgba(255,255,255,0.15));
  border-radius: 12px;
  padding: 1.5rem;
}

.wizard-verdict-header {
  margin-bottom: 1rem;
}

.wizard-verdict-badge {
  display: inline-block;
  background: rgba(34,197,94,0.15);
  color: #22c55e;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 99px;
  margin-bottom: 0.4rem;
}

.wizard-verdict-header h4 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--text-primary, #f8fafc);
}

.wizard-action-card {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
  border-left: 3px solid #38bdf8;
}

.wizard-action-card ol {
  margin: 0.5rem 0 0 1.25rem;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ── Module 3: Clean 1-Page Print Certificate (@media print) ── */
@media print {
  body * {
    visibility: hidden;
  }
  #printable-certificate-view, #printable-certificate-view * {
    visibility: visible;
  }
  #printable-certificate-view {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 20px;
    background: #fff !important;
    color: #000 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
  }
  .cert-print-document {
    border: 3px double #0f172a;
    padding: 30px;
    border-radius: 8px;
    background: #ffffff;
  }
  .cert-header {
    text-align: center;
    border-bottom: 2px solid #0f172a;
    padding-bottom: 20px;
    margin-bottom: 20px;
    position: relative;
  }
  .cert-watermark {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 6px;
  }
  .cert-badge-gold {
    display: inline-block;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #0f172a;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 4px 14px;
    border-radius: 99px;
    margin-bottom: 12px;
  }
  .cert-header h2 {
    margin: 0 0 8px;
    font-size: 20px;
    color: #0f172a;
    text-transform: uppercase;
  }
  .cert-id-tag {
    margin: 0;
    font-size: 12px;
    color: #475569;
  }
  .cert-id-tag code {
    font-weight: 700;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
  }
  .cert-grid-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    background: #f8fafc;
    padding: 14px 18px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 12px;
    color: #334155;
  }
  .cert-table-metrics {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 13px;
  }
  .cert-table-metrics th, .cert-table-metrics td {
    border: 1px solid #cbd5e1;
    padding: 10px 14px;
    text-align: left;
  }
  .cert-table-metrics th {
    background: #f1f5f9;
    font-weight: 700;
    color: #0f172a;
  }
  .cert-footer {
    border-top: 2px solid #0f172a;
    padding-top: 15px;
    font-size: 11px;
    line-height: 1.5;
    color: #475569;
  }
  .cert-signature-row {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px dashed #cbd5e1;
    font-size: 12px;
    color: #0f172a;
  }
}

/* ── Mobile Touch Target Spacing & Usability (Google Mobile Friendly) ── */
.btn-start, .btn-cta, .wizard-btn, .mode-toggle-btn {
  min-height: 48px;
  padding: 12px 20px;
  touch-action: manipulation;
}
@media (max-width: 640px) {
  .diagnostic-grid, .scorecard-grid {
    gap: 14px;
  }
}
