/**
 * NIOB FCT Web App - Platform Interactive System
 * Features:
 * 1. Ultra-smooth button micro-interactions & universal button loaders
 * 2. Interactive branded page preloader & progress bar
 * 3. Bank-grade high-trust payment gateway loader
 */

/* ══════════════════════════════════════════════════════════════════════
   1. UNIVERSAL SMOOTH BUTTONS & MICRO-INTERACTIONS
   ══════════════════════════════════════════════════════════════════════ */

button,
.btn,
.btn-cta,
.gold,
.mbr-nav-btn,
.mbr-bottom-btn,
.mbr-evt-refresh,
.mbr-mship-refresh,
.mbr-hero-refresh,
.event-reg-back-btn,
input[type="submit"],
input[type="button"] {
  position: relative;
  transition: transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
              background-color 0.2s ease,
              border-color 0.2s ease,
              color 0.2s ease,
              opacity 0.2s ease !important;
  will-change: transform;
}

/* Tactile Active Press */
button:active:not(:disabled):not(.is-loading),
.btn:active:not(:disabled):not(.is-loading),
.btn-cta:active:not(:disabled):not(.is-loading),
.gold:active:not(:disabled):not(.is-loading),
.mbr-evt-refresh:active:not(:disabled):not(.is-loading),
.mbr-mship-refresh:active:not(:disabled):not(.is-loading),
.mbr-hero-refresh:active:not(:disabled):not(.is-loading),
input[type="submit"]:active:not(:disabled):not(.is-loading) {
  transform: scale(0.97) !important;
}

/* Accessible focus ring with brand color */
button:focus-visible,
.btn:focus-visible,
.gold:focus-visible,
input[type="submit"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(7, 88, 58, 0.25), 0 4px 12px rgba(7, 88, 58, 0.12) !important;
}

/* Universal Button Spinner Component */
.btn-spinner,
.niob-btn-spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent !important;
  border-radius: 50%;
  animation: niob-btn-spin 0.65s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
  vertical-align: -2.5px;
  margin-right: 6px;
  flex-shrink: 0;
  box-sizing: border-box;
}

@keyframes niob-btn-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Button Loading State */
button.is-loading,
.btn.is-loading,
.gold.is-loading,
input[type="submit"].is-loading,
[data-loading="true"] {
  pointer-events: none !important;
  cursor: wait !important;
  opacity: 0.88 !important;
  user-select: none !important;
}

/* Animated spinning SVG on refresh buttons when is-loading */
.mbr-evt-refresh.is-loading svg,
.mbr-mship-refresh.is-loading svg,
.mbr-hero-refresh.is-loading svg,
button.is-loading > svg:first-child:last-child {
  animation: niob-btn-spin 0.75s linear infinite !important;
}

/* CSS fallback spinner if .is-loading is added directly without JS helper */
button.is-loading:not(:has(.btn-spinner)):not(:has(svg))::before,
.btn.is-loading:not(:has(.btn-spinner)):not(:has(svg))::before,
.gold.is-loading:not(:has(.btn-spinner)):not(:has(svg))::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent !important;
  border-radius: 50%;
  animation: niob-btn-spin 0.65s linear infinite;
  vertical-align: -2.5px;
  margin-right: 6px;
}

/* Form Submitting State */
form.is-submitting {
  cursor: wait;
}

form.is-submitting button[type="submit"],
form.is-submitting input[type="submit"] {
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════════════
   2. INTERACTIVE BRANDED PAGE PRELOADER & TOP PROGRESS BAR
   ══════════════════════════════════════════════════════════════════════ */

/* Top Slim Gradient Progress Bar */
#niobTopProgressBar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #07583a 0%, #10b981 40%, #f4a300 70%, #10b981 100%);
  background-size: 200% 100%;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.7), 0 0 5px rgba(244, 163, 0, 0.5);
  z-index: 100001;
  pointer-events: none;
  transition: width 0.3s cubic-bezier(0.1, 0.9, 0.2, 1), opacity 0.4s ease;
  animation: niob-bar-shimmer 2s linear infinite;
}

@keyframes niob-bar-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Full-Screen Page Loader Overlay */
#niobPageLoader {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, rgba(7, 88, 58, 0.04) 0%, rgba(255, 255, 255, 0.96) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.42s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
}

#niobPageLoader.is-loaded {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.02);
  pointer-events: none;
}

/* Glassmorphic Central Loader Card */
.niob-loader-card {
  position: relative;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(7, 88, 58, 0.12);
  box-shadow: 0 20px 48px -10px rgba(7, 88, 58, 0.14),
              0 0 0 1px rgba(255, 255, 255, 0.9) inset;
  border-radius: 26px;
  padding: 38px 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  min-width: 290px;
  max-width: 90vw;
  cursor: default;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.35s ease;
}

.niob-loader-card:hover {
  transform: scale(1.03);
  box-shadow: 0 24px 56px -10px rgba(7, 88, 58, 0.2),
              0 0 0 1px rgba(255, 255, 255, 1) inset;
}

/* Emblem Frame & Dual Orbital Rings */
.niob-emblem-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

/* Outer Ring */
.niob-emblem-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2.5px solid transparent;
  border-top-color: #07583a;
  border-right-color: #10b981;
  border-radius: 50%;
  animation: niob-spin-clockwise 1.1s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
}

/* Inner Ring */
.niob-emblem-wrap::after {
  content: '';
  position: absolute;
  inset: 8px;
  border: 2px dashed rgba(244, 163, 0, 0.7);
  border-radius: 50%;
  animation: niob-spin-counter 2.2s linear infinite;
}

/* Center Logo Emblem */
.niob-emblem-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 50%;
  background: #ffffff;
  padding: 5px;
  box-shadow: 0 4px 16px rgba(7, 88, 58, 0.15);
  animation: niob-emblem-pulse 2s ease-in-out infinite;
  z-index: 2;
}

@keyframes niob-spin-clockwise {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes niob-spin-counter {
  0% { transform: rotate(360deg); }
  100% { transform: rotate(0deg); }
}

@keyframes niob-emblem-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Typography in Page Loader */
.niob-loader-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #07583a;
  letter-spacing: -0.015em;
  font-family: inherit;
}

.niob-loader-sub {
  margin: 0;
  font-size: 13px;
  color: #556c60;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Bouncing Status Dots */
.niob-loading-dots {
  display: inline-flex;
  gap: 3px;
  margin-left: 2px;
}

.niob-loading-dots span {
  width: 4px;
  height: 4px;
  background-color: #10b981;
  border-radius: 50%;
  animation: niob-dot-pulse 1.4s infinite ease-in-out both;
}

.niob-loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.niob-loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.niob-loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes niob-dot-pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.2); opacity: 1; }
}

/* ══════════════════════════════════════════════════════════════════════
   3. BANK-GRADE HIGH-TRUST PAYMENT GATEWAY LOADER
   ══════════════════════════════════════════════════════════════════════ */

#niobPaymentGatewayLoader {
  position: fixed;
  inset: 0;
  z-index: 100005;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 26, 18, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity;
}

#niobPaymentGatewayLoader.is-active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

/* High-Security Payment Card */
.niob-pg-card {
  position: relative;
  background: #ffffff;
  border-radius: 24px;
  padding: 36px 32px 30px;
  max-width: 450px;
  width: 92%;
  text-align: center;
  box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.4),
              0 0 0 1px rgba(7, 88, 58, 0.1);
  transform: scale(0.94) translateY(12px);
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

#niobPaymentGatewayLoader.is-active .niob-pg-card {
  transform: scale(1) translateY(0);
}

/* Top decorative security banner */
.niob-pg-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #07583a, #10b981, #f4a300, #10b981);
}

/* Security Shield / Lock Emblem */
.niob-pg-shield-wrap {
  position: relative;
  width: 82px;
  height: 82px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #edf7f1 0%, #e1efe7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 28px rgba(7, 88, 58, 0.16);
}

/* Orbital Radar Ring around Shield */
.niob-pg-shield-wrap::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #10b981;
  border-right-color: #f4a300;
  animation: niob-spin-clockwise 1.3s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
}

.niob-pg-shield-icon {
  width: 42px;
  height: 42px;
  color: #07583a;
  animation: niob-shield-breathe 2.4s ease-in-out infinite;
}

@keyframes niob-shield-breathe {
  0%, 100% { transform: scale(1); color: #07583a; }
  50% { transform: scale(1.06); color: #064a35; }
}

/* Payment Gateway Headline */
.niob-pg-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  color: #0c2b1e;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.niob-pg-sub {
  margin: 0 0 20px;
  font-size: 13.5px;
  color: #556c60;
  line-height: 1.5;
}

/* Partner Gateway Badges */
.niob-pg-partners {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.niob-pg-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #d4e5dc;
  background: #f8fbf9;
  color: #07583a;
}

.niob-pg-badge--paystack {
  color: #00c3f7;
  background: #f0faff;
  border-color: #c7edfd;
}

.niob-pg-badge--budpay {
  color: #ef4444;
  background: #fef2f2;
  border-color: #fecaca;
}

/* 3-Step Live Security Progress Track */
.niob-pg-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f7faf8;
  border: 1px solid #e3ede7;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 20px;
  text-align: left;
}

.niob-pg-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
  color: #647b6f;
  transition: color 0.2s ease;
}

.niob-pg-step.is-done {
  color: #07583a;
  font-weight: 600;
}

.niob-pg-step.is-active {
  color: #07583a;
  font-weight: 600;
}

.niob-pg-step-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  background: #e5ece8;
  color: #7b9487;
  flex-shrink: 0;
  transition: all 0.25s ease;
}

.niob-pg-step.is-done .niob-pg-step-icon {
  background: #10b981;
  color: #ffffff;
}

.niob-pg-step.is-active .niob-pg-step-icon {
  background: #07583a;
  color: #ffffff;
  box-shadow: 0 0 0 3px rgba(7, 88, 58, 0.2);
}

/* Subtle Security Badges Footer */
.niob-pg-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11.5px;
  color: #7c9488;
  border-top: 1px solid #eef3f0;
  padding-top: 16px;
}

.niob-pg-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.niob-pg-badge-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: #4b6657;
}

.niob-pg-reassurance {
  font-style: italic;
  color: #8da397;
  margin: 0;
}

/* ══════════════════════════════════════════════════════════════════════
   4. RESPONSIVE REFINEMENTS
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .niob-loader-card {
    padding: 30px 24px;
    min-width: 0;
    width: 88vw;
  }
  .niob-pg-card {
    padding: 28px 20px 22px;
  }
  .niob-pg-title {
    font-size: 18px;
  }
  .niob-pg-shield-wrap {
    width: 68px;
    height: 68px;
    margin-bottom: 14px;
  }
  .niob-pg-shield-icon {
    width: 34px;
    height: 34px;
  }
}
