/* Advanced animations and transitions */

/* Page transition effects */
.page-transition {
  transition: opacity 0.3s ease-in-out;
}

.page-leaving {
  opacity: 0;
  transform: translateY(-10px);
}

/* Scroll-triggered animations */
.animate-in {
  animation: slideInUp 0.6s ease-out forwards;
}

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

/* Staggered animations for grids */
.friends-grid .friend-card {
  opacity: 0;
  transform: translateY(20px);
  animation: slideInUp 0.6s ease-out forwards;
}

.friends-grid .friend-card:nth-child(1) {
  animation-delay: 0.1s;
}
.friends-grid .friend-card:nth-child(2) {
  animation-delay: 0.2s;
}
.friends-grid .friend-card:nth-child(3) {
  animation-delay: 0.3s;
}
.friends-grid .friend-card:nth-child(4) {
  animation-delay: 0.4s;
}
.friends-grid .friend-card:nth-child(5) {
  animation-delay: 0.5s;
}
.friends-grid .friend-card:nth-child(6) {
  animation-delay: 0.6s;
}
.friends-grid .friend-card:nth-child(7) {
  animation-delay: 0.7s;
}
.friends-grid .friend-card:nth-child(8) {
  animation-delay: 0.8s;
}

/* Hover card effects */
.card {
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(243, 139, 168, 0.1), transparent);
  transition: left 0.6s ease;
}

.card:hover::before {
  left: 100%;
}

/* Glowing border effect */
.card-glow {
  position: relative;
  border: 2px solid transparent;
  background: linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(45deg, var(--primary), var(--primary-bright)) border-box;
}

.card-glow:hover {
  box-shadow: 0 0 20px rgba(243, 139, 168, 0.3), 0 0 40px rgba(243, 139, 168, 0.1), inset 0 0 20px
    rgba(243, 139, 168, 0.05);
}

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

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

/* Typing animation */
.typing-animation {
  overflow: hidden;
  border-right: 2px solid var(--primary);
  white-space: nowrap;
  animation: typing 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

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

@keyframes blink-caret {
  from,
  to {
    border-color: transparent;
  }
  50% {
    border-color: var(--primary);
  }
}

/* Particle effect background */
.particles-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--primary-dim);
  border-radius: 50%;
  animation: particle-float 20s linear infinite;
}

@keyframes particle-float {
  0% {
    transform: translateY(100vh) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-10vh) translateX(100px);
    opacity: 0;
  }
}

/* Screen transition effects */
.screen-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--background);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.screen-transition.active {
  opacity: 1;
  pointer-events: all;
}

.transition-loader {
  width: 50px;
  height: 50px;
  border: 3px solid var(--surface);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Button hover effects */
.btn-hover {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-hover::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(243, 139, 168, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn-hover:hover::after {
  width: 300px;
  height: 300px;
}

/* Text reveal animation */
.text-reveal {
  position: relative;
  overflow: hidden;
}

.text-reveal::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--primary);
  transform: translateX(-100%);
  animation: reveal 1.5s ease-out forwards;
}

@keyframes reveal {
  0% {
    transform: translateX(-100%);
  }
  50% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(100%);
  }
}

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

@media (max-width: 768px) {
  .card:hover {
    transform: translateY(-2px);
  }

  .friends-grid .friend-card:hover {
    transform: translateY(-3px);
  }
}
