/* ==========================================
   Keyframe Animations
   ========================================== */

/* Fade In */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

/* Fade In Down */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In Left */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Fade In Right */
@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Zoom In */
@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Slide In Up */
@keyframes slideInUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Slide In Down */
@keyframes slideInDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Bounce */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-20px);
  }
  60% {
    transform: translateY(-10px);
  }
}

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

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

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

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

/* Glow */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px var(--accent-primary), 0 0 10px var(--accent-primary);
  }
  50% {
    box-shadow: 0 0 20px var(--accent-primary), 0 0 30px var(--accent-primary);
  }
}

/* Gradient Animation */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Ripple Effect */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

/* Typing Cursor */
@keyframes blink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}

/* Wave */
@keyframes wave {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-10px) rotate(5deg);
  }
  50% {
    transform: translateY(0) rotate(0deg);
  }
  75% {
    transform: translateY(-10px) rotate(-5deg);
  }
}

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

/* Swing */
@keyframes swing {
  20% {
    transform: rotate(15deg);
  }
  40% {
    transform: rotate(-10deg);
  }
  60% {
    transform: rotate(5deg);
  }
  80% {
    transform: rotate(-5deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

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

/* Scale Bounce */
@keyframes scaleBounce {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* Flip In X */
@keyframes flipInX {
  from {
    transform: perspective(400px) rotateX(-90deg);
    opacity: 0;
  }
  to {
    transform: perspective(400px) rotateX(0deg);
    opacity: 1;
  }
}

/* Flip In Y */
@keyframes flipInY {
  from {
    transform: perspective(400px) rotateY(-90deg);
    opacity: 0;
  }
  to {
    transform: perspective(400px) rotateY(0deg);
    opacity: 1;
  }
}

/* Light Speed In */
@keyframes lightSpeedIn {
  from {
    transform: translateX(100%) skewX(-30deg);
    opacity: 0;
  }
  60% {
    transform: skewX(20deg);
    opacity: 1;
  }
  80% {
    transform: skewX(-5deg);
  }
  to {
    transform: translateX(0);
  }
}

/* Roll In */
@keyframes rollIn {
  from {
    opacity: 0;
    transform: translateX(-100%) rotate(-120deg);
  }
  to {
    opacity: 1;
    transform: translateX(0) rotate(0deg);
  }
}

/* ==========================================
   Animation Classes
   ========================================== */

.fade-in {
  animation: fadeIn 1s ease-out;
}

.fade-in-up {
  animation: fadeInUp 0.8s ease-out;
}

.fade-in-down {
  animation: fadeInDown 0.8s ease-out;
}

.fade-in-left {
  animation: fadeInLeft 0.8s ease-out;
}

.fade-in-right {
  animation: fadeInRight 0.8s ease-out;
}

.zoom-in-animation {
  animation: zoomIn 0.8s ease-out;
}

.slide-in-up {
  animation: slideInUp 0.8s ease-out;
}

.slide-in-down {
  animation: slideInDown 0.8s ease-out;
}

.bounce-animation {
  animation: bounce 2s infinite;
}

.pulse-animation {
  animation: pulse 2s infinite;
}

.shake-animation {
  animation: shake 0.5s ease-in-out;
}

.rotate-animation {
  animation: rotate 2s linear infinite;
}

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

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

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

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

.flip-animation {
  animation: flip 1s ease-in-out;
}

.swing-animation {
  animation: swing 1s ease-in-out;
}

.scale-bounce {
  animation: scaleBounce 0.6s ease-out;
}

.flip-in-x {
  animation: flipInX 0.8s ease-out;
}

.flip-in-y {
  animation: flipInY 0.8s ease-out;
}

.light-speed-in {
  animation: lightSpeedIn 0.8s ease-out;
}

.roll-in {
  animation: rollIn 0.8s ease-out;
}

/* ==========================================
   Staggered Animations
   ========================================== */

.stagger-delay-1 {
  animation-delay: 0.1s;
}

.stagger-delay-2 {
  animation-delay: 0.2s;
}

.stagger-delay-3 {
  animation-delay: 0.3s;
}

.stagger-delay-4 {
  animation-delay: 0.4s;
}

.stagger-delay-5 {
  animation-delay: 0.5s;
}

.stagger-delay-6 {
  animation-delay: 0.6s;
}

/* ==========================================
   Hover Animations
   ========================================== */

.hover-lift:hover {
  transform: translateY(-5px);
  transition: transform 0.3s ease;
}

.hover-grow:hover {
  transform: scale(1.05);
  transition: transform 0.3s ease;
}

.hover-shrink:hover {
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.hover-rotate:hover {
  transform: rotate(5deg);
  transition: transform 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px var(--accent-primary);
  transition: box-shadow 0.3s ease;
}

.hover-pulse:hover {
  animation: pulse 0.5s ease-in-out;
}

.hover-bounce:hover {
  animation: bounce 0.5s ease-in-out;
}

.hover-shake:hover {
  animation: shake 0.5s ease-in-out;
}

/* ==========================================
   Loading Animations
   ========================================== */

.spinner-border {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 0.25rem solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: rotate 0.75s linear infinite;
}

.dots-loading {
  display: inline-flex;
  gap: 0.3rem;
}

.dots-loading span {
  width: 0.5rem;
  height: 0.5rem;
  background: currentColor;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

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

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

/* ==========================================
   Scroll Animations
   ========================================== */

.scroll-fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scroll-fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.scroll-slide-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

.scroll-slide-right {
  opacity: 0;
  transform: translateX(50px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

.scroll-zoom-in {
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scroll-zoom-in.visible {
  opacity: 1;
  transform: scale(1);
}

/* ==========================================
   Transition Effects
   ========================================== */

.smooth-transition {
  transition: all 0.3s ease;
}

.smooth-transition-slow {
  transition: all 0.5s ease;
}

.smooth-transition-fast {
  transition: all 0.15s ease;
}

/* ==========================================
   Special Effects
   ========================================== */

/* Glassmorphism Effect */
.glass-effect {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Neon Glow Effect */
.neon-glow {
  text-shadow: 0 0 10px var(--accent-primary),
               0 0 20px var(--accent-primary),
               0 0 30px var(--accent-primary);
}

/* Gradient Text */
.gradient-text {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary), var(--accent-tertiary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Gradient Border */
.gradient-border {
  position: relative;
  background: var(--bg-card);
  border-radius: 20px;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 20px;
  padding: 2px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary), var(--accent-tertiary));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

/* Shimmer Effect */
.shimmer {
  position: relative;
  overflow: hidden;
}

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

@keyframes shimmer-slide {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Tilt Effect (3D) */
.tilt-3d {
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
}

.tilt-3d:hover {
  transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

/* Parallax Effect */
.parallax {
  transition: transform 0.5s ease-out;
}

/* Page Transition */
.page-transition {
  animation: fadeIn 0.5s ease-out;
}

/* Ripple Button Effect */
.ripple-effect {
  position: relative;
  overflow: hidden;
}

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

.ripple-effect:active::after {
  width: 200px;
  height: 200px;
}

/* ==========================================
   Performance Optimizations
   ========================================== */

/* Will-change for smooth animations */
.will-animate {
  will-change: transform, opacity;
}

/* Hardware acceleration */
.gpu-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

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