/* =============================================
   ZHH Internet Speed Checker — Premium CSS
   Developed by Zeeshan Haider
   ============================================= */

:root {
  --primary: #00f5ff;
  --secondary: #0080ff;
  --accent: #7b2fff;
  --accent2: #ff2f7b;
  --bg-dark: #020408;
  --bg-card: rgba(5, 15, 30, 0.85);
  --bg-card2: rgba(0, 20, 40, 0.7);
  --border: rgba(0, 245, 255, 0.12);
  --border-bright: rgba(0, 245, 255, 0.35);
  --text-primary: #e8f4ff;
  --text-secondary: rgba(200, 230, 255, 0.6);
  --text-muted: rgba(150, 190, 220, 0.4);
  --down-color: #00f5ff;
  --up-color: #7b2fff;
  --good: #00ff9d;
  --warn: #ffb800;
  --danger: #ff2f7b;
  --font-display: 'Orbitron', monospace;
  --font-body: 'Rajdhani', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --glow-cyan: 0 0 20px rgba(0, 245, 255, 0.4), 0 0 60px rgba(0, 245, 255, 0.15);
  --glow-purple: 0 0 20px rgba(123, 47, 255, 0.4), 0 0 60px rgba(123, 47, 255, 0.15);
}

/* RESET */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* =============================================
   ANIMATED BACKGROUND
   ============================================= */

.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

#particleCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 245, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 245, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: gridPulse 8s ease-in-out infinite;
}

@keyframes gridPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: orbFloat 12s ease-in-out infinite;
}
.orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(0,245,255,0.08) 0%, transparent 70%);
  top: -150px; left: -150px;
  animation-delay: 0s;
}
.orb-2 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(123,47,255,0.07) 0%, transparent 70%);
  bottom: -200px; right: -200px;
  animation-delay: -4s;
}
.orb-3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(0,128,255,0.06) 0%, transparent 70%);
  top: 40%; left: 40%;
  animation-delay: -8s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -40px) scale(1.05); }
  66% { transform: translate(-20px, 30px) scale(0.95); }
}

.scan-line {
  position: absolute;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0,245,255,0.15), transparent);
  animation: scanMove 6s linear infinite;
  top: 0;
}

@keyframes scanMove {
  0% { top: -2px; }
  100% { top: 100%; }
}

/* =============================================
   HEADER
   ============================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(2, 4, 8, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-badge {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--primary);
  background: rgba(0, 245, 255, 0.08);
  border: 1px solid rgba(0, 245, 255, 0.25);
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(0, 245, 255, 0.5);
}

.logo-badge.small {
  font-size: 10px;
  padding: 4px 8px;
  letter-spacing: 2px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--text-primary);
}

.brand-sub {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dev-credit {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.dev-credit strong {
  color: var(--primary);
  font-weight: 600;
}

.wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 8px;
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: #fff;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.25);
}

.wa-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(37, 211, 102, 0.4);
}

.wa-btn.small {
  padding: 7px 14px;
  font-size: 12px;
}

/* =============================================
   MAIN CONTENT
   ============================================= */

.main-content {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
}

/* =============================================
   HERO SECTION
   ============================================= */

.hero-section {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: fadeUp 0.8s ease both;
}

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

.hero-tagline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.tag-chip {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--primary);
  border: 1px solid rgba(0,245,255,0.2);
  padding: 4px 10px;
  border-radius: 4px;
  background: rgba(0,245,255,0.04);
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 7vw, 58px);
  font-weight: 900;
  letter-spacing: 4px;
  line-height: 1.1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.title-line { color: var(--text-primary); }
.title-line.accent {
  color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(0, 245, 255, 0.3));
}

.hero-desc {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-secondary);
  letter-spacing: 1px;
  max-width: 480px;
}

/* =============================================
   GAUGE SECTION
   ============================================= */

.gauge-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeUp 0.8s 0.15s ease both;
}

.gauge-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.gauge-ring-outer {
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: conic-gradient(from 180deg, rgba(0,245,255,0.05), rgba(123,47,255,0.05), rgba(0,245,255,0.05));
  padding: 8px;
  box-shadow: 0 0 60px rgba(0,245,255,0.08), inset 0 0 40px rgba(0,0,0,0.5);
  animation: outerRotate 20s linear infinite;
}

@keyframes outerRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.gauge-ring-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(5,20,40,0.95) 60%, rgba(0,245,255,0.03) 100%);
  border: 1px solid rgba(0,245,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  animation: outerRotate 20s linear infinite reverse;
}

.gauge-svg {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0; left: 0;
}

.gauge-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  gap: 2px;
}

.speed-value {
  font-family: var(--font-display);
  font-size: 54px;
  font-weight: 900;
  line-height: 1;
  color: var(--primary);
  text-shadow: var(--glow-cyan);
  letter-spacing: -2px;
  transition: all 0.1s ease;
  min-width: 120px;
  text-align: center;
}

.speed-unit {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 4px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.speed-label {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.status-ring {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 8px 20px;
  backdrop-filter: blur(10px);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all 0.3s ease;
}

.status-dot.active { background: var(--good); box-shadow: 0 0 10px var(--good); animation: blink 1s ease infinite; }
.status-dot.testing { background: var(--warn); box-shadow: 0 0 10px var(--warn); animation: blink 0.5s ease infinite; }
.status-dot.done { background: var(--primary); box-shadow: 0 0 10px var(--primary); }

@keyframes blink {
  0%, 100% { opacity: 1; } 50% { opacity: 0.3; }
}

.status-text {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

/* =============================================
   LIVE SECTION
   ============================================= */

.live-section {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  animation: fadeUp 0.8s 0.25s ease both;
}

.live-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.live-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,245,255,0.02) 0%, transparent 60%);
  pointer-events: none;
}

.live-card:nth-child(2)::before {
  background: linear-gradient(135deg, rgba(123,47,255,0.03) 0%, transparent 60%);
}

.live-card.active { border-color: rgba(0,245,255,0.3); box-shadow: var(--glow-cyan); }
.live-card:nth-child(2).active { border-color: rgba(123,47,255,0.3); box-shadow: var(--glow-purple); }

.live-icon {
  font-size: 24px;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.down-icon { background: rgba(0,245,255,0.08); color: var(--down-color); }
.up-icon { background: rgba(123,47,255,0.08); color: var(--up-color); }

.live-info { flex: 1; min-width: 0; }

.live-label {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.live-speed-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 10px;
}

.live-speed-num {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--down-color);
  line-height: 1;
}

#liveUpCard .live-speed-num { color: var(--up-color); }

.live-speed-unit {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-muted);
}

.live-bar-track {
  height: 4px;
  background: rgba(255,255,255,0.05);
  border-radius: 2px;
  overflow: hidden;
}

.live-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.down-fill { background: linear-gradient(90deg, var(--down-color), var(--secondary)); box-shadow: 0 0 8px var(--down-color); }
.up-fill { background: linear-gradient(90deg, var(--up-color), var(--accent2)); box-shadow: 0 0 8px var(--up-color); }

/* =============================================
   CTA BUTTON
   ============================================= */

.cta-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  animation: fadeUp 0.8s 0.35s ease both;
}

.start-btn {
  position: relative;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.start-btn:hover { transform: scale(1.05); }
.start-btn:active { transform: scale(0.97); }
.start-btn:disabled { cursor: not-allowed; opacity: 0.7; transform: none; }

.btn-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
  mask-composite: exclude;
  animation: ringPulse 2s ease-in-out infinite;
}

@keyframes ringPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.02); }
}

.btn-inner {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, rgba(0,245,255,0.12), rgba(5,15,30,0.95));
  border: 1px solid rgba(0,245,255,0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.5), 0 0 40px rgba(0,245,255,0.1);
}

.btn-icon {
  font-size: 32px;
  filter: drop-shadow(0 0 8px rgba(0, 245, 255, 0.6));
}

.btn-text {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--primary);
  text-align: center;
  line-height: 1.3;
}

.test-progress {
  width: 100%;
  max-width: 400px;
  height: 3px;
  background: rgba(255,255,255,0.05);
  border-radius: 2px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.test-progress.visible { opacity: 1; }

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
  border-radius: 2px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px var(--primary);
}

/* =============================================
   RESULTS SECTION
   ============================================= */

.results-section {
  width: 100%;
  animation: fadeUp 0.8s 0.45s ease both;
}

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

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 14px;
  text-align: center;
  backdrop-filter: blur(10px);
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
}

.result-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0,245,255,0.4), transparent);
  transform: scaleX(0);
  transition: transform 0.4s ease;
}

.result-card.populated::after { transform: scaleX(1); }
.result-card.populated { border-color: rgba(0,245,255,0.2); }

.res-icon {
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.res-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 2px;
  transition: all 0.3s ease;
}

.res-unit {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.res-label {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

/* =============================================
   NETWORK INFO SECTION
   ============================================= */

.netinfo-section {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  backdrop-filter: blur(10px);
  animation: fadeUp 0.8s 0.55s ease both;
}

.netinfo-header {
  margin-bottom: 20px;
}

.section-label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--text-muted);
}

.netinfo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.netinfo-item {
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 14px;
}

.ni-label {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.ni-value {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--primary);
  font-weight: 400;
}

/* =============================================
   MONITOR SECTION
   ============================================= */

.monitor-section {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  backdrop-filter: blur(10px);
  animation: fadeUp 0.8s 0.65s ease both;
}

.monitor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.monitor-badge {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--good);
  background: rgba(0,255,157,0.08);
  border: 1px solid rgba(0,255,157,0.2);
  padding: 4px 10px;
  border-radius: 12px;
  animation: blink 2s ease infinite;
}

.monitor-chart-wrap {
  width: 100%;
  overflow: hidden;
}

#monitorChart {
  width: 100%;
  display: block;
}

/* =============================================
   FOOTER
   ============================================= */

.site-footer {
  position: relative;
  z-index: 1;
  background: rgba(2, 4, 8, 0.95);
  border-top: 1px solid var(--border);
  padding: 24px;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-primary);
}

.footer-dev {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-muted);
}

.footer-dev strong { color: var(--primary); }

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-copy {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 768px) {
  .header-inner { height: auto; padding: 12px 0; flex-direction: column; gap: 10px; }
  .dev-credit { display: none; }
  .main-content { padding: 24px 16px 48px; gap: 28px; }
  .results-grid { grid-template-columns: repeat(2, 1fr); }
  .netinfo-grid { grid-template-columns: 1fr 1fr; }
  .live-section { grid-template-columns: 1fr; }
  .gauge-ring-outer { width: 240px; height: 240px; }
  .speed-value { font-size: 42px; }
  .start-btn { width: 150px; height: 150px; }
  .footer-inner { flex-direction: column; text-align: center; }
  .hero-title { font-size: clamp(28px, 10vw, 40px); }
}

@media (max-width: 480px) {
  .results-grid { grid-template-columns: repeat(2, 1fr); }
  .netinfo-grid { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
  .res-value { font-size: 22px; }
}

/* =============================================
   ANIMATION UTILITIES
   ============================================= */

.pulse-glow {
  animation: pulseGlow 1.5s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(0,245,255,0.2); }
  50% { box-shadow: 0 0 50px rgba(0,245,255,0.5), 0 0 80px rgba(0,245,255,0.2); }
}

.number-update {
  animation: numFlash 0.1s ease;
}

@keyframes numFlash {
  0% { opacity: 0.5; transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}
