/* ============================================
   COMPREHENSIVE LOADING STATES SYSTEM
   Unique, context-aware loading indicators
   ============================================ */

/* ==========================================
   1. FORM SUBMISSION LOADERS
   ========================================== */

/* Paper Plane (Contact Forms) */
.loader-paper-plane {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.loader-paper-plane svg {
  animation: paperPlane 2s ease-in-out infinite;
}

@keyframes paperPlane {
  0%, 100% {
    transform: translateX(0) translateY(0) rotate(0deg);
  }
  25% {
    transform: translateX(10px) translateY(-5px) rotate(5deg);
  }
  50% {
    transform: translateX(20px) translateY(-2px) rotate(0deg);
  }
  75% {
    transform: translateX(10px) translateY(2px) rotate(-3deg);
  }
}

/* ==========================================
   2. AUTHENTICATION LOADERS
   ========================================== */

/* Shield Lock (Login/Register) */
.loader-shield {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
}

.loader-shield-icon {
  animation: shieldPulse 1.5s ease-in-out infinite;
}

.loader-shield-lock {
  animation: lockBounce 1s ease-in-out infinite;
  transform-origin: center;
}

@keyframes shieldPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.8;
  }
}

@keyframes lockBounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

/* ==========================================
   3. DATA PROCESSING LOADERS
   ========================================== */

/* Circuit Board (Data Processing) */
.loader-circuit {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.loader-circuit-pulse {
  position: relative;
  width: 24px;
  height: 24px;
}

.circuit-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  animation: circuitPulse 1.5s ease-in-out infinite;
}

.circuit-dot:nth-child(1) { top: 0; left: 0; animation-delay: 0s; }
.circuit-dot:nth-child(2) { top: 0; right: 0; animation-delay: 0.2s; }
.circuit-dot:nth-child(3) { bottom: 0; right: 0; animation-delay: 0.4s; }
.circuit-dot:nth-child(4) { bottom: 0; left: 0; animation-delay: 0.6s; }

@keyframes circuitPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.5);
    opacity: 1;
  }
}

/* ==========================================
   4. FILE UPLOAD LOADERS
   ========================================== */

/* Upload Cloud (File Uploads) */
.loader-upload {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.loader-upload-cloud {
  animation: cloudFloat 2s ease-in-out infinite;
}

.loader-upload-arrow {
  animation: arrowUp 1s ease-in-out infinite;
}

@keyframes cloudFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@keyframes arrowUp {
  0%, 100% {
    transform: translateY(3px);
    opacity: 0.3;
  }
  50% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

/* ==========================================
   5. PAGE TRANSITION LOADERS
   ========================================== */

/* Dots Wave (Page Loading) */
.loader-dots-wave {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.dot-wave {
  width: 10px;
  height: 10px;
  background: currentColor;
  border-radius: 50%;
  animation: dotWave 1.4s ease-in-out infinite;
}

.dot-wave:nth-child(1) { animation-delay: 0s; }
.dot-wave:nth-child(2) { animation-delay: 0.2s; }
.dot-wave:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotWave {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-15px);
    opacity: 1;
  }
}

/* ==========================================
   6. SEARCH/FILTER LOADERS
   ========================================== */

/* Magnifying Glass (Search) */
.loader-search {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.loader-search-icon {
  animation: searchSpin 2s linear infinite;
  transform-origin: center;
}

@keyframes searchSpin {
  0% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(180deg) scale(1.1);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ==========================================
   7. SAVE/UPDATE LOADERS
   ========================================== */

/* Checkmark Tick (Saving) */
.loader-save {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.loader-save-circle {
  animation: saveRotate 1.5s linear infinite;
}

.loader-save-check {
  animation: checkPulse 1.5s ease-in-out infinite;
}

@keyframes saveRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes checkPulse {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

/* ==========================================
   8. DELETE/REMOVE LOADERS
   ========================================== */

/* Trash Bin (Deleting) */
.loader-delete {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.loader-delete-icon {
  animation: trashShake 0.5s ease-in-out infinite;
}

@keyframes trashShake {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-5deg);
  }
  75% {
    transform: rotate(5deg);
  }
}

/* ==========================================
   9. AI/PROCESSING LOADERS
   ========================================== */

/* Brain/AI Processing */
.loader-ai {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.loader-ai-brain {
  animation: brainPulse 2s ease-in-out infinite;
}

.ai-synapse {
  animation: synapseFire 1s ease-in-out infinite;
}

.ai-synapse:nth-child(1) { animation-delay: 0s; }
.ai-synapse:nth-child(2) { animation-delay: 0.3s; }
.ai-synapse:nth-child(3) { animation-delay: 0.6s; }

@keyframes brainPulse {
  0%, 100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.1);
    filter: brightness(1.2);
  }
}

@keyframes synapseFire {
  0%, 100% {
    opacity: 0.2;
  }
  50% {
    opacity: 1;
  }
}

/* ==========================================
   10. DOWNLOAD LOADERS
   ========================================== */

/* Download Arrow (Downloads) */
.loader-download {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.loader-download-arrow {
  animation: downloadBounce 1.5s ease-in-out infinite;
}

@keyframes downloadBounce {
  0%, 100% {
    transform: translateY(-5px);
    opacity: 0.5;
  }
  50% {
    transform: translateY(5px);
    opacity: 1;
  }
}

/* ==========================================
   11. REFRESH/SYNC LOADERS
   ========================================== */

/* Circular Arrows (Syncing) */
.loader-sync {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.loader-sync-icon {
  animation: syncRotate 1.5s linear infinite;
  transform-origin: center;
}

@keyframes syncRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ==========================================
   12. NETWORK/API LOADERS
   ========================================== */

/* Signal Waves (Network) */
.loader-network {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.network-bar {
  width: 4px;
  height: 20px;
  background: currentColor;
  margin: 0 2px;
  animation: networkPulse 1.2s ease-in-out infinite;
}

.network-bar:nth-child(1) { animation-delay: 0s; height: 10px; }
.network-bar:nth-child(2) { animation-delay: 0.15s; height: 15px; }
.network-bar:nth-child(3) { animation-delay: 0.3s; height: 20px; }
.network-bar:nth-child(4) { animation-delay: 0.45s; height: 15px; }
.network-bar:nth-child(5) { animation-delay: 0.6s; height: 10px; }

@keyframes networkPulse {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

/* ==========================================
   13. DATABASE LOADERS
   ========================================== */

/* Database Cylinder (DB Operations) */
.loader-database {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.loader-database-icon {
  animation: databasePulse 2s ease-in-out infinite;
}

@keyframes databasePulse {
  0%, 100% {
    transform: scaleY(1);
  }
  25% {
    transform: scaleY(1.1);
  }
  50% {
    transform: scaleY(1);
  }
  75% {
    transform: scaleY(0.9);
  }
}

/* ==========================================
   14. ANALYTICS LOADERS
   ========================================== */

/* Bar Chart (Analytics) */
.loader-analytics {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.analytics-bar {
  width: 5px;
  background: currentColor;
  margin: 0 2px;
  animation: analyticsPulse 1.5s ease-in-out infinite;
}

.analytics-bar:nth-child(1) { height: 15px; animation-delay: 0s; }
.analytics-bar:nth-child(2) { height: 25px; animation-delay: 0.2s; }
.analytics-bar:nth-child(3) { height: 20px; animation-delay: 0.4s; }
.analytics-bar:nth-child(4) { height: 30px; animation-delay: 0.6s; }

@keyframes analyticsPulse {
  0%, 100% {
    transform: scaleY(0.5);
    opacity: 0.5;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

/* ==========================================
   15. EMAIL/MESSAGE LOADERS
   ========================================== */

/* Envelope (Sending Email) */
.loader-email {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.loader-email-icon {
  animation: emailFloat 2s ease-in-out infinite;
}

@keyframes emailFloat {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-8px) rotate(2deg);
  }
}

/* ==========================================
   16. SKELETON LOADERS (Content Loading)
   ========================================== */

.skeleton {
  background: linear-gradient(
    90deg,
    hsl(var(--muted)) 0%,
    hsl(var(--muted) / 0.5) 50%,
    hsl(var(--muted)) 100%
  );
  background-size: 200% 100%;
  animation: skeletonWave 1.5s ease-in-out infinite;
  border-radius: 0.375rem;
}

.dark .skeleton {
  background: linear-gradient(
    90deg,
    hsl(var(--dark-surface-2)) 0%,
    hsl(var(--dark-surface-3)) 50%,
    hsl(var(--dark-surface-2)) 100%
  );
  background-size: 200% 100%;
}

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

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-title {
  height: 1.5rem;
  margin-bottom: 1rem;
  width: 60%;
}

.skeleton-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
}

.skeleton-card {
  height: 200px;
  width: 100%;
}

/* ==========================================
   17. RIPPLE LOADERS (General Purpose)
   ========================================== */

.loader-ripple {
  display: inline-flex;
  position: relative;
  width: 24px;
  height: 24px;
}

.ripple-circle {
  position: absolute;
  border: 2px solid currentColor;
  border-radius: 50%;
  animation: rippleExpand 1.5s ease-out infinite;
}

.ripple-circle:nth-child(1) {
  animation-delay: 0s;
}

.ripple-circle:nth-child(2) {
  animation-delay: 0.5s;
}

@keyframes rippleExpand {
  0% {
    width: 0;
    height: 0;
    opacity: 1;
    top: 50%;
    left: 50%;
  }
  100% {
    width: 24px;
    height: 24px;
    opacity: 0;
    top: 0;
    left: 0;
  }
}

/* ==========================================
   18. PROGRESS RING (Determinate Progress)
   ========================================== */

.loader-progress-ring {
  display: inline-flex;
  position: relative;
  width: 40px;
  height: 40px;
}

.progress-ring-circle {
  transform: rotate(-90deg);
  transform-origin: center;
}

.progress-ring-background {
  fill: none;
  stroke: hsl(var(--muted));
  stroke-width: 4;
}

.progress-ring-progress {
  fill: none;
  stroke: hsl(var(--primary));
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s ease;
}

/* ==========================================
   19. SPINNER VARIANTS
   ========================================== */

/* Classic Spinner */
.loader-spinner-classic {
  width: 24px;
  height: 24px;
  border: 3px solid hsl(var(--muted));
  border-top-color: hsl(var(--primary));
  border-radius: 50%;
  animation: spinnerRotate 0.8s linear infinite;
}

/* Dual Ring Spinner */
.loader-spinner-dual {
  width: 24px;
  height: 24px;
  border: 3px solid transparent;
  border-top-color: hsl(var(--primary));
  border-bottom-color: hsl(var(--info));
  border-radius: 50%;
  animation: spinnerRotate 1s linear infinite;
}

/* Gradient Spinner */
.loader-spinner-gradient {
  width: 24px;
  height: 24px;
  border: 3px solid transparent;
  border-radius: 50%;
  background: linear-gradient(hsl(var(--primary)), hsl(var(--info)));
  animation: spinnerRotate 1s linear infinite;
  position: relative;
}

.loader-spinner-gradient::before {
  content: '';
  position: absolute;
  inset: 3px;
  background: hsl(var(--background));
  border-radius: 50%;
}

@keyframes spinnerRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ==========================================
   20. FULL-PAGE OVERLAY LOADER
   ========================================== */

.loader-overlay {
  position: fixed;
  inset: 0;
  background: hsl(var(--background) / 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}

.loader-overlay-content {
  text-align: center;
  padding: 2rem;
}

.dark .loader-overlay {
  background: hsl(var(--dark-surface-1) / 0.9);
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */

.loader-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}

.loader-sm {
  font-size: 0.875rem;
}

.loader-md {
  font-size: 1rem;
}

.loader-lg {
  font-size: 1.25rem;
}

/* Disable interactions during loading */
.loading-state {
  pointer-events: none;
  opacity: 0.6;
  position: relative;
}

/* Loading overlay for containers */
.loading-overlay {
  position: relative;
}

.loading-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: hsl(var(--background) / 0.7);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.dark .loading-overlay::after {
  background: hsl(var(--dark-surface-1) / 0.8);
}
