/* ============================================
   LOADING STATES
   Mobile-First Loading Components
   ============================================ */

/* Spinner */
.spinner {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--gray-300);
  border-top-color: var(--primary);
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
}

.spinner-sm {
  width: 1rem;
  height: 1rem;
  border-width: 1.5px;
}

.spinner-lg {
  width: 2.5rem;
  height: 2.5rem;
  border-width: 3px;
}

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

/* Spinner Colors */
.spinner-primary {
  border-top-color: var(--primary);
}

.spinner-secondary {
  border-top-color: var(--secondary);
}

.spinner-white {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: var(--white);
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  backdrop-filter: blur(4px);
}

.loading-overlay-content {
  background-color: var(--bg-primary);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  min-width: 200px;
}

.loading-overlay-text {
  font-size: var(--text-base);
  color: var(--text-secondary);
  text-align: center;
}

/* Skeleton Loader */
.skeleton {
  background: linear-gradient(90deg,
      var(--gray-200) 25%,
      var(--gray-100) 50%,
      var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 1em;
  margin-bottom: var(--space-2);
}

.skeleton-text:last-child {
  margin-bottom: 0;
}

.skeleton-text-sm {
  width: 60%;
}

.skeleton-text-md {
  width: 80%;
}

.skeleton-text-lg {
  width: 100%;
}

.skeleton-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-full);
}

.skeleton-image {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-lg);
}

.skeleton-card {
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
}

.skeleton-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.skeleton-card-body {
  margin-bottom: var(--space-4);
}

.skeleton-card-footer {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
}

/* Pulse Animation */
.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* Loading Dots */
.loading-dots {
  display: inline-flex;
  gap: var(--space-1);
  align-items: center;
}

.loading-dot {
  width: 0.5rem;
  height: 0.5rem;
  background-color: var(--primary);
  border-radius: var(--radius-full);
  animation: loading-dot 1.4s ease-in-out infinite both;
}

.loading-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes loading-dot {

  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0.5;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Page Loader */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  z-index: var(--z-modal);
}

.page-loader-logo {
  width: 4rem;
  height: 4rem;
  animation: pulse 2s ease-in-out infinite;
}

.page-loader-text {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  font-weight: var(--font-medium);
}

/* Inline Loader */
.inline-loader {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

/* Progress Bar */
.progress {
  width: 100%;
  height: 0.5rem;
  background-color: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background-color: var(--primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
  animation: progress-shimmer 2s ease-in-out infinite;
}

@keyframes progress-shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.progress-bar-indeterminate {
  width: 30%;
  animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(400%);
  }
}

/* Loading States for Cards */
.card-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.card-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2rem;
  height: 2rem;
  margin-top: -1rem;
  margin-left: -1rem;
  border: 3px solid var(--primary);
  border-top-color: transparent;
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
}

/* ============================================
   PREMIUM LOADING ENHANCEMENTS
   Phase 4: Delight - Gold Shimmer & Progressive Reveal
   ============================================ */

/* Premium Skeleton with Gold Shimmer */
.skeleton-gold {
  position: relative;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.skeleton-gold::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg,
      transparent,
      rgba(212, 175, 55, 0.1),
      transparent);
  animation: skeleton-gold-shimmer 1.8s ease-in-out infinite;
}

@keyframes skeleton-gold-shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

/* Skeleton Variants */
.skeleton-gold.skeleton-text {
  height: 1em;
  width: 100%;
}

.skeleton-gold.skeleton-heading {
  height: 1.5em;
  width: 60%;
}

.skeleton-gold.skeleton-paragraph {
  height: 4em;
  width: 100%;
}

.skeleton-gold.skeleton-button {
  height: 44px;
  width: 120px;
  border-radius: var(--radius-lg);
}

.skeleton-gold.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
}

.skeleton-gold.skeleton-thumbnail {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius-lg);
}

/* Premium Skeleton Card */
.skeleton-card-premium {
  padding: var(--space-6);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
}

.skeleton-card-premium .skeleton-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.skeleton-card-premium .skeleton-row:last-child {
  margin-bottom: 0;
}

/* Progressive Content Reveal */
.progressive-reveal {
  opacity: 0;
  transform: translateY(10px);
  animation: progressive-reveal 0.4s ease-out forwards;
}

.progressive-reveal:nth-child(1) {
  animation-delay: 0s;
}

.progressive-reveal:nth-child(2) {
  animation-delay: 0.1s;
}

.progressive-reveal:nth-child(3) {
  animation-delay: 0.2s;
}

.progressive-reveal:nth-child(4) {
  animation-delay: 0.3s;
}

.progressive-reveal:nth-child(5) {
  animation-delay: 0.4s;
}

@keyframes progressive-reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Premium Spinner */
.spinner-gold {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid rgba(212, 175, 55, 0.2);
  border-top-color: var(--luxury-gold-500);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

.spinner-gold-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.spinner-gold-lg {
  width: 48px;
  height: 48px;
  border-width: 4px;
}

/* Animated Gold Progress Bar */
.progress-gold {
  width: 100%;
  height: 6px;
  background: rgba(212, 175, 55, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-gold-bar {
  height: 100%;
  background: var(--gold-gradient-primary);
  border-radius: var(--radius-full);
  transition: width 0.3s var(--luxury-transition-smooth);
  position: relative;
}

.progress-gold-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.3),
      transparent);
  animation: progress-shine 1.5s ease-in-out infinite;
}

@keyframes progress-shine {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

/* Circular Progress */
.circular-progress {
  width: 60px;
  height: 60px;
  position: relative;
}

.circular-progress-ring {
  fill: none;
  stroke: rgba(212, 175, 55, 0.1);
  stroke-width: 4;
}

.circular-progress-value {
  fill: none;
  stroke: var(--luxury-gold-500);
  stroke-width: 4;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dasharray 0.3s ease;
}

.circular-progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

/* Loading State Overlay Premium */
.loading-overlay-premium {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  background: rgba(11, 11, 12, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: inherit;
  z-index: 10;
}

.loading-overlay-premium .loading-text {
  font-size: var(--text-sm);
  color: var(--luxury-gold-400);
  font-weight: var(--font-medium);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {

  .skeleton-gold::after,
  .progress-gold-bar::after,
  .progressive-reveal {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}