/* TV4ONE Speed Test Pro v1.0.0 - Frontend */
:root {
  --st-blue: #0066cc;
  --st-blue-dark: #0052a3;
  --st-green: #00aa44;
  --st-orange: #ff9900;
  --st-red: #e53e3e;
  --st-text: #1a202c;
  --st-muted: #718096;
  --st-border: #e2e8f0;
  --st-bg: #f7fafc;
  --st-white: #ffffff;
  --st-radius: 12px;
  --st-shadow: 0 4px 24px rgba(0,0,0,0.12);
}

/* ── Banner ─────────────────────────────────────────────────────────────── */
.tv4one-st-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, var(--st-blue) 0%, var(--st-blue-dark) 100%);
  padding: 8px 16px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  z-index: 999998;
  animation: stSlideUp 0.5s ease 0.8s both;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.tv4one-st-banner.hidden {
  opacity: 0;
  transform: translateY(100%);
  pointer-events: none;
}

@keyframes stSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  justify-content: center;
  flex-wrap: nowrap !important;
}

.banner-icon { font-size: 22px; }

.banner-text {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 1;
}

.banner-btn {
  background: #fff;
  color: var(--st-blue);
  border: none;
  padding: 8px 18px;
  border-radius: 18px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s, box-shadow 0.2s;
}

.banner-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-test-speed {
  background: #ffffff !important;
  color: #1a1a1a !important;
  border: 2px solid #1a1a1a !important;
  padding: 6px 16px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: all 0.3s ease !important;
}

.btn-test-speed:hover {
  background: #f0f0f0 !important;
  color: #000000 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

.banner-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 24px;
  cursor: pointer;
  padding: 0 0 0 12px;
  line-height: 1;
}

.banner-close:hover { color: #fff; }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.tv4one-st-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--st-white);
  border-radius: var(--st-radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px 28px 28px;
  box-shadow: var(--st-shadow);
  animation: stModalIn 0.3s ease;
}

@keyframes stModalIn {
  from { transform: scale(0.92) translateY(20px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 26px;
  color: var(--st-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
}
.modal-close:hover { background: var(--st-bg); color: var(--st-text); }

/* ── Steps Progress ─────────────────────────────────────────────────────── */
.steps-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 24px;
}

.step-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--st-border);
  transition: background 0.3s, transform 0.3s;
}

.step-dot.active {
  background: var(--st-blue);
  transform: scale(1.3);
}

.step-line {
  width: 50px;
  height: 2px;
  background: var(--st-border);
}

/* ── Phase Email ─────────────────────────────────────────────────────────── */
.phase-email h2 {
  text-align: center;
  color: var(--st-text);
  font-size: 22px;
  margin: 0 0 20px;
}

.step-label {
  text-align: center;
  color: var(--st-muted);
  font-size: 14px;
  margin-bottom: 18px;
}

/* Device Grid */
.device-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}

.device-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px;
  border: 2px solid var(--st-border);
  border-radius: 10px;
  background: var(--st-white);
  cursor: pointer;
  transition: all 0.2s;
}

.device-btn:hover, .device-btn.selected {
  border-color: var(--st-blue);
  background: #e8f0ff;
  transform: translateY(-2px);
}

.device-btn.selected { box-shadow: 0 0 0 3px rgba(0,102,204,0.2); }
.device-icon { font-size: 28px; }
.device-name { font-size: 13px; font-weight: 600; color: var(--st-text); }

/* Use Grid */
.use-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.use-btn {
  padding: 14px 10px;
  border: 2px solid var(--st-border);
  border-radius: 10px;
  background: var(--st-white);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.use-btn:hover, .use-btn.selected {
  border-color: var(--st-blue);
  background: #e8f0ff;
}

/* Email Input */
.email-input-wrap { margin-bottom: 14px; }

#tv4one-st-email {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border: 2px solid var(--st-border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

#tv4one-st-email:focus { border-color: var(--st-blue); }
#tv4one-st-email.shake { animation: stShake 0.5s; }

@keyframes stShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.email-validation {
  font-size: 13px;
  margin-top: 6px;
  min-height: 18px;
}
.email-validation .valid    { color: var(--st-green); }
.email-validation .invalid  { color: var(--st-red); }
.email-validation .suggestion { color: var(--st-blue); cursor: pointer; text-decoration: underline; }

.btn-primary {
  width: 100%;
  padding: 15px;
  background: var(--st-blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover { background: var(--st-blue-dark); transform: translateY(-1px); }

.privacy-notice {
  text-align: center;
  font-size: 12px;
  color: var(--st-muted);
  margin: 10px 0 0;
}

/* ── Testing Phase ──────────────────────────────────────────────────────── */
.phase-testing { padding: 8px 0; }

.test-animation { text-align: center; margin-bottom: 24px; }

.speed-gauge {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto 16px;
}

.gauge-svg { transform: rotate(-90deg); }

.gauge-bg {
  fill: none;
  stroke: var(--st-border);
  stroke-width: 12;
}

.gauge-progress {
  fill: none;
  stroke: var(--st-blue);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 502;
  stroke-dashoffset: 502;
  transition: stroke-dashoffset 0.5s ease, stroke 0.3s;
}

.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gauge-speed {
  font-size: 36px;
  font-weight: 900;
  color: var(--st-text);
  line-height: 1;
}

.gauge-unit { font-size: 13px; color: var(--st-muted); }

.test-progress-wrap {
  height: 6px;
  background: var(--st-border);
  border-radius: 3px;
  overflow: hidden;
  margin: 0 20px;
}

.test-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--st-blue), var(--st-green));
  border-radius: 3px;
  transition: width 0.6s ease;
}

.test-steps { margin: 16px 0; }

.test-step {
  padding: 8px 12px;
  font-size: 14px;
  color: var(--st-muted);
  border-radius: 6px;
  margin-bottom: 4px;
  transition: all 0.3s;
}

.test-step.running {
  background: #e8f0ff;
  color: var(--st-blue);
  font-weight: 600;
}

.test-step.done {
  color: var(--st-green);
  font-weight: 600;
}

/* Live Feed */
.live-feed {
  background: var(--st-bg);
  border-radius: 8px;
  padding: 12px;
  margin-top: 16px;
}

.feed-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--st-red);
  letter-spacing: 1px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.feed-scroll { max-height: 100px; overflow: hidden; }

.feed-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--st-text);
  padding: 4px 0;
  border-bottom: 1px solid var(--st-border);
  animation: stFeedIn 0.5s ease;
}

.feed-item:last-child { border-bottom: none; }

@keyframes stFeedIn {
  from { transform: translateX(30px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.feed-avatar { font-size: 16px; }

.feed-time {
  margin-left: auto;
  color: var(--st-muted);
  font-size: 11px;
  white-space: nowrap;
}

/* ── Results Phase ──────────────────────────────────────────────────────── */
.results-container { padding: 4px 0; }

/* Urgency Bar */
.urgency-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #e53e3e;
  border: 1px solid #c53030;
  color: #ffffff;
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 600;
}

.urgency-timer {
  color: #ffffff;
  font-weight: 900;
  font-size: 18px;
  animation: stPulse 1s infinite;
  text-shadow: 0 0 8px rgba(229,62,62,0.8);
}

.urgency-timer.critical { font-size: 22px; }

@keyframes stPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.8; transform: scale(1.08); }
}

/* Score Hero */
.results-hero {
  text-align: center;
  margin-bottom: 20px;
  position: relative;
}

.confetti-wrap {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 200px;
  overflow: hidden;
  pointer-events: none;
}

.confetti-particle {
  position: absolute;
  border-radius: 2px;
  animation: stFall linear infinite;
  top: -10px;
}

@keyframes stFall {
  to { transform: translateY(220px) rotate(360deg); opacity: 0; }
}

.score-circle {
  position: relative;
  width: 170px;
  height: 170px;
  margin: 0 auto 16px;
}

.score-ring { transform: rotate(-90deg); }

.ring-bg {
  fill: none;
  stroke: var(--st-border);
  stroke-width: 12;
}

.ring-progress {
  fill: none;
  stroke: var(--st-green);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 502;
  stroke-dashoffset: 502;
}

.score-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.score-number {
  font-size: 52px;
  font-weight: 900;
  color: var(--st-text);
  line-height: 1;
}

.score-max { font-size: 18px; color: var(--st-muted); align-self: flex-end; margin-bottom: 8px; }

.score-label {
  font-size: 18px;
  color: var(--st-text);
  margin: 0 0 10px;
}

.score-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.badge-green  { background: #c6f6d5; color: #22543d; }
.badge-blue   { background: #bee3f8; color: #2a4a7f; }
.badge-orange { background: #feebc8; color: #7b341e; }

/* Stats */
.results-stats {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.stat {
  flex: 1;
  text-align: center;
  background: var(--st-bg);
  border-radius: 10px;
  padding: 12px 8px;
}

.stat-icon { font-size: 20px; display: block; }
.stat-value { font-size: 15px; font-weight: 800; color: var(--st-text); display: block; }
.stat-label { font-size: 11px; color: var(--st-muted); display: block; margin-top: 2px; }

/* Social Proof */
.social-proof {
  text-align: center;
  background: #f0fff4;
  border: 1px solid #c6f6d5;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  color: #276749;
  margin-bottom: 16px;
}

/* Capabilities */
.results-capabilities h3 {
  font-size: 15px;
  color: var(--st-text);
  margin: 0 0 10px;
}

.capability-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}

.cap-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--st-bg);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
}

.fade-in { animation: stFadeIn 0.4s ease; }

@keyframes stFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Plan */
.results-recommendation { margin-bottom: 20px; }

.rec-badge {
  display: inline-block;
  background: var(--st-blue);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px 20px 0 0;
}

.rec-plan {
  border: 2px solid var(--st-blue);
  border-radius: 0 10px 10px 10px;
  padding: 16px;
}

.rec-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.rec-header h3 { margin: 0; font-size: 16px; color: var(--st-text); }

.rec-price-old { font-size: 13px; color: var(--st-muted); text-align: right; }
.rec-price-current { font-size: 24px; font-weight: 900; color: var(--st-blue); }

.rec-savings {
  background: #c6f6d5;
  color: #276749;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}

.plan-feature {
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px solid var(--st-border);
  color: var(--st-text);
}

.plan-feature:last-child { border-bottom: none; }

/* CTA */
.cta-primary { text-align: center; margin-bottom: 14px; }

.btn-cta {
  width: 100%;
  padding: 18px 20px;
  background: linear-gradient(135deg, #00aa44 0%, #008833 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 19px;
  font-weight: 900;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 6px 24px rgba(0,170,68,0.4);
  transition: all 0.25s;
  animation: stGlow 2s ease infinite;
}

.btn-cta:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 32px rgba(0,170,68,0.5);
}

@keyframes stGlow {
  0%, 100% { box-shadow: 0 6px 24px rgba(0,170,68,0.4); }
  50%       { box-shadow: 0 6px 32px rgba(0,170,68,0.6); }
}

.cta-subtext {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  color: var(--st-muted);
  margin-top: 10px;
}

.cta-sep { color: var(--st-border); }

.cta-secondary { text-align: center; margin-bottom: 16px; }

.btn-outline {
  background: none;
  border: 2px solid var(--st-blue);
  color: var(--st-blue);
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-outline:hover { background: var(--st-blue); color: #fff; }

/* Email Notice */
.email-notice {
  text-align: center;
  font-size: 13px;
  color: var(--st-muted);
  margin-bottom: 20px;
}

/* Testimonials */
.testimonials { border-top: 1px solid var(--st-border); padding-top: 16px; }

.testimonial { display: none; text-align: center; }
.testimonial.active { display: block; animation: stFadeIn 0.5s; }
.testimonial p { font-style: italic; color: var(--st-text); font-size: 14px; margin: 8px 0; }
.testimonial cite { font-size: 12px; color: var(--st-muted); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .modal-content { padding: 24px 16px 20px; }
  .device-grid   { grid-template-columns: 1fr 1fr; }
  .capability-grid { grid-template-columns: 1fr; }
  .results-stats { gap: 6px; }
  .stat-value    { font-size: 13px; }
  .btn-cta       { font-size: 16px; padding: 16px 14px; }
  .score-number  { font-size: 42px; }
  .banner-text   { font-size: 13px; }
  .rec-header    { flex-direction: column; gap: 6px; }
  .btn-test-speed { font-size: 12px; padding: 8px 14px; }
}

.rocket-icon {
  display: inline-block;
  animation: rocketBounce 2s ease-in-out infinite;
}

@keyframes rocketBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@media (min-width: 768px) {
  .tv4one-st-banner {
    padding: 6px 12px !important;
  }
}
