/* Animations and transitions */

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

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

/* Slide in from bottom */
@keyframes slideInFromBottom {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.slide-in-bottom {
  animation: slideInFromBottom 0.5s ease-out forwards;
}

/* Slide in from right */
@keyframes slideInFromRight {
  from {
    transform: translateX(20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

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

.pulse {
  animation: pulse 2s infinite;
}

/* Hover effects */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 15px rgba(26, 54, 93, 0.5);
}

/* Animated underline */
.animated-underline {
  position: relative;
}

.animated-underline::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -2px;
  left: 0;
  background-color: var(--color-accent);
  transition: width 0.3s ease;
  border-radius: var(--radius-full);
}

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

/* Feature icon animations */
.feature-icon {
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.feature-icon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.feature-card:hover .feature-icon {
  transform: scale(1.1);
}

.feature-card:hover .feature-icon::before {
  opacity: 1;
}

/* Staggered animations for grid items */
.broker-card, .education-card, .feature-card {
  opacity: 0;
  transform: translateY(20px);
}

.broker-card.visible, .education-card.visible, .feature-card.visible {
  animation: slideInFromBottom 0.5s ease-out forwards;
}

/* Delaying animations with CSS variables */
.brokers-grid > *:nth-child(1) { --animation-order: 1; }
.brokers-grid > *:nth-child(2) { --animation-order: 2; }
.brokers-grid > *:nth-child(3) { --animation-order: 3; }
.brokers-grid > *:nth-child(4) { --animation-order: 4; }
.brokers-grid > *:nth-child(5) { --animation-order: 5; }
.brokers-grid > *:nth-child(6) { --animation-order: 6; }

.visible {
  animation-delay: calc(var(--animation-order) * 0.1s);
}

/* Header scroll effect */
.site-header.scrolled {
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-lg);
}

/* Mobile menu toggle animation */
.mobile-menu-toggle.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* Star rating animation */
.star-rating {
  position: relative;
}

.star-rating .stars-active {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  white-space: nowrap;
  color: var(--color-accent);
  transition: width 1s ease-in-out;
}

.star-rating .stars-inactive {
  color: var(--color-gray-300);
}

/* Button hover effect */
.btn-primary:hover, .btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(26, 54, 93, 0.15);
}

.btn-primary:active, .btn-secondary:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(26, 54, 93, 0.15);
}