/* ═══════════════════════════════════════
   App Loader — animations & preloaders
   ═══════════════════════════════════════ */

/* ── Top navigation progress bar ── */
#nbar {
  position: fixed; top: 0; left: 0; height: 3px; z-index: 99999;
  background: linear-gradient(90deg, #2563eb 0%, #60a5fa 60%, #a78bfa 100%);
  width: 0%; opacity: 0;
  border-radius: 0 2px 2px 0;
  transition: width .35s cubic-bezier(.4,0,.2,1), opacity .4s;
  pointer-events: none;
}
#nbar.active { opacity: 1; }

/* ── Page preloader (full-screen, fades out) ── */
#page-loader {
  position: fixed; inset: 0; z-index: 99998;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .35s ease, visibility .35s ease;
}
#page-loader.hide { opacity: 0; visibility: hidden; }
#page-loader .pl-ring {
  width: 44px; height: 44px;
  border: 3.5px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: pl-spin .7s linear infinite;
}
@keyframes pl-spin { to { transform: rotate(360deg); } }

/* ── Form submit overlay ── */
#submit-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(15, 23, 42, .48);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
  backdrop-filter: blur(2px);
}
#submit-overlay.show { opacity: 1; pointer-events: all; }
#submit-overlay .so-box {
  background: #fff; border-radius: 16px;
  padding: 2rem 2.5rem;
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
  animation: so-pop .22s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes so-pop {
  from { transform: scale(.88); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
#submit-overlay .so-spinner {
  width: 38px; height: 38px;
  border: 3px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: pl-spin .7s linear infinite;
}
#submit-overlay .so-label {
  font-size: .9rem; font-weight: 600; color: #0f172a;
  font-family: 'Inter', sans-serif;
}

/* ── Card entrance animation ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .32s ease both; }

/* ── Staggered children (add .stagger to parent) ── */
.stagger > *:nth-child(1) { animation: fadeUp .3s ease .04s both; }
.stagger > *:nth-child(2) { animation: fadeUp .3s ease .1s both; }
.stagger > *:nth-child(3) { animation: fadeUp .3s ease .16s both; }
.stagger > *:nth-child(4) { animation: fadeUp .3s ease .22s both; }
.stagger > *:nth-child(5) { animation: fadeUp .3s ease .28s both; }
.stagger > *:nth-child(6) { animation: fadeUp .3s ease .34s both; }

/* ── Sidebar link transition polish ── */
.nav-link { transition: background .18s ease, color .18s ease, transform .12s ease; }
.nav-link:hover { transform: translateX(2px); }
.nav-link.active { transform: none; }

/* ── Skeleton shimmer (for deferred content) ── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 6px;
}

/* ── Stat card counter animation helper ── */
@keyframes countUp {
  from { opacity: 0; transform: translateY(6px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.stat-val-anim { animation: countUp .4s cubic-bezier(.34,1.56,.64,1) .15s both; }

/* ── Button loading state ── */
.btn-spin { pointer-events: none; opacity: .75; }
.btn-spin::after {
  content: '';
  display: inline-block; width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: pl-spin .6s linear infinite;
  margin-left: .5rem; vertical-align: middle;
}
