/* ========================================
   ANIMATION KEYFRAMES
======================================== */

/* Fade In 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);
  }
}

/* Scale Animations */
@keyframes scaleIn {
  from {
      opacity: 0;
      transform: scale(0.9);
  }
  to {
      opacity: 1;
      transform: scale(1);
  }
}

@keyframes pulse {
  0%, 100% {
      transform: scale(1);
  }
  50% {
      transform: scale(1.05);
  }
}

/* Zoom Animation for Images */
@keyframes zoomIn {
  from {
      opacity: 0;
      transform: scale(0.95);
  }
  to {
      opacity: 1;
      transform: scale(1);
  }
}

/* Counter Animation */
@keyframes countUp {
  from {
      opacity: 0;
      transform: translateY(20px);
  }
  to {
      opacity: 1;
      transform: translateY(0);
  }
}

/* Float Animation */
@keyframes float {
  0%, 100% {
      transform: translateY(0);
  }
  50% {
      transform: translateY(-10px);
  }
}

/* Slide Animations */
@keyframes slideInLeft {
  from {
      opacity: 0;
      transform: translateX(-100%);
  }
  to {
      opacity: 1;
      transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
      opacity: 0;
      transform: translateX(100%);
  }
  to {
      opacity: 1;
      transform: translateX(0);
  }
}

@keyframes slideInDown {
  from {
      opacity: 0;
      transform: translateY(-100%);
  }
  to {
      opacity: 1;
      transform: translateY(0);
  }
}

/* Bounce Animation */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
      transform: translateY(0);
  }
  40% {
      transform: translateY(-10px);
  }
  60% {
      transform: translateY(-5px);
  }
}

/* Glow Animation */
@keyframes glow {
  0%, 100% {
      box-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
  }
  50% {
      box-shadow: 0 0 20px rgba(76, 175, 80, 0.8);
  }
}

/* Rotate Animation */
@keyframes rotate {
  from {
      transform: rotate(0deg);
  }
  to {
      transform: rotate(360deg);
  }
}

/* Title Underline Animation */
@keyframes underlineExpand {
  from {
      width: 0;
  }
  to {
      width: 80px;
  }
}

/* ========================================
 ANIMATION CLASSES
======================================== */

/* Base Animation Class */
.animate {
  opacity: 0;
  animation-fill-mode: both;
}

.animate.animated {
  opacity: 1;
}

/* Fade Animations */
.fade-in {
  animation: fadeIn 0.8s ease-in-out forwards;
}

.fade-in-up {
  animation: fadeInUp 0.8s ease-out forwards;
}

.fade-in-down {
  animation: fadeInDown 0.8s ease-out forwards;
}

.fade-in-left {
  animation: fadeInLeft 0.8s ease-out forwards;
}

.fade-in-right {
  animation: fadeInRight 0.8s ease-out forwards;
}

/* Zoom Animation for Images */
.zoom-in {
  animation: zoomIn 0.8s ease-out forwards;
}

/* Scale Animation */
.scale-in {
  animation: scaleIn 0.6s ease-out forwards;
}

/* Slide Animations */
.slide-in-left {
  animation: slideInLeft 0.8s ease-out forwards;
}

.slide-in-right {
  animation: slideInRight 0.8s ease-out forwards;
}

.slide-in-down {
  animation: slideInDown 0.5s ease-out forwards;
}

/* Delay Classes */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }

/* Duration Classes */
.duration-fast { animation-duration: 0.5s; }
.duration-normal { animation-duration: 0.8s; }
.duration-slow { animation-duration: 1.2s; }

/* Continuous Animations */
.pulse-animation {
  animation: pulse 2s ease-in-out infinite;
}

.float-animation {
  animation: float 3s ease-in-out infinite;
}

.bounce-animation {
  animation: bounce 2s infinite;
}

.glow-animation {
  animation: glow 2s ease-in-out infinite;
}

.rotate-animation {
  animation: rotate 2s linear infinite;
}

/* Hover Animations */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.hover-grow {
  transition: transform 0.3s ease;
}

.hover-grow:hover {
  transform: scale(1.05);
}

/* Image Zoom on Hover */
.image-zoom-container {
  overflow: hidden;
  border-radius: 10px;
}

.image-zoom {
  transition: transform 0.5s ease;
  display: block;
  width: 100%;
}

.image-zoom-container:hover .image-zoom {
  transform: scale(1.1);
}

/* Number Counter Animation */
.counter {
  display: inline-block;
  font-weight: 700;
}

/* Scroll Reveal Animation */
.scroll-reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger Animation Helper */
.stagger-item {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.stagger-item.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Section Title Animation */
.section-header h2 {
  position: relative;
  padding-bottom: 20px;
}

.section-header h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, #1A5C28, #4CAF50, #1A5C28);
  transition: width 0.8s ease;
}

.section-header.revealed h2::after {
  width: 80px;
}

/* Text Animations */
.text-slide-in {
  overflow: hidden;
}

.text-slide-in span {
  display: inline-block;
  animation: slideInLeft 0.8s ease-out forwards;
}

/* Card Flip Animation */
.card-flip {
  perspective: 1000px;
}

.card-flip-inner {
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.card-flip:hover .card-flip-inner {
  transform: rotateY(180deg);
}

/* Loading Spinner */
@keyframes spin {
  to {
      transform: rotate(360deg);
  }
}

.spinner {
  animation: spin 1s linear infinite;
}

/* Shimmer Effect */
@keyframes shimmer {
  0% {
      background-position: -1000px 0;
  }
  100% {
      background-position: 1000px 0;
  }
}

.shimmer {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* Visible Animation Trigger */
.visible {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* Image Fade In Animation */
.image-fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.image-fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile Optimizations */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
  }
  
  .scroll-reveal,
  .stagger-item,
  .image-fade-in {
      opacity: 1;
      transform: none;
  }
}

/* Performance Optimization */
.animate,
.scroll-reveal,
.stagger-item,
.image-fade-in {
  will-change: opacity, transform;
}

/* Ensure animations work on first load */
@keyframes initialFade {
  from {
      opacity: 0;
  }
  to {
      opacity: 1;
  }
}

body {
  animation: initialFade 0.3s ease-in;
}

/* Page Header Animation */
.page-header-content {
  animation: fadeInDown 1s ease-out;
}

/* Breadcrumb Animation */
.breadcrumb {
  animation: fadeInUp 1s ease-out 0.3s backwards;
}