/* ═══════════════════════════════════════════════════════════════════════════════
   APOLLO AgriGuard - Advanced Animations
   Premium smooth interactions and visual effects
═════════════════════════════════════════════════════════════════════════════════ */

/* Scroll Entrance Animations */
@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);
  }
}

/* Hover Animations */
@keyframes glow-pulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(212, 165, 116, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(212, 165, 116, 0.6);
  }
}

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

/* Text Animations */
@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink-cursor {
  0%, 49% {
    border-right-color: var(--accent-gold);
  }
  50%, 100% {
    border-right-color: transparent;
  }
}

/* Floating Animation */
@keyframes float-smooth {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

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

/* Icon Pulse */
@keyframes icon-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

/* Border Animation */
@keyframes border-flow {
  0% {
    border-color: var(--primary-green);
  }
  50% {
    border-color: var(--accent-gold);
  }
  100% {
    border-color: var(--primary-green);
  }
}

/* Gradient Shift */
@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Elements with scroll-triggered animation */
.fade-in-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.8s ease forwards;
}

.feature-card {
  animation: fadeInUp 0.6s ease forwards;
}

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

/* Tech Grid Stagger */
.tech-item {
  animation: fadeInUp 0.6s ease forwards;
}

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

/* Smooth Page Load */
body {
  animation: fadeInUp 0.6s ease;
}

/* Section Entrance */
section {
  animation: fadeInUp 0.8s ease;
}

/* Button Transitions */
a[class*="btn"]:active {
  transform: scale(0.98);
}

/* Smooth Transitions for All Interactive Elements */
a, button, input, select, textarea {
  transition: all 0.3s ease;
}

/* Loading Skeleton Animation */
@keyframes loading-shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.loading {
  background: linear-gradient(
    90deg,
    var(--neutral-bg) 0%,
    var(--neutral-light-gray) 50%,
    var(--neutral-bg) 100%
  );
  background-size: 1000px 100%;
  animation: loading-shimmer 2s infinite;
}

/* Smooth Number Counter Animation */
@keyframes count-up {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.success-stat .number {
  animation: count-up 0.8s ease forwards;
}

.success-stat:nth-child(1) .number { animation-delay: 0s; }
.success-stat:nth-child(2) .number { animation-delay: 0.2s; }
.success-stat:nth-child(3) .number { animation-delay: 0.4s; }
.success-stat:nth-child(4) .number { animation-delay: 0.6s; }

/* Parallax Effect on Scroll */
@supports (background-attachment: fixed) {
  .hero::before,
  .hero::after {
    background-attachment: fixed;
  }
}

/* Smooth Scroll Behavior */
html {
  scroll-behavior: smooth;
}

/* Page Transition Animation */
@keyframes page-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

body {
  animation: page-fade-in 0.5s ease;
}

/* Hover States with Smooth Transitions */
.feature-card:hover {
  animation: none;
}

/* Icon Animation on Hover */
.feature-icon {
  transition: transform 0.3s ease, filter 0.3s ease;
}

.feature-card:hover .feature-icon {
  transform: scale(1.1) rotate(5deg);
  filter: brightness(1.2);
}

/* Text Underline Animation */
.nav-menu a::after {
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Gradient Background Motion */
@keyframes gradient-motion {
  0% {
    background-position: 0% center;
  }
  50% {
    background-position: 100% center;
  }
  100% {
    background-position: 0% center;
  }
}

.hero {
  background-size: 200% 200%;
  animation: gradient-motion 15s ease infinite;
}

/* Success Highlight Animation */
.success-highlight {
  animation: fadeInUp 0.6s ease;
}

/* Heading Animation */
h1, h2, h3, h4 {
  animation: fadeInDown 0.6s ease;
}

section:nth-of-type(odd) h2 {
  animation-delay: 0.1s;
}

section:nth-of-type(even) h2 {
  animation-delay: 0.2s;
}

/* CTA Button Shimmer on Hover */
.cta-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

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

/* Tooltip Animation */
@keyframes tooltip-fade {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

[data-tooltip]::after {
  animation: tooltip-fade 0.3s ease;
}

/* Responsive Animation Adjustments */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Mobile Optimized Animations */
@media (max-width: 768px) {
  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .feature-card,
  .tech-item {
    animation: fadeInUp 0.5s ease forwards;
  }

  .feature-card:nth-child(n) { animation-delay: 0.1s; }
  .tech-item:nth-child(n) { animation-delay: 0.1s; }

  h1, h2, h3 {
    animation: fadeInDown 0.4s ease;
  }
}
