/* Reset básico y layout sin scroll */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: linear-gradient(135deg, #8EC5FC 0%, #E0C3FC 100%);
  color: #0f172a;
  overflow: hidden; /* evitar scroll */
}

/* Geofence: ocultar contenido hasta validar ubicación */
body:not(.geo-allowed) main.minimal { visibility: hidden; }

/* Overlay de geocerca */
.geo-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, rgba(142,197,252,0.9) 0%, rgba(224,195,252,0.9) 100%);
  backdrop-filter: blur(6px);
  z-index: 9999;
  color: #0f172a;
  text-align: center;
}
.geo-card {
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(15,23,42,0.12);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(2,6,23,0.1);
  padding: 20px 18px;
  max-width: 520px;
  width: 100%;
}
.geo-card h2 { font-size: 1.1rem; margin-bottom: 8px; }
.geo-card p { opacity: 0.85; margin-bottom: 12px; }
.geo-actions { display: inline-flex; gap: 10px; align-items: center; justify-content: center; }
.geo-btn {
  border: 1px solid rgba(15,23,42,0.2);
  background: #ffffff;
  color: #0f172a;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}
.geo-btn.primary { background: #0f172a; color: #fff; border-color: #0f172a; }
.geo-small { font-size: 0.85rem; opacity: 0.8; }

/* Contenedor principal minimalista centrado */
main.minimal {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center; /* centrar verticalmente el conjunto */
  align-items: center;
  padding: 4vmin;
  gap: 1.5vmin;
}

.page-title {
  font-size: clamp(18px, 3.5vmin, 28px);
  font-weight: 700;
  color: #0f172a;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}

.net-toggle {
  display: inline-flex;
  gap: 4px;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(15, 23, 42, 0.12);
  padding: 2px;
  border-radius: 999px;
  white-space: nowrap;
}
.net-btn {
  border: none;
  background: transparent;
  color: #0f172a;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}
.net-btn.active { background: #0f172a; color: #fff; }

/* Zona QR con overlay del botón de descarga */
.qr-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: min(78vmin, 480px);
  aspect-ratio: 1 / 1;
}

#qr-code {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: #ffffffcc;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.08);
}

#qr-code canvas, #qr-code img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  border-radius: 14px;
}

.download-icon {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.15);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  color: #0f172a;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.download-icon:hover { background: rgba(255, 255, 255, 0.95); box-shadow: 0 4px 12px rgba(2, 6, 23, 0.1); }

/* Info WiFi inline y compacta */
.wifi-inline {
  width: min(78vmin, 480px);
  display: grid;
  grid-auto-rows: min-content;
  gap: 8px;
}
.wifi-inline .row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}
.label { color: #334155; font-weight: 600; font-size: 0.95rem; }
.value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(15, 23, 42, 0.12);
  color: #0f172a;
  padding: 8px 10px;
  border-radius: 8px;
  min-width: 0;
}

#toggle-password {
  background: transparent;
  border: 1px solid rgba(15, 23, 42, 0.2);
  color: #0f172a;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
}
#toggle-password:hover { background: rgba(15, 23, 42, 0.06); }

/* Ajustes responsivos para no hacer scroll en ningún tamaño */
@media (max-aspect-ratio: 1/1) {
  /* Pantallas altas (móviles en vertical): reducir paddings y tamaños */
  main.minimal { padding: 3vmin; gap: 1.2vmin; }
  .qr-wrap { width: min(80vmin, 420px); }
  .wifi-inline { width: min(86vmin, 460px); }
}

@media (min-aspect-ratio: 16/9) {
  /* Pantallas muy anchas: usar menos alto para dejar todo visible */
  .qr-wrap { width: min(64vmin, 460px); }
  .wifi-inline { width: min(64vmin, 460px); }
}

/* En pantallas muy bajas, priorizar caber arriba para evitar recorte */
@media (max-height: 560px) {
  main.minimal { justify-content: flex-start; padding-top: 10px; }
  .qr-wrap { width: min(62vmin, 380px); }
}