/* ============================================================
 * Global Navigation Loading Overlay — Prompt 126
 * Lightweight ring-spinner overlay for cross-page navigation
 * to whitelisted heavy routes only. Mobile-first.
 *
 * Do NOT reuse for in-page async work. AI Joshiyar answer
 * loading, session switch, payment activation, and Jathagam
 * computation each own their own dedicated spinners.
 * ============================================================ */

.global-nav-loading {
  position: fixed;
  inset: 0;
  z-index: 12000;            /* above header (header.css ~1000) and most modals */
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 140ms ease-out;
  pointer-events: none;       /* hidden state should not capture taps */
}

.global-nav-loading.is-visible {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.global-nav-loading[hidden] {
  /* Defensive: HTML hidden attribute fallback */
  display: none !important;
}

/* Prompt 128 — While the navigation overlay is sticky-visible, lock the
   underlying page so a user cannot interact with what is, conceptually,
   the soon-to-be-replaced previous page. The overlay itself sits at
   z-index 12000 (above hamburger drawer / backdrop), so this also
   visually covers any open drawer. */
body.global-nav-loading-active {
  overflow: hidden;
  /* Block touch/scroll gestures on the underlying content while the
     overlay is shown. The overlay re-enables pointer-events on itself. */
  touch-action: none;
}

.global-nav-loading__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(245, 240, 252, 0.75);     /* soft lavender wash */
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.global-nav-loading__card {
  position: relative;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(106, 27, 154, 0.18);
  padding: 22px 28px;
  min-width: 220px;
  max-width: min(360px, calc(100vw - 32px));
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* ── Ring spinner (NOT the spiritual mandala) ── */
.global-nav-loading__spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(123, 44, 191, 0.18);   /* brand purple, faded */
  border-top-color: #7b2cbf;                     /* brand purple solid */
  animation: gnl-spin 0.85s linear infinite;
}

@keyframes gnl-spin {
  to { transform: rotate(360deg); }
}

.global-nav-loading__title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: #4a148c;            /* deep brand purple */
  line-height: 1.35;
}

.global-nav-loading__sub {
  margin: 0;
  font-size: 0.82rem;
  color: #6a4a8a;            /* softer purple */
  line-height: 1.35;
}

/* ── Desktop tweaks ── */
@media (min-width: 768px) {
  .global-nav-loading__card {
    padding: 26px 36px;
    min-width: 260px;
  }
  .global-nav-loading__spinner {
    width: 52px;
    height: 52px;
    border-width: 4px;
  }
  .global-nav-loading__title {
    font-size: 1.05rem;
  }
  .global-nav-loading__sub {
    font-size: 0.88rem;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .global-nav-loading {
    transition: none;
  }
  .global-nav-loading__spinner {
    animation: none;
    border-top-color: rgba(123, 44, 191, 0.55);
  }
}
