/* ==========================================================================
   Sarker Net Speed Test - Custom Design System & Cyber Theme
   ========================================================================== */

:root {
  --bg-primary: #070b14;
  --bg-surface: rgba(15, 23, 42, 0.65);
  --bg-card: rgba(17, 24, 39, 0.75);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-glow: rgba(59, 130, 246, 0.35);
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-purple: #8b5cf6;
  --accent-amber: #f59e0b;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-family: 'Inter', 'Hind Siliguri', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-primary);
  color: #f1f5f9;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #070b14;
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* Cyber Matrix Background with Animated Glow */
.cyber-bg {
  background-color: #050811;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(37, 99, 235, 0.15) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(16, 185, 129, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 50% 30%, rgba(139, 92, 246, 0.08) 0%, transparent 40%),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 48px 48px, 48px 48px;
  background-position: 0 0, 0 0, 0 0, -1px -1px, -1px -1px;
}

/* Glassmorphism Panels */
.glass-panel {
  background: rgba(13, 19, 36, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.glass-card {
  background: linear-gradient(135deg, rgba(23, 32, 54, 0.7) 0%, rgba(13, 19, 36, 0.85) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-card:hover {
  transform: translateY(-3px);
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.7), 0 0 25px rgba(37, 99, 235, 0.12);
}

/* Unit Badge - Strictly Mbps, Never MBPS */
.unit-mbps, .unit-text {
  text-transform: none !important;
  font-variant-caps: normal !important;
  letter-spacing: 0.05em;
  font-weight: 700;
}

/* Text Gradients */
.text-gradient-blue {
  background: linear-gradient(135deg, #60a5fa 0%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-gradient-green {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-gradient-gold {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-gradient-brand {
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Start Button Pulsing Animations */
@keyframes start-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.6), 0 10px 25px rgba(37, 99, 235, 0.4);
  }
  70% {
    box-shadow: 0 0 0 24px rgba(37, 99, 235, 0), 0 10px 30px rgba(37, 99, 235, 0.5);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0), 0 10px 25px rgba(37, 99, 235, 0.4);
  }
}

.btn-start-pulse {
  animation: start-pulse 2.2s infinite ease-out;
}

@keyframes abort-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6), 0 10px 25px rgba(239, 68, 68, 0.4);
  }
  70% {
    box-shadow: 0 0 0 24px rgba(239, 68, 68, 0), 0 10px 30px rgba(239, 68, 68, 0.5);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0), 0 10px 25px rgba(239, 68, 68, 0.4);
  }
}

.btn-abort-pulse {
  animation: abort-pulse 1.8s infinite ease-out;
}

/* Radar ping animation */
@keyframes ping-radar {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
  100% {
    transform: scale(0.95);
    opacity: 0.8;
  }
}

.radar-glow {
  animation: ping-radar 2s infinite ease-in-out;
}

/* Fade in animations */
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.animate-fade-in {
  animation: fadeInScale 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Toast Notification */
#toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 100;
  transform: translateY(120%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
  opacity: 0;
}
#toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Custom Accordion Chevron */
details > summary {
  list-style: none;
}
details > summary::-webkit-details-marker {
  display: none;
}
details[open] summary .faq-icon {
  transform: rotate(180deg);
}

/* Live Speed Sparkline Canvas */
#sparklineCanvas {
  width: 100%;
  height: 38px;
  border-radius: 8px;
}

@media (min-width: 640px) {
  #sparklineCanvas {
    height: 48px;
  }
}

/* Mobile Optimizations */
@media (max-width: 640px) {
  .glass-panel {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .glass-card {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  #toast {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    max-width: calc(100% - 2rem);
    justify-content: center;
  }
}
