/*--------------------------------------*\
  ANIMATIONS & TRANSITIONS - PHASE 3
\*--------------------------------------*/

/* Basic Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes slideInDown {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-3px); }
  40%, 60% { transform: translateX(3px); }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

/* Page transition effects */
.page-transition-enter {
  opacity: 0;
  transform: translateY(10px);
}

.page-transition-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 300ms, transform 300ms;
}

/* Element animations */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s, transform 0.8s;
}

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

/* Animation utility classes */
.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

.fade-out {
  animation: fadeOut 0.5s ease forwards;
}

.slide-in-down {
  animation: slideInDown 0.5s ease forwards;
}

.slide-in-up {
  animation: slideInUp 0.5s ease forwards;
}

.slide-in-left {
  animation: slideInLeft 0.5s ease forwards;
}

.slide-in-right {
  animation: slideInRight 0.5s ease forwards;
}

.pulse-animation {
  animation: pulse 1s ease infinite;
}

.bounce-animation {
  animation: bounce 1s ease infinite;
}

/* Button animations */
.btn-animated {
  position: relative;
  overflow: hidden;
}

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

.btn-animated:active::after {
  width: 300px;
  height: 300px;
}

.btn-animated span {
  position: relative;
  z-index: 2;
}

/* Card animations */
.card-animated {
  transition: all 0.3s ease;
}

.card-animated:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.card-animated.rotate-hover:hover {
  transform: translateY(-5px) rotate(1deg);
}

/* Form element animations */
.form-control-animated {
  transition: all 0.3s ease;
}

.form-control-animated:focus {
  transform: scale(1.01);
}

.form-control-animated.error {
  animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
  border-color: var(--bga-error);
}

.form-control-animated.success {
  border-color: var(--bga-success);
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" fill="%2328a745"/></svg>');
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 20px;
  padding-right: 40px;
}

/* Link hover effects */
.link-underline {
  position: relative;
  text-decoration: none;
}

.link-underline::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 2px;
  bottom: -3px;
  left: 0;
  background-color: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.link-underline:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Staggered animations for lists */
.staggered-list .stagger-item {
  opacity: 0;
  transform: translateY(20px);
}

.staggered-list.animate .stagger-item {
  animation: slideInUp 0.4s ease forwards;
}

.staggered-list.animate .stagger-item:nth-child(1) { animation-delay: 0.1s; }
.staggered-list.animate .stagger-item:nth-child(2) { animation-delay: 0.2s; }
.staggered-list.animate .stagger-item:nth-child(3) { animation-delay: 0.3s; }
.staggered-list.animate .stagger-item:nth-child(4) { animation-delay: 0.4s; }
.staggered-list.animate .stagger-item:nth-child(5) { animation-delay: 0.5s; }
.staggered-list.animate .stagger-item:nth-child(6) { animation-delay: 0.6s; }
.staggered-list.animate .stagger-item:nth-child(7) { animation-delay: 0.7s; }
.staggered-list.animate .stagger-item:nth-child(8) { animation-delay: 0.8s; }
.staggered-list.animate .stagger-item:nth-child(9) { animation-delay: 0.9s; }
.staggered-list.animate .stagger-item:nth-child(10) { animation-delay: 1s; }

/* Mobile-specific animations */
@media (max-width: 767.98px) {
  .mobile-fade-in {
    animation: fadeIn 0.5s ease forwards;
  }
  
  .mobile-slide-in-up {
    animation: slideInUp 0.5s ease forwards;
  }
}

/* Loading indicators */
.loader {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--bga-green);
  animation: loader-spin 1s linear infinite;
}

@keyframes loader-spin {
  to { transform: rotate(360deg); }
}

.dots-loader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 20px;
}

.dots-loader span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--bga-green);
  animation: dots-pulse 1.4s infinite ease-in-out both;
}

.dots-loader span:nth-child(1) { animation-delay: -0.32s; }
.dots-loader span:nth-child(2) { animation-delay: -0.16s; }

@keyframes dots-pulse {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}