/* ==========================================================================
   Animations & Transitions - Peak Learning AQ Profile®
   ========================================================================== */

/* Core animation keyframes */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 8px 25px rgba(30, 144, 255, 0.4);
  }
  50% {
    box-shadow: 0 8px 25px rgba(30, 144, 255, 0.7);
  }
}

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

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

/* Loading screen animations */
.loading-container {
  text-align: center;
  color: white;
  animation: fadeIn 1s ease-out;
}

.loading-logo {
  margin-bottom: 40px;
  animation: logoFloat 3s ease-in-out infinite;
}

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

@keyframes loadingFadeIn {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(30px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0px);
  }
}

/* Loading text animation */
.loading-text {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.loading-dots::after {
  content: '...';
  animation: dots 1.5s steps(3, end) infinite;
}

@keyframes dots {
  0%, 20% {
    content: '.';
  }
  40% {
    content: '..';
  }
  60%, 100% {
    content: '...';
  }
}

/* 3D Loading rings */
.loader-3d {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 40px;
  transform-style: preserve-3d;
  perspective: 1000px;
}

.ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 3px solid transparent;
  border-radius: 50%;
  transform-style: preserve-3d;
}

.ring1 {
  border-top-color: #1e90ff;
  animation: ring1Rotate 3s linear infinite;
}

.ring2 {
  border-right-color: #4169e1;
  animation: ring2Rotate 4s linear infinite;
}

.ring3 {
  border-bottom-color: #6495ed;
  animation: ring3Rotate 5s linear infinite;
}

.center-sphere {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 1), rgba(147, 197, 253, 0.8));
  box-shadow:
    0 0 20px rgba(255, 255, 255, 0.8),
    inset -3px -3px 6px rgba(0, 0, 0, 0.1),
    inset 3px 3px 6px rgba(255, 255, 255, 0.3);
  animation: spherePulse 1.5s ease-in-out infinite alternate;
}

/* 3D Ring Animations */
@keyframes ring1Rotate {
  0% {
    transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
  }
  100% {
    transform: rotateX(0deg) rotateY(360deg) rotateZ(0deg);
  }
}

@keyframes ring2Rotate {
  0% {
    transform: rotateX(60deg) rotateY(0deg) rotateZ(0deg);
  }
  100% {
    transform: rotateX(60deg) rotateY(-360deg) rotateZ(0deg);
  }
}

@keyframes ring3Rotate {
  0% {
    transform: rotateX(120deg) rotateY(0deg) rotateZ(0deg);
  }
  100% {
    transform: rotateX(120deg) rotateY(360deg) rotateZ(0deg);
  }
}

@keyframes spherePulse {
  0% {
    transform: scale(1);
    box-shadow:
      0 0 20px rgba(255, 255, 255, 0.8),
      inset -3px -3px 6px rgba(0, 0, 0, 0.1),
      inset 3px 3px 6px rgba(255, 255, 255, 0.3);
  }
  100% {
    transform: scale(1.3);
    box-shadow:
      0 0 40px rgba(255, 255, 255, 1),
      inset -3px -3px 6px rgba(0, 0, 0, 0.1),
      inset 3px 3px 6px rgba(255, 255, 255, 0.5);
  }
}

/* Utility animation classes */
.animate-fade-in {
  animation: fadeIn 0.6s ease-out;
}

.animate-slide-in-left {
  animation: slideInLeft 0.6s ease-out;
}

.animate-slide-in-right {
  animation: slideInRight 0.6s ease-out;
}

.animate-scale-in {
  animation: scaleIn 0.6s ease-out;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-glow {
  animation: glow 2s ease-in-out infinite;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

/* Stagger animations for lists */
.stagger-item {
  opacity: 0;
  animation: fadeIn 0.6s ease-out forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.1s; }
.stagger-item:nth-child(2) { animation-delay: 0.2s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.4s; }
.stagger-item:nth-child(5) { animation-delay: 0.5s; }
.stagger-item:nth-child(6) { animation-delay: 0.6s; }
.stagger-item:nth-child(7) { animation-delay: 0.7s; }
.stagger-item:nth-child(8) { animation-delay: 0.8s; }
.stagger-item:nth-child(9) { animation-delay: 0.9s; }
.stagger-item:nth-child(10) { animation-delay: 1.0s; }

/* Hover animations */
.hover-lift {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
  transform: translateY(-4px);
}

.hover-scale {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-scale:hover {
  transform: scale(1.05);
}

/* Loading states */
.loading-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Performance optimized animations */
.gpu-accelerated {
  transform: translateZ(0);
  will-change: transform, opacity;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}