/* Micro-Interactions and Polish */

/* Smooth Page Transitions */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-transition {
  animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Form Focus Animations */
.form-input:focus,
.form-textarea:focus,
.floating-input:focus {
  transform: translateY(-2px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Button Hover Effects */
.btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(147, 51, 234, 0.3);
}

.btn:active {
  transform: translateY(0);
}

/* Scroll-Triggered Reveals */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-on-scroll {
  opacity: 0;
  animation: slideInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.fade-in-on-scroll:nth-child(1) { animation-delay: 0.1s; }
.fade-in-on-scroll:nth-child(2) { animation-delay: 0.2s; }
.fade-in-on-scroll:nth-child(3) { animation-delay: 0.3s; }
.fade-in-on-scroll:nth-child(4) { animation-delay: 0.4s; }

/* Nigerian-Themed Loading Animation */
@keyframes nigerianPulse {
  0%, 100% {
    background: linear-gradient(135deg, #008751, #FFFFFF, #008751);
    transform: scale(1);
  }
  50% {
    background: linear-gradient(135deg, #FFFFFF, #008751, #FFFFFF);
    transform: scale(1.05);
  }
}

.loading-nigerian {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  animation: nigerianPulse 2s ease-in-out infinite;
  margin: 2rem auto;
}

/* Card Hover Effects */
.card-hover {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(147, 51, 234, 0.15);
}

/* Icon Animations */
.icon-bounce {
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.icon-rotate {
  animation: rotate 3s linear infinite;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Success/Error States */
.success-state {
  animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.error-state {
  animation: errorShake 0.5s ease-out;
}

@keyframes errorShake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

/* Smooth Scroll */
html {
  scroll-behavior: smooth;
}

/* Focus Indicators */
*:focus-visible {
  outline: 2px solid hsl(var(--primary));
  outline-offset: 2px;
  border-radius: 4px;
}

/* Back to Top Button Animation */
.back-to-top {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.back-to-top:hover {
  transform: translateY(-4px);
}

.back-to-top.visible {
  opacity: 1 !important;
  visibility: visible !important;
}

/* Mobile Menu Animation - Now handled in components.css */
/* Hamburger Menu Animation */
.mobile-menu-toggle {
  transition: transform 0.3s, background-color 0.2s;
}

.mobile-menu-toggle.active {
  transform: rotate(90deg);
}

.mobile-menu-toggle.active svg {
  transform: rotate(180deg);
}

/* Gradient Text Animation */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.text-gradient-electric {
  background-size: 200% auto;
  animation: gradientShift 3s ease infinite;
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(147, 51, 234, 0.1);
  border-top-color: hsl(var(--primary));
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Nigerian Pattern Background Animation */
@keyframes patternMove {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 100% 100%;
  }
}

.nigerian-pattern-bg {
  background-image: 
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 10px,
      rgba(147, 51, 234, 0.03) 10px,
      rgba(147, 51, 234, 0.03) 20px
    );
  animation: patternMove 20s linear infinite;
}

/* Smooth Image Loading */
img {
  opacity: 0;
  transition: opacity 0.3s;
}

img.loaded {
  opacity: 1;
}

/* Intersection Observer for Scroll Animations */
.observe-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.observe-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Premium Hover Effects */
.premium-hover {
  position: relative;
  overflow: hidden;
}

.premium-hover::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.premium-hover:hover::before {
  left: 100%;
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
