/* Material Design 3 Motion & Animations */

/* Ripple Effect */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.3;
  transform: scale(0);
  animation: ripple-animation 0.6s linear;
  pointer-events: none;
}

@keyframes ripple-animation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Fade In Animation */
.fade-in {
  animation: fade-in var(--md-sys-motion-duration-normal) var(--md-sys-motion-easing-decelerate);
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scale In Animation */
.scale-in {
  animation: scale-in var(--md-sys-motion-duration-normal) var(--md-sys-motion-easing-emphasized-decelerate);
}

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

/* Slide In From Bottom */
.slide-in-bottom {
  animation: slide-in-bottom var(--md-sys-motion-duration-normal) var(--md-sys-motion-easing-decelerate);
}

@keyframes slide-in-bottom {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide In From Left */
.slide-in-left {
  animation: slide-in-left var(--md-sys-motion-duration-normal) var(--md-sys-motion-easing-decelerate);
}

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

/* Slide In From Right */
.slide-in-right {
  animation: slide-in-right var(--md-sys-motion-duration-normal) var(--md-sys-motion-easing-decelerate);
}

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

/* Bounce Animation */
.bounce {
  animation: bounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounce {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* Pulse Animation */
.pulse {
  animation: pulse 2s infinite;
}

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

/* Shake Animation */
.shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Spin Animation */
.spin {
  animation: spin 1s linear infinite;
}

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

/* Flip Animation */
.flip {
  animation: flip 0.6s ease-in-out;
}

@keyframes flip {
  0% {
    transform: perspective(400px) rotateY(0);
  }
  100% {
    transform: perspective(400px) rotateY(360deg);
  }
}

/* Number Counter Animation */
.number-counter {
  animation: number-pop 0.3s ease-out;
}

@keyframes number-pop {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Card Hover Lift */
.card-lift {
  transition: transform var(--md-sys-motion-duration-fast) var(--md-sys-motion-easing-standard),
              box-shadow var(--md-sys-motion-duration-fast) var(--md-sys-motion-easing-standard);
}

.card-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--md-sys-elevation-level3);
}

/* Stagger Animation for Lists */
.stagger-item {
  opacity: 0;
  animation: stagger-fade-in 0.4s ease-out forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }
.stagger-item:nth-child(6) { animation-delay: 0.3s; }
.stagger-item:nth-child(7) { animation-delay: 0.35s; }
.stagger-item:nth-child(8) { animation-delay: 0.4s; }
.stagger-item:nth-child(9) { animation-delay: 0.45s; }
.stagger-item:nth-child(10) { animation-delay: 0.5s; }

@keyframes stagger-fade-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Glow Effect */
.glow {
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from {
    box-shadow: 0 0 5px var(--md-sys-color-primary),
                0 0 10px var(--md-sys-color-primary),
                0 0 15px var(--md-sys-color-primary);
  }
  to {
    box-shadow: 0 0 10px var(--md-sys-color-primary),
                0 0 20px var(--md-sys-color-primary),
                0 0 30px var(--md-sys-color-primary);
  }
}

/* Success Animation */
.success-pulse {
  animation: success-pulse 0.6s ease-out;
}

@keyframes success-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 20px rgba(76, 175, 80, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
  }
}

/* Error Shake */
.error-shake {
  animation: error-shake 0.5s ease-in-out;
}

@keyframes error-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-10px); }
  80% { transform: translateX(10px); }
}

/* Loading Dots */
.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  background: currentColor;
  border-radius: 50%;
  animation: loading-dot 1.4s ease-in-out infinite;
}

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

@keyframes loading-dot {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Page Load Animation */
.page-load > * {
  opacity: 0;
  animation: page-load-fade 0.5s ease-out forwards;
}

.page-load > *:nth-child(1) { animation-delay: 0.1s; }
.page-load > *:nth-child(2) { animation-delay: 0.2s; }
.page-load > *:nth-child(3) { animation-delay: 0.3s; }
.page-load > *:nth-child(4) { animation-delay: 0.4s; }
.page-load > *:nth-child(5) { animation-delay: 0.5s; }

@keyframes page-load-fade {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scroll Reveal Animation */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--md-sys-motion-duration-slow) var(--md-sys-motion-easing-decelerate),
              transform var(--md-sys-motion-duration-slow) var(--md-sys-motion-easing-decelerate);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Material Design 3 Container Transform */
.container-transform {
  transition: transform var(--md-sys-motion-duration-slow) var(--md-sys-motion-easing-emphasized),
              border-radius var(--md-sys-motion-duration-slow) var(--md-sys-motion-easing-emphasized);
}

/* Hover Scale Effect */
.hover-scale {
  transition: transform var(--md-sys-motion-duration-fast) var(--md-sys-motion-easing-standard);
}

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

/* Press Effect */
.press-effect:active {
  transform: scale(0.98);
}

/* Focus Ring */
.focus-ring:focus-visible {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

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