/* Animation definitions */

/* Fade-in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Slide-up animation */
@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Pulse animation */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* Number counter animation */
@keyframes countUp {
  from {
    opacity: 0.3;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Apply animations to elements */

/* Header animations */
header {
  animation: fadeIn 0.8s ease-out forwards;
}

/* Form animations */
.calculator-card {
  animation: slideUp 0.6s ease-out 0.2s both;
}

.form-group {
  opacity: 0;
  animation: fadeIn 0.5s ease-out forwards;
}

.form-group:nth-child(1) {
  animation-delay: 0.3s;
}

.form-group:nth-child(2) {
  animation-delay: 0.4s;
}

.form-group:nth-child(3) {
  animation-delay: 0.5s;
}

.calculate-btn {
  opacity: 1;
  animation: fadeIn 0.5s ease-out 0.6s forwards;
}

/* Results animations */
.results-card:not(.hidden) {
  animation: slideUp 0.8s ease-out forwards;
}

.result-value {
  animation: countUp 0.8s ease-out forwards;
}

.progress-bar {
  transition: width 1.5s cubic-bezier(0.19, 1, 0.22, 1);
}

/* CTA card animations */
.cta-card {
  opacity: 0;
  animation: fadeIn 0.8s ease-out forwards;
}

.cta-card:nth-child(1) {
  animation-delay: 0.2s;
}

.cta-card:nth-child(2) {
  animation-delay: 0.4s;
}

/* Interactive animations */
.calculate-btn:hover {
  animation: none; /* Remove the animation */
}

.results-card h2 {
  position: relative;
}

.results-card h2::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 60px;
  height: 3px;
  background-color: var(--primary);
  animation: slideUp 0.8s ease-out forwards;
}

/* Results appear animation */
.result-item {
  transform: translateY(20px);
  opacity: 0;
  animation: slideUp 0.5s ease-out forwards;
}

.result-item:nth-child(1) {
  animation-delay: 0.2s;
}

.result-item:nth-child(2) {
  animation-delay: 0.4s;
}

/* Tab switch animation */
.tab.active {
  position: relative;
  overflow: hidden;
}

.tab.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--primary-light);
  opacity: 0.1;
  transform: translateX(-100%);
  animation: slideIn 0.3s ease-out forwards;
}

@keyframes slideIn {
  to {
    transform: translateX(0);
  }
}

/* Focus animations */
input:focus, select:focus {
  animation: pulse 0.3s;
}

/* Mobile-specific animations */
@media (max-width: 768px) {
  .form-group, .calculate-btn {
    animation-duration: 0.4s;
  }
  
  .cta-card {
    animation-duration: 0.5s;
  }
}