/* Advanced animations for LeetCode2Anki Plus website */

/* Preloader Animation */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Floating Animation for Cards */
@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

/* Glow Effect Animation */
@keyframes glow {
  0% { filter: drop-shadow(0 0 2px rgba(20, 184, 166, 0.6)); }
  50% { filter: drop-shadow(0 0 8px rgba(20, 184, 166, 0.8)); }
  100% { filter: drop-shadow(0 0 2px rgba(20, 184, 166, 0.6)); }
}

/* Typing Animation */
@keyframes typing {
  from { width: 0 }
  to { width: 100% }
}

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

/* Fade In Down Animation */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translate3d(0, -20px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* Shine Effect for Buttons */
@keyframes shine {
  from {
    background-position: 200% center;
  }
}

/* Number Counter Animation */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Apply animations to elements */
.animate-float {
  animation: float 3s ease-in-out infinite;
}

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

.animate-fadeInDown {
  animation: fadeInDown 0.5s ease-out forwards;
}

/* Pulsing Animation for CTA buttons */
.animate-pulse-button {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(20, 184, 166, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(20, 184, 166, 0);
  }
}

/* Progress Bar Animation */
@keyframes growWidth {
  from { width: 0; }
  to { width: 100%; }
}

.progress-bar {
  height: 4px;
  background-color: #14b8a6;
  width: 0;
  transition: width 0.5s ease;
}

/* Scroll Indicator Animation */
.scroll-indicator {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: bounce 2s infinite;
}

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

.scroll-indicator svg {
  width: 24px;
  height: 24px;
  color: #14b8a6;
}

.scroll-indicator span {
  font-size: 12px;
  color: #d1d5db;
  margin-top: 8px;
}

/* Reveal on Scroll Effect */
.reveal {
  position: relative;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* Staggered Fade In for List Items */
.stagger-fade li {
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.stagger-fade.active li:nth-child(1) { 
  transition-delay: 0.1s;
}

.stagger-fade.active li:nth-child(2) { 
  transition-delay: 0.2s;
}

.stagger-fade.active li:nth-child(3) { 
  transition-delay: 0.3s;
}

.stagger-fade.active li:nth-child(4) { 
  transition-delay: 0.4s;
}

.stagger-fade.active li:nth-child(5) { 
  transition-delay: 0.5s;
}

.stagger-fade.active li {
  opacity: 1;
  transform: translateX(0);
}

/* Tilt Effect Hover */
.tilt-effect {
  transition: transform 0.3s ease;
  transform-style: preserve-3d;
  perspective: 1000px;
}

.tilt-effect:hover {
  transform: rotateX(2deg) rotateY(5deg);
}

/* Button Hover Effects */
.button-hover-effect {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.button-hover-effect::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transition: all 0.5s ease;
}

.button-hover-effect:hover::before {
  left: 100%;
}

/* Dark mode transition */
.dark-mode-transition {
  transition: background-color 0.5s ease, color 0.5s ease;
}

/* Animated gradient border */
.animated-border {
  position: relative;
  border-radius: 0.5rem;
  overflow: hidden;
}

.animated-border::before {
  content: '';
  position: absolute;
  z-index: -1;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, #14b8a6, #3b82f6, #8b5cf6, #14b8a6);
  background-size: 400% 400%;
  animation: gradient-border 6s ease infinite;
  border-radius: 0.6rem;
}

@keyframes gradient-border {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Feature card hover animation */
.feature-card-animation {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.feature-card-animation:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 20px 25px rgba(0,0,0,0.2);
}

/* Custom link underline animation */
.link-underline {
  position: relative;
  text-decoration: none;
}

.link-underline::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 2px;
  background-color: #14b8a6;
  left: 0;
  bottom: -2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.link-underline:hover::after {
  transform: scaleX(1);
}

/* Mobile responsive animations */
@media (max-width: 768px) {
  .animate-float {
    animation: none;
  }
  
  .reveal {
    opacity: 1;
    transform: translateY(0);
  }
  
  .stagger-fade li {
    opacity: 1;
    transform: translateX(0);
  }
}
