/* ===== Fade In Animation ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.6s var(--ease-out) forwards;
}

/* ===== Fade In Up (Staggered) ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.8s var(--ease-out) forwards;
}

/* Stagger delays for lists */
.animate-stagger:nth-child(1) { animation-delay: 0.1s; }
.animate-stagger:nth-child(2) { animation-delay: 0.2s; }
.animate-stagger:nth-child(3) { animation-delay: 0.3s; }
.animate-stagger:nth-child(4) { animation-delay: 0.4s; }
.animate-stagger:nth-child(5) { animation-delay: 0.5s; }
.animate-stagger:nth-child(6) { animation-delay: 0.6s; }
.animate-stagger:nth-child(7) { animation-delay: 0.7s; }
.animate-stagger:nth-child(8) { animation-delay: 0.8s; }

/* ===== Pulse Animation (for CTA buttons) ===== */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: var(--shadow-raised), var(--shadow-glow-primary);
  }
  50% {
    transform: scale(1.02);
    box-shadow: var(--shadow-raised-hover), var(--shadow-glow-primary), 0 0 40px rgba(74, 158, 255, 0.4);
  }
}

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

/* ===== Float Animation (for icons) ===== */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

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

/* ===== Gradient Shift (for hero background) ===== */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.animate-gradient {
  background-size: 200% 200%;
  animation: gradientShift 15s ease infinite;
}

/* ===== Glow Pulse (for primary elements) ===== */
@keyframes glowPulse {
  0%, 100% {
    box-shadow: var(--shadow-raised), 0 0 20px rgba(74, 158, 255, 0.3);
  }
  50% {
    box-shadow: var(--shadow-raised), 0 0 40px rgba(74, 158, 255, 0.6);
  }
}

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

/* ===== Rotate (for loading/spinner) ===== */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

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

/* ===== Scale In ===== */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-scale-in {
  animation: scaleIn 0.4s var(--ease-out) forwards;
}

/* ===== Slide In from Left ===== */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* ===== Slide In from Right ===== */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* ===== Bounce ===== */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-15px);
  }
}

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

/* ===== Shimmer (for loading states) ===== */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.animate-shimmer {
  background: linear-gradient(
    90deg,
    var(--color-surface) 0%,
    var(--color-surface-raised) 50%,
    var(--color-surface) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* ===== Shake (for error states) ===== */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

.animate-shake {
  animation: shake 0.5s ease;
}

/* ===== Intersection Observer Trigger Classes ===== */
/* These classes will be added by JavaScript when elements come into view */

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s var(--ease-out);
}

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

.reveal-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: all 0.8s var(--ease-out);
}

.reveal-left.active {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(50px);
  transition: all 0.8s var(--ease-out);
}

.reveal-right.active {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.6s var(--ease-out);
}

.reveal-scale.active {
  opacity: 1;
  transform: scale(1);
}

/* ===== Hover Effects ===== */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

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

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

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

/* ===== Button Click Effect ===== */
.btn-click-effect {
  position: relative;
  overflow: hidden;
}

.btn-click-effect::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-click-effect:active::after {
  width: 300px;
  height: 300px;
}

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

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

/* ===== Page Transition ===== */
@keyframes pageSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-enter {
  animation: pageSlideIn 0.6s var(--ease-out);
}

/* ===== Scroll Progress Indicator ===== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  z-index: var(--z-fixed);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.1s ease;
}

/* ===== Reduced Motion Overrides ===== */
@media (prefers-reduced-motion: reduce) {
  .animate-fade-in,
  .animate-fade-in-up,
  .animate-pulse,
  .animate-float,
  .animate-gradient,
  .animate-glow,
  .animate-rotate,
  .animate-scale-in,
  .animate-slide-in-left,
  .animate-slide-in-right,
  .animate-bounce,
  .animate-shimmer,
  .animate-shake,
  .page-enter {
    animation: none !important;
  }

  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hover-lift:hover {
    transform: none;
  }
}
