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

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

/* Slide Animations */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideOutLeft {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-100%);
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(100%);
  }
}

@keyframes slideInUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes slideOutDown {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(100%);
  }
}

/* Scale Animations */
@keyframes scaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes scaleOut {
  from {
    transform: scale(1);
    opacity: 1;
  }
  to {
    transform: scale(0.95);
    opacity: 0;
  }
}

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

/* Card Reveal/Hide Animations */
@keyframes cardReveal {
  0% {
    transform: translateY(6px) scale(0.99);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes cardHide {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-8px) scale(0.99);
    opacity: 0;
  }
}

@keyframes imageLoad {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* Text Animation */
@keyframes scrollText {
  0% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(calc(-100% + 100px));
  }
  100% {
    transform: translateX(0);
  }
}

/* Animation Utility Classes */

/* Fade Classes */
.fade-in {
  animation: fadeIn var(--transition-standard) forwards;
}

.fade-out {
  animation: fadeOut var(--transition-standard) forwards;
}

/* Scale Effects */
.hover-scale {
  transition: transform var(--transition-standard),
    opacity var(--transition-standard);
}

.hover-scale:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

/* Lift Effects */
.hover-lift {
  transition: transform var(--transition-standard),
    box-shadow var(--transition-standard);
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px var(--shadow-color);
}

/* Link Animation */
.link-hover {
  transition: color var(--transition-standard),
    transform var(--transition-standard);
  transform-origin: left center;
}

.link-hover:hover {
  transform: translateX(5px);
  color: var(--accent-color);
}

/* Spin Animation */
.spin {
  animation: spin 1s linear infinite;
  display: inline-block;
}

/* Card Animation Classes */
.product-card {
  will-change: transform;
}

.product-card.revealed {
  animation: cardReveal 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.product-card.hidden {
  animation: cardHide 0.7s cubic-bezier(0.4, 0.6, 0.2, 1) forwards;
}

/* Image Loading */
img[data-src] {
  opacity: 0;
  transition: opacity var(--transition-standard);
  will-change: opacity;
}

img.loaded {
  animation: imageLoad 0.7s cubic-bezier(0.4, 0.6, 0.2, 1) forwards;
}

/* Popup Animations */
.popup.active {
  animation: fadeIn 0.3s ease forwards;
}

.popup.active .popup-content {
  animation: slideInUp 0.3s ease forwards;
}

.popup.closing {
  animation: fadeOut 0.3s ease forwards;
}

.popup.closing .popup-content {
  animation: slideOutDown 0.3s ease forwards;
}

/* Navigation Overlay Animations */
.nav-overlay.active {
  animation: fadeIn 0.3s ease forwards;
  visibility: visible;
}

.nav-overlay.closing {
  animation: fadeOut 0.5s ease forwards !important;
  opacity: 1; /* Start fully visible */
  visibility: visible !important; /* Ensure it remains visible during animation */
}

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

.update-notification-toast {
  animation: slideInUp 0.3s ease forwards;
}

.update-notification-toast .countdown {
  display: inline-block;
  font-weight: bold;
  min-width: 1.2em;
  text-align: center;
  animation: pulse 1s infinite;
}

.update-message strong {
  display: block;
  margin-bottom: 5px;
}
