/* ==========================================================================
   SKB FORUM & DIGITAL ASSET PLATFORM - PRELOADERS & SKELETON ANIMATIONS
   ========================================================================== */

/* 1. Top AJAX Page Transition Bar */
#top-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--warning));
  z-index: 9999;
  transition: width 0.3s ease, opacity 0.4s ease;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
  opacity: 0;
  pointer-events: none;
}

#top-progress-bar.active {
  opacity: 1;
}

/* 2. Global Overlay Spinner / Preloader */
.global-preloader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s ease;
}

.global-preloader-overlay.show {
  opacity: 1;
  visibility: visible;
}

.preloader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 34px 38px 30px;
  border-radius: 20px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.2);
  max-width: 400px;
  width: calc(100% - 40px);
  text-align: center;
  transform: scale(0.92) translateY(8px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.global-preloader-overlay.show .preloader-card {
  transform: scale(1) translateY(0);
  opacity: 1;
}

#overlay-preloader-text {
  margin-top: 18px;
  font-weight: 700;
  color: #0f172a;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  line-height: 1.45;
}

/* 3. Spinner Variants */
.skb-spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3.5px solid #e2e8f0;
  border-top-color: var(--primary, #2563eb);
  border-right-color: #3b82f6;
  animation: skbSpin 0.75s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  box-shadow: 0 0 16px rgba(37, 99, 235, 0.16);
}

.skb-spinner-sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
  border-top-color: currentColor;
}

.skb-spinner-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
}

.skb-spinner-dots span {
  width: 6px;
  height: 6px;
  background-color: var(--primary, #2563eb);
  border-radius: 50%;
  animation: skbBounce 1.2s infinite ease-in-out both;
}

.skb-spinner-dots span:nth-child(1) { animation-delay: -0.32s; }
.skb-spinner-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes skbSpin {
  to { transform: rotate(360deg); }
}

@keyframes skbBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* 4. Skeleton Shimmer Loaders */
.skeleton {
  background: linear-gradient(
    90deg,
    #f1f5f9 0%,
    #e2e8f0 50%,
    #f1f5f9 100%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite linear;
  border-radius: var(--radius-sm);
  display: inline-block;
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 14px;
  width: 100%;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-text.heading {
  height: 22px;
  width: 60%;
  margin-bottom: 12px;
}

.skeleton-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.skeleton-badge {
  width: 60px;
  height: 20px;
  border-radius: var(--radius-full);
}

.skeleton-button {
  width: 120px;
  height: 38px;
  border-radius: var(--radius-md);
}

.skeleton-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}

/* 5. In-Container Loading State */
.loading-container {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  color: var(--text-muted);
}
