/* Animations & Transitions */

/* Keyframe Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

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

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

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

@keyframes slideInUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes slideInDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

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

@keyframes scaleInBounce {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

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

@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
    transform: translate3d(0,0,0);
  }
  40%, 43% {
    animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
    transform: translate3d(0, -30px, 0);
  }
  70% {
    animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
    transform: translate3d(0, -15px, 0);
  }
  90% {
    transform: translate3d(0,-4px,0);
  }
}

@keyframes shake {
  10%, 90% {
    transform: translate3d(-1px, 0, 0);
  }
  20%, 80% {
    transform: translate3d(2px, 0, 0);
  }
  30%, 50%, 70% {
    transform: translate3d(-4px, 0, 0);
  }
  40%, 60% {
    transform: translate3d(4px, 0, 0);
  }
}

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

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.6);
  }
}

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

@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink {
  50% {
    border-color: transparent;
  }
}

/* Particle Animation */
@keyframes particle-float {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0.3;
  }
  33% {
    transform: translate(30px, -30px) rotate(120deg);
    opacity: 0.8;
  }
  66% {
    transform: translate(-20px, 20px) rotate(240deg);
    opacity: 0.5;
  }
}

@keyframes grid-pulse {
  0%, 100% {
    opacity: 0.1;
  }
  50% {
    opacity: 0.3;
  }
}

/* Scroll Animation */
@keyframes scroll-indicator {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(20px);
    opacity: 0;
  }
}

/* Loading Animations */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

/* Animation Classes */
.animate-fade-in {
  animation: fadeIn var(--duration-base) var(--ease-out);
}

.animate-fade-in-up {
  animation: fadeInUp var(--duration-base) var(--ease-out);
}

.animate-fade-in-down {
  animation: fadeInDown var(--duration-base) var(--ease-out);
}

.animate-fade-in-left {
  animation: fadeInLeft var(--duration-base) var(--ease-out);
}

.animate-fade-in-right {
  animation: fadeInRight var(--duration-base) var(--ease-out);
}

.animate-slide-in-up {
  animation: slideInUp var(--duration-slow) var(--ease-out);
}

.animate-slide-in-down {
  animation: slideInDown var(--duration-slow) var(--ease-out);
}

.animate-scale-in {
  animation: scaleIn var(--duration-base) var(--ease-out);
}

.animate-scale-in-bounce {
  animation: scaleInBounce var(--duration-slower) var(--ease-bounce);
}

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

.animate-bounce {
  animation: bounce 1s infinite;
}

.animate-shake {
  animation: shake var(--duration-slower) var(--ease-in-out);
}

.animate-rotate {
  animation: rotate 1s linear infinite;
}

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

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

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Staggered Animations */
.stagger-fade-in > *:nth-child(1) { animation-delay: 0ms; }
.stagger-fade-in > *:nth-child(2) { animation-delay: 100ms; }
.stagger-fade-in > *:nth-child(3) { animation-delay: 200ms; }
.stagger-fade-in > *:nth-child(4) { animation-delay: 300ms; }
.stagger-fade-in > *:nth-child(5) { animation-delay: 400ms; }
.stagger-fade-in > *:nth-child(6) { animation-delay: 500ms; }

.stagger-fade-in > * {
  animation: fadeInUp var(--duration-base) var(--ease-out) both;
}

/* Intersection Observer Animations */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: all var(--duration-slow) var(--ease-out);
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.animate-on-scroll-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: all var(--duration-slow) var(--ease-out);
}

.animate-on-scroll-left.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.animate-on-scroll-right {
  opacity: 0;
  transform: translateX(30px);
  transition: all var(--duration-slow) var(--ease-out);
}

.animate-on-scroll-right.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.animate-on-scroll-scale {
  opacity: 0;
  transform: scale(0.8);
  transition: all var(--duration-slow) var(--ease-out);
}

.animate-on-scroll-scale.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* Hover Animations */
.hover-lift {
  transition: transform var(--transition-base);
}

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

.hover-scale {
  transition: transform var(--transition-base);
}

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

.hover-rotate {
  transition: transform var(--transition-base);
}

.hover-rotate:hover {
  transform: rotate(5deg);
}

.hover-glow {
  transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
  box-shadow: var(--shadow-glow);
}

/* Loading States */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
  100% {
    left: 100%;
  }
}

.loading-dots {
  display: inline-flex;
  gap: var(--space-1);
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  animation: loading-dots 1.4s infinite ease-in-out both;
}

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

/* Parallax */
.parallax {
  transform: translateZ(0);
  transition: transform 0.1s ease-out;
}

/* Smooth Scrolling */
.smooth-scroll {
  scroll-behavior: smooth;
}

/* Page Transitions */
.page-transition-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-transition-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.page-transition-exit {
  opacity: 1;
  transform: translateY(0);
}

.page-transition-exit-active {
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity var(--duration-base) var(--ease-in),
              transform var(--duration-base) var(--ease-in);
}

/* Responsive Animations */
@media (max-width: 768px) {
  .animate-on-scroll,
  .animate-on-scroll-left,
  .animate-on-scroll-right,
  .animate-on-scroll-scale {
    transform: none;
    opacity: 1;
  }
  
  .hover-lift:hover,
  .hover-scale:hover,
  .hover-rotate:hover {
    transform: none;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .animate-pulse,
  .animate-bounce,
  .animate-rotate,
  .animate-glow,
  .animate-float,
  .animate-spin {
    animation: none;
  }
  
  .loading::after {
    animation: none;
  }
  
  .loading-dots span {
    animation: none;
  }
  
  .parallax {
    transform: none !important;
  }
}

/* High Performance Mode */
@media (prefers-reduced-data: reduce) {
  .animate-glow,
  .animate-pulse,
  .loading::after {
    display: none;
  }
  
  .hover-glow:hover {
    box-shadow: none;
  }
}