/* ===================================
   Rainbow Education Seva Foundation
   Animations Stylesheet
   =================================== */

/* ===================================
   AOS-Style Animations
   =================================== */
[data-animate] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

[data-animate].animated {
  opacity: 1;
  transform: translateY(0);
}

[data-animate="fade-up"] {
  transform: translateY(40px);
}

[data-animate="fade-up"].animated {
  transform: translateY(0);
}

[data-animate="fade-down"] {
  transform: translateY(-40px);
}

[data-animate="fade-down"].animated {
  transform: translateY(0);
}

[data-animate="fade-left"] {
  transform: translateX(40px);
}

[data-animate="fade-left"].animated {
  transform: translateX(0);
}

[data-animate="fade-right"] {
  transform: translateX(-40px);
}

[data-animate="fade-right"].animated {
  transform: translateX(0);
}

[data-animate="zoom-in"] {
  transform: scale(0.9);
}

[data-animate="zoom-in"].animated {
  transform: scale(1);
}

[data-animate="zoom-out"] {
  transform: scale(1.1);
}

[data-animate="zoom-out"].animated {
  transform: scale(1);
}

[data-animate="flip-left"] {
  transform: perspective(1000px) rotateY(10deg);
}

[data-animate="flip-left"].animated {
  transform: perspective(1000px) rotateY(0);
}

[data-animate="flip-right"] {
  transform: perspective(1000px) rotateY(-10deg);
}

[data-animate="flip-right"].animated {
  transform: perspective(1000px) rotateY(0);
}

[data-animate="slide-up"] {
  transform: translateY(60px);
  opacity: 0;
}

[data-animate="slide-up"].animated {
  transform: translateY(0);
  opacity: 1;
}

/* Staggered Animation Delays */
[data-delay="100"] { transition-delay: 0.1s; }
[data-delay="200"] { transition-delay: 0.2s; }
[data-delay="300"] { transition-delay: 0.3s; }
[data-delay="400"] { transition-delay: 0.4s; }
[data-delay="500"] { transition-delay: 0.5s; }
[data-delay="600"] { transition-delay: 0.6s; }
[data-delay="700"] { transition-delay: 0.7s; }
[data-delay="800"] { transition-delay: 0.8s; }
[data-delay="900"] { transition-delay: 0.9s; }
[data-delay="1000"] { transition-delay: 1.0s; }

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

@keyframes floatSlow {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-10px) rotate(2deg);
  }
}

@keyframes floatReverse {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(15px);
  }
}

@keyframes floatLeftRight {
  0%, 100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(-15px);
  }
}

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

.animate-float-slow {
  animation: floatSlow 4s ease-in-out infinite;
}

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

.animate-float-left-right {
  animation: floatLeftRight 3s ease-in-out infinite;
}

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

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.4);
  }
  50% {
    box-shadow: 0 0 0 15px rgba(15, 118, 110, 0);
  }
}

@keyframes pulseSmall {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

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

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

.animate-pulse-small {
  animation: pulseSmall 2s ease-in-out infinite;
}

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

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

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

.animate-rotate {
  animation: rotate 10s linear infinite;
}

.animate-rotate-reverse {
  animation: rotateReverse 10s linear infinite;
}

.animate-rotate-slow {
  animation: rotateSlow 20s linear infinite;
}

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

@keyframes shakeY {
  0%, 100% { transform: translateY(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateY(-5px); }
  20%, 40%, 60%, 80% { transform: translateY(5px); }
}

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

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

/* ===================================
   Bounce Animation
   =================================== */
@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
    transform: translateY(0);
  }
  40%, 43% {
    animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
    transform: translateY(-15px);
  }
  70% {
    animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
    transform: translateY(-8px);
  }
  90% {
    transform: translateY(-3px);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes bounceInDown {
  0% {
    opacity: 0;
    transform: translateY(-50px);
  }
  60% {
    opacity: 1;
    transform: translateY(10px);
  }
  80% {
    transform: translateY(-5px);
  }
  100% {
    transform: translateY(0);
  }
}

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

.animate-bounce-in {
  animation: bounceIn 0.8s ease;
}

.animate-bounce-in-down {
  animation: bounceInDown 0.8s ease;
}

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

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

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

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

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

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

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

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

/* ===================================
   Slide Animations
   =================================== */
@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

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

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

@keyframes slideOutLeft {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(-100%);
    opacity: 0;
  }
}

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

.animate-slide-in-left {
  animation: slideInLeft 0.6s ease;
}

.animate-slide-in-right {
  animation: slideInRight 0.6s ease;
}

.animate-slide-in-up {
  animation: slideInUp 0.6s ease;
}

.animate-slide-in-down {
  animation: slideInDown 0.6s ease;
}

/* ===================================
   Zoom Animations
   =================================== */
@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes zoomOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.5);
  }
}

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

@keyframes zoomInDown {
  from {
    opacity: 0;
    transform: scale(0.5) translateY(-30px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.animate-zoom-in {
  animation: zoomIn 0.6s ease;
}

.animate-zoom-out {
  animation: zoomOut 0.6s ease;
}

.animate-zoom-in-up {
  animation: zoomInUp 0.6s ease;
}

.animate-zoom-in-down {
  animation: zoomInDown 0.6s ease;
}

/* ===================================
   Flip Animations
   =================================== */
@keyframes flipX {
  from {
    transform: perspective(400px) rotateX(90deg);
    opacity: 0;
  }
  to {
    transform: perspective(400px) rotateX(0);
    opacity: 1;
  }
}

@keyframes flipY {
  from {
    transform: perspective(400px) rotateY(90deg);
    opacity: 0;
  }
  to {
    transform: perspective(400px) rotateY(0);
    opacity: 1;
  }
}

.animate-flip-x {
  animation: flipX 0.6s ease;
}

.animate-flip-y {
  animation: flipY 0.6s ease;
}

/* ===================================
   Scale Animations
   =================================== */
@keyframes scaleUp {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes scaleDown {
  from {
    transform: scale(1.2);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes scaleRotate {
  from {
    transform: scale(0.8) rotate(-10deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

.animate-scale-up {
  animation: scaleUp 0.6s ease;
}

.animate-scale-down {
  animation: scaleDown 0.6s ease;
}

.animate-scale-rotate {
  animation: scaleRotate 0.6s ease;
}

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

.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

.btn-ripple:active::after {
  animation: ripple 0.6s ease-out;
}

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

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

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

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

@keyframes gradientFlow {
  0% { background-position: 0% 0%; }
  25% { background-position: 100% 0%; }
  50% { background-position: 100% 100%; }
  75% { background-position: 0% 100%; }
  100% { background-position: 0% 0%; }
}

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

.animate-gradient-flow {
  background-size: 400% 400%;
  animation: gradientFlow 8s ease infinite;
}

/* ===================================
   Marquee Animation
   =================================== */
@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

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

.animate-marquee {
  animation: marquee 20s linear infinite;
}

.animate-marquee-reverse {
  animation: marqueeReverse 20s linear infinite;
}

.animate-marquee-slow {
  animation: marquee 30s linear infinite;
}

.animate-marquee-fast {
  animation: marquee 10s linear infinite;
}

/* ===================================
   Glow Animation
   =================================== */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(15, 118, 110, 0.2),
                0 0 10px rgba(15, 118, 110, 0.1);
  }
  50% {
    box-shadow: 0 0 15px rgba(15, 118, 110, 0.4),
                0 0 30px rgba(15, 118, 110, 0.2);
  }
}

@keyframes glowAccent {
  0%, 100% {
    box-shadow: 0 0 5px rgba(245, 158, 11, 0.2),
                0 0 10px rgba(245, 158, 11, 0.1);
  }
  50% {
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4),
                0 0 30px rgba(245, 158, 11, 0.2);
  }
}

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

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

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

.animate-swing {
  animation: swing 1s ease;
  transform-origin: top center;
}

/* ===================================
   Tada Animation
   =================================== */
@keyframes tada {
  0%, 100% {
    transform: scale(1) rotate(0deg);
  }
  10%, 20% {
    transform: scale(0.9) rotate(-3deg);
  }
  30%, 50%, 70%, 90% {
    transform: scale(1.1) rotate(3deg);
  }
  40%, 60%, 80% {
    transform: scale(1.1) rotate(-3deg);
  }
}

.animate-tada {
  animation: tada 1s ease;
}

/* ===================================
   Wobble Animation
   =================================== */
@keyframes wobble {
  0% { transform: translateX(0); }
  15% { transform: translateX(-15px) rotate(-5deg); }
  30% { transform: translateX(10px) rotate(3deg); }
  45% { transform: translateX(-10px) rotate(-3deg); }
  60% { transform: translateX(5px) rotate(2deg); }
  75% { transform: translateX(-5px) rotate(-1deg); }
  100% { transform: translateX(0); }
}

.animate-wobble {
  animation: wobble 1s ease;
}

/* ===================================
   Heartbeat Animation
   =================================== */
@keyframes heartbeat {
  0% { transform: scale(1); }
  14% { transform: scale(1.3); }
  28% { transform: scale(1); }
  42% { transform: scale(1.3); }
  70% { transform: scale(1); }
}

.animate-heartbeat {
  animation: heartbeat 1.5s ease-in-out infinite;
}

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

.animate-count-up {
  animation: countUp 0.8s ease forwards;
}

/* ===================================
   Parallax Effect (JS-driven)
   =================================== */
.parallax-container {
  overflow: hidden;
  position: relative;
}

.parallax-bg {
  position: absolute;
  top: -20%;
  left: 0;
  width: 100%;
  height: 140%;
  background-size: cover;
  background-position: center;
  will-change: transform;
}

/* ===================================
   Hover Effects
   =================================== */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.hover-scale {
  transition: transform 0.3s ease;
}

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

.hover-rotate {
  transition: transform 0.3s ease;
}

.hover-rotate:hover {
  transform: rotate(5deg);
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(15, 118, 110, 0.3);
}

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

.hover-border:hover {
  border-color: var(--primary);
}

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

/* ===================================
   Loading Spinner
   =================================== */
@keyframes spinner {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spinner 0.8s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.spinner-lg {
  width: 60px;
  height: 60px;
  border-width: 4px;
}

/* ===================================
   Dot Loading Animation
   =================================== */
@keyframes dotPulse {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.dot-loader {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.dot-loader span {
  width: 12px;
  height: 12px;
  background: var(--primary);
  border-radius: 50%;
  animation: dotPulse 1.4s ease-in-out infinite;
}

.dot-loader span:nth-child(1) { animation-delay: -0.32s; }
.dot-loader span:nth-child(2) { animation-delay: -0.16s; }
.dot-loader span:nth-child(3) { animation-delay: 0s; }

/* ===================================
   Line Loading Animation
   =================================== */
@keyframes linePulse {
  0% { width: 0; }
  50% { width: 100%; }
  100% { width: 0; }
}

.line-loader {
  width: 100%;
  height: 3px;
  background: var(--gray-200);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.line-loader::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 2px;
  animation: linePulse 1.5s ease-in-out infinite;
}

/* ===================================
   Particle Effect (CSS only)
   =================================== */
@keyframes particleFloat {
  0%, 100% {
    transform: translateY(0) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100vh) translateX(50px);
    opacity: 0;
  }
}

.particles {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  bottom: -10px;
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  animation: particleFloat 6s ease-in-out infinite;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; animation-duration: 8s; }
.particle:nth-child(2) { left: 20%; animation-delay: 1s; animation-duration: 6s; }
.particle:nth-child(3) { left: 30%; animation-delay: 2s; animation-duration: 7s; }
.particle:nth-child(4) { left: 40%; animation-delay: 0.5s; animation-duration: 9s; }
.particle:nth-child(5) { left: 50%; animation-delay: 1.5s; animation-duration: 5s; }
.particle:nth-child(6) { left: 60%; animation-delay: 2.5s; animation-duration: 8s; }
.particle:nth-child(7) { left: 70%; animation-delay: 0.3s; animation-duration: 6s; }
.particle:nth-child(8) { left: 80%; animation-delay: 1.8s; animation-duration: 7s; }
.particle:nth-child(9) { left: 90%; animation-delay: 0.7s; animation-duration: 9s; }
.particle:nth-child(10) { left: 15%; animation-delay: 2.2s; animation-duration: 6s; }

/* ===================================
   Morphing Background
   =================================== */
@keyframes morph {
  0%, 100% {
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
  }
  50% {
    border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
  }
}

.animate-morph {
  animation: morph 8s ease-in-out infinite;
}

/* ===================================
   Page Transition
   =================================== */
.page-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--primary);
  z-index: 99999;
  transform: translateY(100%);
  transition: transform 0.6s cubic-bezier(0.86, 0, 0.07, 1);
}

.page-transition.active {
  transform: translateY(0);
}

/* ===================================
   Scroll Reveal Utilities
   =================================== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease;
}

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

.reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.8s ease;
}

.reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.8s ease;
}

.reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.8s ease;
}

.reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
}
