@import url('../../src/styles/_converter.css');
@import url('../../src/styles/_buttons.css');
@import url('../../src/styles/_options.css');
@import url('../../src/styles/_progress.css');


/* ═══════════════════════════════════════════════════════════
   SPEED TEST — Full Page Styles
   ═══════════════════════════════════════════════════════════ */

/* ── Panel ──────────────────────────────────────────────── */

.speed-test-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  padding: 8px 0 24px;
}


/* ── Hero / Gauge Area ──────────────────────────────────── */

.speed-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 24px 0 0;
}

/* Animated glow behind gauge */
.speed-glow {
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
  pointer-events: none;
  transition: all 0.6s ease;
  opacity: 0;
}

.speed-glow.active {
  opacity: 1;
  animation: glow-pulse 2.5s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50%      { transform: scale(1.15); opacity: 1; }
}


/* ── Gauge SVG ──────────────────────────────────────────── */

.speed-gauge-wrapper {
  position: relative;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 3 / 2;
  z-index: 1;
}

.speed-gauge {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.08));
}

/* Track (background arc) */
.gauge-track {
  stroke: #E2E8F0;
}

/* Colored fill arc */
.gauge-fill {
  stroke: url(#gauge-gradient);
  transition: stroke-dashoffset 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tick marks */
.gauge-tick {
  stroke: #CBD5E1;
  stroke-width: 1.5;
  stroke-linecap: round;
}

/* Scale numbers */
.gauge-label {
  fill: #94A3B8;
  font-size: 11px;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
  text-anchor: middle;
}


/* ── Center Readout ─────────────────────────────────────── */

.gauge-center {
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  width: 70%;
}

.gauge-value {
  font-size: 56px;
  font-weight: 900;
  color: var(--text, #0F172A);
  line-height: 1;
  font-family: 'Inter', system-ui, sans-serif;
  letter-spacing: -2px;
  transition: color 0.3s;
}

.gauge-unit {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted, #94A3B8);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.gauge-phase {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted, #94A3B8);
  margin-top: 10px;
  letter-spacing: 0.3px;
  transition: color 0.3s;
}

.gauge-phase.testing {
  color: var(--primary, #6366F1);
  animation: phase-pulse 1.8s ease-in-out infinite;
}

@keyframes phase-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}


/* ── Start Button ───────────────────────────────────────── */

.speed-start-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 240px;
  height: 54px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
  background: var(--gradient-primary, linear-gradient(135deg, #6366F1, #8B5CF6));
  border: none;
  border-radius: 27px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3), 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.speed-start-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  pointer-events: none;
}

.speed-start-btn:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4), 0 2px 6px rgba(0, 0, 0, 0.1);
}

.speed-start-btn:active:not(:disabled) {
  transform: translateY(-1px) scale(0.99);
}

.speed-start-btn:disabled {
  opacity: 0.8;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.2);
}

.speed-start-btn svg {
  flex-shrink: 0;
}

/* Spinner */
.speed-spinner {
  animation: speed-spin 0.9s linear infinite;
  transform-origin: center;
}

@keyframes speed-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}


/* ── Results Grid ───────────────────────────────────────── */

.speed-results {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  width: 100%;
  max-width: 720px;
}

.speed-result-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 24px 14px 20px;
  background: var(--card, #fff);
  border-radius: 16px;
  border: 1.5px solid var(--border, #E2E8F0);
  text-align: center;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.speed-result-card:hover {
  border-color: #CBD5E1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Filled state */
.speed-result-card.has-value {
  border-color: var(--primary, #6366F1);
  background: linear-gradient(160deg, #fff 0%, rgba(99, 102, 241, 0.04) 100%);
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.08);
}

.speed-result-card.has-value .speed-result-icon {
  background: var(--primary, #6366F1);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

/* Flash animation */
.speed-result-card.flash {
  animation: card-flash 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes card-flash {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.06); box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2), 0 4px 20px rgba(99, 102, 241, 0.15); }
  100% { transform: scale(1); box-shadow: 0 2px 12px rgba(99, 102, 241, 0.08); }
}


/* Icon */
.speed-result-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt, #F1F5F9);
  color: var(--text-muted, #94A3B8);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.speed-result-icon.download {
  background: #EFF6FF;
  color: #3B82F6;
}

.speed-result-icon.upload {
  background: #F0FDF4;
  color: #22C55E;
}

.speed-result-card.has-value .speed-result-icon.download {
  background: #3B82F6;
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.speed-result-card.has-value .speed-result-icon.upload {
  background: #22C55E;
  color: #fff;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}


/* Content */
.speed-result-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.speed-result-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted, #94A3B8);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.speed-result-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
}

.speed-result-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text, #0F172A);
  line-height: 1.1;
  font-family: 'Inter', system-ui, sans-serif;
  letter-spacing: -0.5px;
  transition: all 0.3s;
}

.speed-result-unit {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted, #94A3B8);
  letter-spacing: 0.5px;
}


/* ── Server Info ────────────────────────────────────────── */

.speed-server-info {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted, #94A3B8);
  padding: 10px 20px;
  background: var(--bg-alt, #F8FAFC);
  border-radius: 50px;
  border: 1px solid var(--border, #E2E8F0);
  transition: all 0.4s ease;
  letter-spacing: 0.2px;
}

.speed-server-info.active {
  border-color: rgba(99, 102, 241, 0.2);
  color: var(--text-secondary, #64748B);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.04), rgba(139, 92, 246, 0.04));
}

.speed-server-info svg {
  flex-shrink: 0;
  opacity: 0.5;
}


/* ── Error ──────────────────────────────────────────────── */

.speed-error {
  color: var(--error, #EF4444);
  font-size: 14px;
  font-weight: 500;
  padding: 14px 20px;
  background: #FEF2F2;
  border-radius: 12px;
  border: 1px solid #FEE2E2;
  text-align: center;
  width: 100%;
  max-width: 500px;
  animation: error-slide-in 0.3s ease;
}

@keyframes error-slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 768px) {
  .speed-hero { padding: 12px 0 0; }

  .speed-gauge-wrapper { max-width: 300px; }

  .gauge-value { font-size: 40px; letter-spacing: -1.5px; }
  .gauge-unit  { font-size: 13px; }
  .gauge-phase { font-size: 12px; }

  .speed-results {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .speed-result-card { padding: 18px 12px 16px; }

  .speed-result-value { font-size: 20px; }

  .speed-start-btn {
    min-width: 210px;
    height: 50px;
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  .speed-gauge-wrapper { max-width: 260px; }

  .gauge-value { font-size: 32px; letter-spacing: -1px; }
  .gauge-unit  { font-size: 11px; letter-spacing: 1px; }
  .gauge-phase { font-size: 11px; margin-top: 6px; }

  .speed-results { gap: 10px; }

  .speed-result-card { padding: 16px 10px 14px; gap: 10px; }

  .speed-result-icon { width: 40px; height: 40px; border-radius: 12px; }

  .speed-result-value { font-size: 18px; }

  .speed-start-btn {
    min-width: 190px;
    height: 48px;
    font-size: 14px;
  }
}
