/* ============================================================
   NetPix Spinner Component
   File: /assets/css/spinner.css
   Usage: Add class "np-spinner" to any inline element,
          or wrap content with ".np-spinner-overlay" for full-
          screen / full-container blocking spinner.
   ============================================================ */

/* ── Core spinning arc ─────────────────────────────────────── */
.np-spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(255, 255, 255, 0.25); /* track  */
  border-top-color: #ffffff;                       /* arc    */
  border-radius: 50%;
  animation: np-spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* Colour variants ------------------------------------------- */

/* On light backgrounds (e.g. inside white cards / modals) */
.np-spinner--dark {
  border-color: rgba(0, 0, 0, 0.12);
  border-top-color: var(--color-secondary, #667eea);
}

/* Primary brand colour arc */
.np-spinner--primary {
  border-color: rgba(102, 126, 234, 0.2);
  border-top-color: var(--color-secondary, #667eea);
}

/* Size variants --------------------------------------------- */
.np-spinner--sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.np-spinner--lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

.np-spinner--xl {
  width: 48px;
  height: 48px;
  border-width: 3.5px;
}

/* ── Button-embedded spinner ───────────────────────────────── */
/*
   Use on submit buttons while loading:
     <button class="np-btn-loading">
       <span class="np-spinner np-spinner--sm"></span>
       Processing…
     </button>
*/
.np-btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
  opacity: 0.85;
}

/* ── Full-container overlay ────────────────────────────────── */
/*
   Blocks a modal / card while processing.
   Parent must have position: relative.

     <div class="topup-body" style="position:relative">
       <div class="np-spinner-overlay">
         <span class="np-spinner np-spinner--primary np-spinner--lg"></span>
         <p class="np-spinner-label">Processing payment…</p>
       </div>
       … rest of content …
     </div>
*/
.np-spinner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.92);
  border-radius: inherit;
  z-index: 10;
}

.np-spinner-label {
  font-size: 0.875rem;
  color: var(--color-text-light, #666666);
  margin: 0;
  letter-spacing: 0.01em;
}

/* ── Keyframe ───────────────────────────────────────────────── */
@keyframes np-spin {
  to { transform: rotate(360deg); }
}
