/* PERF-2.1 — Overlay mientras carga un chunk de sección */

#manto-chunk-load {
  position: fixed;
  inset: 0;
  z-index: 99990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: mantoChunkFadeIn 0.16s ease-out;
}

#manto-chunk-load[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.manto-chunk-load__card {
  border-radius: 14px;
  border: 1px solid var(--gris-300, #cbd5e1);
  background: linear-gradient(168deg, #ffffff 0%, #f8fafc 55%, #f1f5f9 100%);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  padding: 18px 24px;
  min-width: 200px;
  max-width: 88vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.manto-chunk-load__spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e2e8f0;
  border-top-color: #475569;
  border-radius: 50%;
  animation: mantoChunkSpin 0.75s linear infinite;
}

.manto-chunk-load__lbl {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  text-align: center;
}

@keyframes mantoChunkFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes mantoChunkSpin {
  to {
    transform: rotate(360deg);
  }
}

/* PWA / boot: bloquear clics en Inicio mientras carga el chunk dashboard */
html.manto-dash-booting #pg-dash {
  /* No bloquear toques: en PWA dejaba la app “muerta” si el boot no terminaba */
  pointer-events: auto;
}

html.manto-dash-booting #manto-chunk-load:not([hidden]) {
  pointer-events: auto;
}
