/* style.css - Authentic Speedtest.net Cyberpunk Clone */

:root {
  --bg-color: #0c0e17;        /* Authentic very dark navy background */
  --box-bg: #141824;          /* Inner container card background */
  --border-color: #1c2234;    /* Subtle panel separation lines */
  --text-main: #ffffff;
  --text-muted: #6b7a99;      /* Cool slate blue text */
  
  /* Speedtest Glow Accents */
  --cyan: #00c6ff;
  --cyan-glow: rgba(0, 198, 255, 0.2);
  --pink: #f53b57;
  --pink-glow: rgba(245, 59, 87, 0.25);
  --green: #00ff87;
  --green-glow: rgba(0, 255, 135, 0.15);
}

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

body {
  font-family: 'Montserrat', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 1. Header Navigation Bar (Mimics speedtest.net navbar) */
.navbar {
  width: 100%;
  height: 64px;
  background-color: #0a0b12;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}
.navbar-container {
  width: 100%;
  max-width: 940px;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.navbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.ookla-logo {
  width: 24px;
  height: 24px;
  color: #ff5722; /* Ookla Orange */
}
.logo-text {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #ffffff 40%, #00f2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.navbar-menu {
  display: none;
  gap: 28px;
}
@media (min-width: 768px) {
  .navbar-menu {
    display: flex;
  }
}
.navbar-menu a {
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  transition: color 0.2s;
}
.navbar-menu a:hover,
.navbar-menu a.active {
  color: var(--text-main);
}
.navbar-actions .login-link {
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  transition: color 0.2s;
}
.navbar-actions .login-link:hover {
  color: var(--text-main);
}

/* Main Content Wrapper */
.main-content {
  width: 100%;
  max-width: 940px;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

/* Authentic Dashboard Card Box */
.test-container-box {
  width: 100%;
  background-color: var(--box-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

/* 2. Top Results Panel */
.results-bar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 24px;
}
@media (min-width: 600px) {
  .results-bar {
    grid-template-columns: repeat(4, 1fr);
  }
}
.result-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
}
.result-item .label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
}
.result-item .unit {
  font-size: 8px;
  font-weight: 500;
  opacity: 0.7;
}
.result-item .value {
  font-size: 38px;
  font-weight: 900;
  font-family: 'Share Tech Mono', monospace;
  margin-top: 6px;
  color: #242b3d; /* Dark gray indicator when inactive */
  transition: color 0.3s, text-shadow 0.3s;
}
.result-item.has-val .value {
  color: var(--text-main);
}
#res-ping.has-val .value {
  color: var(--green);
  text-shadow: 0 0 10px var(--green-glow);
}
#res-download.has-val .value {
  color: var(--cyan);
  text-shadow: 0 0 10px var(--cyan-glow);
}
#res-upload.has-val .value {
  color: #ff5e5e;
  text-shadow: 0 0 10px rgba(255, 94, 94, 0.2);
}
.result-item.active-stage {
  border-bottom: 2px solid var(--cyan);
}
#res-upload.active-stage {
  border-bottom-color: #ff5e5e;
}

/* 3. Central gauge section */
.gauge-section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 320px;
}
.speedometer-container {
  position: relative;
  width: 290px;
  height: 290px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.speed-dial {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}
.dial-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.04);
  stroke-width: 6;
  stroke-linecap: round;
}
.dial-fill {
  fill: none;
  stroke: url(#cyanGrad);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 410;
  stroke-dashoffset: 410; /* Dynamic rotation progress */
  transition: stroke-dashoffset 0.1s linear, stroke 0.3s;
}

/* Rotating Needle */
.needle-indicator {
  transform-origin: 100px 100px;
  transform: rotate(135deg); /* Default angle at 0 Mbps */
  transition: transform 0.15s ease-out;
}

/* Central Numeric readouts */
.center-readout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.3s, transform 0.3s;
}
.center-readout.show {
  opacity: 1;
  transform: scale(1);
}
.stage-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}
.speed-number {
  font-size: 58px;
  font-weight: 900;
  font-family: 'Share Tech Mono', monospace;
  line-height: 1;
  margin: 6px 0;
  letter-spacing: -1px;
}
.speed-unit {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

/* Big Circular GO Button with pulse effect */
.go-btn-large {
  position: absolute;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  transition: opacity 0.3s, transform 0.3s;
}
.go-circle {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: #141824;
  border: 4px solid var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 25px rgba(0, 198, 255, 0.2), inset 0 0 15px rgba(0, 198, 255, 0.1);
  transition: all 0.25s;
}
.go-text {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: var(--cyan);
  text-shadow: 0 0 10px var(--cyan-glow);
}
.go-btn-large:hover .go-circle {
  transform: scale(1.04);
  border-color: #ffffff;
  box-shadow: 0 0 35px rgba(0, 198, 255, 0.4), inset 0 0 20px rgba(0, 198, 255, 0.2);
}
.go-btn-large:hover .go-text {
  color: #ffffff;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}
.go-btn-large:active .go-circle {
  transform: scale(0.96);
}
.go-btn-large.hide {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.7);
}

/* Pulsing outer rings for GO button */
.pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--cyan);
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}
.ring-1 {
  animation: pulseOuter 3s infinite linear;
}
.ring-2 {
  animation: pulseOuter 3s infinite linear 1.5s;
}
@keyframes pulseOuter {
  0% { transform: scale(1); opacity: 0.4; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* 4. Chart Section */
.chart-section {
  background: rgba(20, 24, 36, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 20px;
}
.chart-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.chart-info .title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
}
.chart-info .indicator {
  font-size: 12px;
  font-family: 'Share Tech Mono', monospace;
  font-weight: 700;
  color: var(--cyan);
}
.canvas-box {
  position: relative;
  width: 100%;
  height: 90px;
}
#live-chart {
  width: 100%;
  height: 100%;
}

/* 5. Footer ISP Info */
.test-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
}
.footer-block {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 45%;
}
.icon-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  color: var(--cyan);
  flex-shrink: 0;
}
.server-icon {
  color: var(--pink);
}
.icon-circle svg {
  width: 18px;
  height: 18px;
}
.text-block {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.title-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.value-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.align-right {
  text-align: right;
  align-items: flex-end;
}
.server-side {
  justify-content: flex-end;
}
@media (max-width: 480px) {
  .test-footer {
    flex-direction: column;
    gap: 16px;
  }
  .footer-block {
    max-width: 100%;
    width: 100%;
  }
  .align-right {
    text-align: left;
    align-items: flex-start;
  }
  .server-side {
    flex-direction: row-reverse;
  }
}
