/* ============================================
   ADVANCED ANIMATIONS & MICRO-INTERACTIONS
   Flow Charts, Flash Cards, and Premium Effects
   ============================================ */

/* ============================================
   RIPPLE EFFECT FOR BUTTONS
   ============================================ */

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  transform: scale(0);
  animation: rippleAnimation 0.6s ease-out;
  pointer-events: none;
}

@keyframes rippleAnimation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ============================================
   SMOOTH SCROLL BEHAVIOR
   ============================================ */

html {
  scroll-behavior: smooth;
}

/* ============================================
   CARD FLIP ANIMATION
   ============================================ */

.card-flip {
  perspective: 1000px;
  cursor: pointer;
}

.card-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.card-flip.flipped .card-flip-inner {
  transform: rotateY(180deg);
}

.card-flip-front,
.card-flip-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
}

.card-flip-back {
  transform: rotateY(180deg);
}

/* ============================================
   PULSE ANIMATIONS
   ============================================ */

@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    opacity: 1;
  }
}

.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ============================================
   BOUNCE ANIMATION
   ============================================ */

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

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

/* ============================================
   GRADIENT ANIMATION
   ============================================ */

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

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

/* ============================================
   SLIDE IN ANIMATIONS
   ============================================ */

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-100px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-in-right {
  animation: slideInRight 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.slide-in-down {
  animation: slideInDown 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================
   STAGGER ANIMATIONS FOR LISTS
   ============================================ */

.stagger-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stagger-item {
  opacity: 0;
  animation: slideInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.1s; }
.stagger-item:nth-child(2) { animation-delay: 0.2s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.4s; }
.stagger-item:nth-child(5) { animation-delay: 0.5s; }
.stagger-item:nth-child(6) { animation-delay: 0.6s; }

/* ============================================
   HOVER SCALE ANIMATION
   ============================================ */

.hover-scale {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hover-scale:hover {
  transform: scale(1.05);
}

/* ============================================
   GLOW EFFECT
   ============================================ */

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(102, 126, 234, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.8);
  }
}

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

/* ============================================
   SHIMMER LOADING ANIMATION
   ============================================ */

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.1) 25%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0.1) 75%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* ============================================
   FADE IN ANIMATION
   ============================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

/* ============================================
   SCALE UP ANIMATION
   ============================================ */

@keyframes scaleUp {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.scale-up {
  animation: scaleUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================
   ROTATE ANIMATION
   ============================================ */

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

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

/* ============================================
   FLOAT ANIMATION
   ============================================ */

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

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

/* ============================================
   TYPING ANIMATION
   ============================================ */

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

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

.typing {
  overflow: hidden;
  border-right: 3px solid;
  white-space: nowrap;
  animation: typing 3.5s steps(40, end), blink 0.75s step-end infinite;
}

/* ============================================
   WAVE ANIMATION
   ============================================ */

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

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

.wave:nth-child(1) { animation-delay: 0s; }
.wave:nth-child(2) { animation-delay: 0.1s; }
.wave:nth-child(3) { animation-delay: 0.2s; }
.wave:nth-child(4) { animation-delay: 0.3s; }
.wave:nth-child(5) { animation-delay: 0.4s; }

/* ============================================
   CONFETTI ANIMATION
   ============================================ */

@keyframes confetti-fall {
  to {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  background: #667eea;
  animation: confetti-fall 3s ease-in forwards;
  pointer-events: none;
}

/* ============================================
   SMOOTH TRANSITIONS FOR INTERACTIVE ELEMENTS
   ============================================ */

button,
a,
input,
textarea,
select {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================
   FOCUS VISIBLE STYLES FOR ACCESSIBILITY
   ============================================ */

*:focus-visible {
  outline: 2px solid #667eea;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============================================
   SMOOTH BACKDROP FILTER TRANSITION
   ============================================ */

.backdrop-blur {
  backdrop-filter: blur(0px);
  transition: backdrop-filter 0.3s ease;
}

.backdrop-blur.active {
  backdrop-filter: blur(8px);
}

/* ============================================
   PARALLAX SCROLL EFFECT
   ============================================ */

.parallax {
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

/* ============================================
   SMOOTH COLOR TRANSITIONS
   ============================================ */

.color-transition {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ============================================
   RESPONSIVE ANIMATION ADJUSTMENTS
   ============================================ */

@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) {
  .float {
    animation: float 2s ease-in-out infinite;
  }

  .bounce {
    animation: bounce 0.8s ease-in-out infinite;
  }
}
