/* Animations & Transitions */

/* Fade In Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Fade Out Animation */
@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Page Transition Animations */
body.page-fade-in {
  animation: fadeIn 0.6s ease-out forwards;
}

body.page-fade-out {
  animation: fadeOut 0.4s ease-out forwards;
  pointer-events: none;
}

/* Slide Up Animation */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide Down Animation */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide In from Left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide In from Right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale In Animation */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Pulse Animation */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

/* Scroll Reveal Animation */
.reveal {
  opacity: 0;
  animation: slideUp 0.8s ease-out forwards;
}

.reveal.active {
  animation-play-state: running;
}

/* Stagger Animation for Multiple Elements */
.reveal-group > * {
  opacity: 0;
  animation: slideUp 0.8s ease-out forwards;
}

.reveal-group > :nth-child(1) { animation-delay: 0.1s; }
.reveal-group > :nth-child(2) { animation-delay: 0.2s; }
.reveal-group > :nth-child(3) { animation-delay: 0.3s; }
.reveal-group > :nth-child(4) { animation-delay: 0.4s; }
.reveal-group > :nth-child(5) { animation-delay: 0.5s; }

/* Service Card Hover Animation */
.service-card {
  animation: fadeIn 0.6s ease-out;
}

/* Button Animations */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

/* Icon Animations */
.icon-spin {
  animation: spin 2s linear infinite;
}

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

/* Accordion Animation */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.accordion-content.open {
  max-height: 1000px;
  transition: max-height 0.3s ease-in;
}

/* Form Input Animation */
input:focus,
textarea:focus,
select:focus {
  animation: none;
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--accent);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Tooltip Animation */
.tooltip {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease-out, visibility 0.2s ease-out;
}

.tooltip.show {
  opacity: 1;
  visibility: visible;
}

/* Transform Animations */
@media (prefers-reduced-motion: reduce) {
  body.page-fade-in,
  body.page-fade-out,
  .scroll-reveal,
  .scroll-reveal.visible,
  .accordion-content,
  .accordion-content.open {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }

  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Intersection Observer for Scroll Animations */
.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Parallax Effect (Optional, Subtle) */
.parallax {
  position: relative;
  overflow: hidden;
}

.parallax-content {
  position: relative;
  z-index: 1;
}

/* Smooth Scroll to Top on Page Transition */
html.smooth-scroll {
  scroll-behavior: smooth;
}

/* Button Ripple Effect */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

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

@keyframes rippleEffect {
  to {
    width: 300px;
    height: 300px;
    opacity: 0;
  }
}

/* Hover Underline Animation */
.hover-underline {
  position: relative;
  text-decoration: none;
}

.hover-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--primary);
  transition: width 0.3s ease-out;
}

.hover-underline:hover::after {
  width: 100%;
}
