/**
 * Advanced Animations & Effects
 */

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Fade in animations */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale animations */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Bounce animations */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Pulse animation */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
  }
  70% {
    box-shadow: 0 0 0 20px rgba(99, 102, 241, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
  }
}

/* Glow animation */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
  }
  50% {
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.8);
  }
}

/* Slide in animations */
@keyframes slideInFromLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInFromRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Rotate animation */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Shimmer animation for loading */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Float animation */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

/* Interactive elements */
button,
a[class*="btn"],
.cta-btn,
.get-started-btn,
input[type="submit"] {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button:before,
a[class*="btn"]:before,
.cta-btn:before,
.get-started-btn:before,
input[type="submit"]:before {
  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;
}

button:hover:before,
a[class*="btn"]:hover:before,
.cta-btn:hover:before,
.get-started-btn:hover:before,
input[type="submit"]:hover:before {
  width: 300px;
  height: 300px;
}

/* Hover lift effect */
.icon-box,
.member,
.count-box,
.info,
.php-email-form {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-box:hover,
.member:hover,
.count-box:hover,
.info:hover {
  transform: translateY(-8px);
}

/* Image effects */
img {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Text animations */
.animated-text {
  position: relative;
  display: inline-block;
}

.animated-text span {
  display: inline-block;
  animation: fadeInUp 0.6s ease-out forwards;
}

.animated-text span:nth-child(1) { animation-delay: 0.1s; }
.animated-text span:nth-child(2) { animation-delay: 0.2s; }
.animated-text span:nth-child(3) { animation-delay: 0.3s; }
.animated-text span:nth-child(4) { animation-delay: 0.4s; }
.animated-text span:nth-child(5) { animation-delay: 0.5s; }

/* Link hover effect */
a {
  position: relative;
}

a:not([class]):after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -2px;
  left: 0;
  background-color: #6366f1;
  transition: width 0.3s ease-out;
}

a:not([class]):hover:after {
  width: 100%;
}

/* Forms animations */
input,
textarea,
select {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input:focus,
textarea:focus,
select:focus {
  transform: scale(1.01);
}

/* Stagger animation for lists */
li {
  animation: fadeInUp 0.6s ease-out backwards;
}

li:nth-child(1) { animation-delay: 0.1s; }
li:nth-child(2) { animation-delay: 0.2s; }
li:nth-child(3) { animation-delay: 0.3s; }
li:nth-child(4) { animation-delay: 0.4s; }
li:nth-child(5) { animation-delay: 0.5s; }
li:nth-child(6) { animation-delay: 0.6s; }

/* Gradient text effect */
.gradient-text {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: pulse 3s ease-in-out infinite;
}

/* Smooth transitions for all elements */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Section fade in */
section {
  opacity: 0;
  animation: fadeInUp 0.8s ease-out forwards;
}

section:nth-of-type(1) { animation-delay: 0s; }
section:nth-of-type(2) { animation-delay: 0.1s; }
section:nth-of-type(3) { animation-delay: 0.2s; }
section:nth-of-type(4) { animation-delay: 0.3s; }
section:nth-of-type(5) { animation-delay: 0.4s; }

/* Parallax effect */
@supports (background-attachment: fixed) {
  .parallax {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
  }
}

/* Underline animation */
.underline {
  position: relative;
  text-decoration: none;
}

.underline:after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -5px;
  left: 0;
  background-color: #6366f1;
  transition: width 0.3s ease-out;
}

.underline:hover:after {
  width: 100%;
}

/* Loading animation */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
}

.loading:after {
  content: ' ';
  display: block;
  width: 16px;
  height: 16px;
  margin: 2px;
  border-radius: 50%;
  border: 2px solid #6366f1;
  border-color: #6366f1 transparent #6366f1 transparent;
  animation: lds-dual-ring 1.2s linear infinite;
}

@keyframes lds-dual-ring {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Smooth page transitions */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* Accessibility - Remove animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
