/* ==========================================================================
   HCABORCA - SPEEDTEST LIMPIO TRIPLE MODO (LOCAL, INTERNET, FULL)
   Estilo Cyberpunk Minimalista & Glassmorphism
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;600;700;800&family=JetBrains+Mono:wght@400;600;700;800&display=swap');

:root {
  --bg-deep: #050811;
  --bg-card: rgba(14, 21, 38, 0.78);
  --bg-card-hover: rgba(22, 33, 60, 0.9);
  --border-subtle: rgba(255, 255, 255, 0.08);

  --cyan: #00f2fe;
  --cyan-glow: rgba(0, 242, 254, 0.45);
  --blue: #4facfe;
  --purple: #9d4edd;
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.45);
  --amber: #f59e0b;
  --amber-glow: rgba(245, 158, 11, 0.45);
  --rose: #f43f5e;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --grad-cyan: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  --grad-emerald: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  --grad-amber: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  --grad-purple: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);

  --font-main: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

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

body {
  background-color: var(--bg-deep);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(0, 242, 254, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(157, 78, 221, 0.08) 0%, transparent 45%),
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 36px 36px, 36px 36px;
  color: var(--text-primary);
  font-family: var(--font-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header Limpio */
.header-clean {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.brand-clean {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: var(--grad-cyan);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-ico {
  font-size: 20px;
  color: var(--cyan);
  -webkit-text-fill-color: var(--cyan);
}

.node-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: rgba(0, 242, 254, 0.08);
  border: 1px solid rgba(0, 242, 254, 0.25);
  border-radius: 30px;
  font-size: 13px;
  color: var(--cyan);
}

.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 10px var(--emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* 2 Botones Grandes Modernos */
.main-buttons-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 650px) {
  .main-buttons-grid {
    grid-template-columns: 1fr;
  }
}

.nav-test-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow: hidden;
  outline: none;
}

.nav-test-card * {
  pointer-events: none;
}

.nav-test-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(0, 242, 254, 0.4);
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
}

.nav-test-card.active {
  background: rgba(0, 242, 254, 0.1);
  border-color: var(--cyan);
  box-shadow: 0 0 25px rgba(0, 242, 254, 0.28);
}

.nav-test-card[data-mode="local"].active {
  border-color: var(--emerald);
  background: rgba(16, 185, 129, 0.12);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.28);
}

.card-ico {
  font-size: 28px;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.nav-test-card[data-mode="local"] .card-ico { color: var(--emerald); }
.nav-test-card[data-mode="plan"] .card-ico { color: var(--cyan); }

.card-title {
  font-family: var(--font-main);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-primary);
}

.card-subtitle {
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.nav-test-card.active .card-subtitle {
  color: #94a3b8;
}

/* Modal de Contraseña Modo FULL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 17, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  animation: modalFadeIn 0.2s ease;
}

.modal-overlay.hidden-box {
  display: none !important;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  position: relative;
  background: #0d1527;
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 35px rgba(245, 158, 11, 0.2);
  width: 100%;
  max-width: 440px;
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: cardPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  transition: color 0.15s ease;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.modal-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--amber);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.25);
}

.modal-header h3 {
  font-family: var(--font-main);
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-header p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-body .input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.modal-body .input-icon {
  position: absolute;
  left: 14px;
  color: var(--amber);
  font-size: 14px;
}

#full-pwd-input {
  width: 100%;
  padding: 13px 14px 13px 40px;
  background: #060a14;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 15px;
  outline: none;
  transition: all 0.2s ease;
}

#full-pwd-input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 15px var(--amber-glow);
}

.pwd-err-text {
  display: none;
  font-size: 12.5px;
  color: var(--rose);
  font-weight: 600;
  text-align: center;
}

.pwd-err-text.visible {
  display: block;
}

.modal-btn-submit {
  background: var(--grad-amber);
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 20px;
  color: #050811;
  font-family: var(--font-main);
  font-weight: 800;
  font-size: 14.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 15px var(--amber-glow);
}

.modal-btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--amber-glow);
}

/* Área Principal de Prueba */
.test-area-clean {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

/* Banner de Poblado y Cliente Detectados */
.detected-info-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(14, 21, 38, 0.7);
  border: 1px solid rgba(0, 242, 254, 0.25);
  padding: 10px 24px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.detected-info-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.pin-ico {
  color: var(--cyan);
  font-size: 14px;
}

.client-ico {
  color: var(--emerald);
  font-size: 14px;
}

.info-lbl {
  color: var(--text-secondary);
  font-weight: 500;
}

.info-val {
  color: var(--cyan);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.client-val-highlight {
  color: #38bdf8;
  font-family: var(--font-mono);
  font-weight: 700;
}

/* Título de la Prueba */
.test-title-clean {
  font-family: var(--font-main);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-primary);
}

.gauge-wrapper {
  position: relative;
  width: 320px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gauge-svg {
  width: 320px;
  height: 220px;
  overflow: visible;
}

.gauge-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 14;
  stroke-linecap: round;
}

.gauge-fill {
  fill: none;
  stroke: url(#gauge-gradient);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 440;
  stroke-dashoffset: 440;
  transition: stroke-dashoffset 0.12s ease-out;
}

.gauge-center-info {
  position: absolute;
  top: 85px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gauge-speed {
  font-family: var(--font-mono);
  font-size: 58px;
  font-weight: 800;
  letter-spacing: -2px;
  background: var(--grad-cyan);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}

.gauge-unit {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 4px;
}

.gauge-status {
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--cyan);
  font-weight: 600;
  min-height: 20px;
  text-align: center;
}

/* Botón de Inicio */
.start-btn-primary {
  background: var(--grad-cyan);
  border: none;
  border-radius: 50px;
  padding: 16px 48px;
  font-family: var(--font-main);
  font-size: 17px;
  font-weight: 800;
  color: #050811;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 0 30px var(--cyan-glow);
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.start-btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 45px rgba(0, 242, 254, 0.7);
}

.start-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 4 Métricas en Limpio */
.metrics-grid-clean {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 700px) {
  .metrics-grid-clean {
    grid-template-columns: repeat(2, 1fr);
  }
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

.metric-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-val .unit {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
  margin-left: 4px;
}

/* Modal de Contraseña */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.hidden-modal {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-card {
  width: 100%;
  max-width: 380px;
  background: rgba(14, 21, 38, 0.95);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
}

.modal-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}

.modal-card h2 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.modal-card p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.4;
}

.pwd-error-msg {
  display: none;
  font-size: 12.5px;
  color: var(--rose);
  margin-bottom: 12px;
}

.pwd-error-msg.visible {
  display: block;
}

#full-pwd-input {
  width: 100%;
  padding: 12px 16px;
  background: #080d1a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-mono);
  outline: none;
  margin-bottom: 20px;
  transition: border-color 0.2s ease;
}

#full-pwd-input:focus {
  border-color: var(--amber);
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.btn-cancel {
  flex: 1;
  padding: 11px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
}

.btn-confirm {
  flex: 1;
  padding: 11px;
  background: var(--grad-amber);
  border: none;
  border-radius: var(--radius-sm);
  color: #050811;
  font-weight: 700;
  cursor: pointer;
}

/* Footer Limpio */
.footer-clean {
  text-align: center;
  padding: 16px;
  font-size: 12.5px;
  color: var(--text-muted);
}
