/**
 * EQUACOM Store Theme - Advanced Animations
 * Animaciones adicionales y efectos visuales
 */

/* ========================================
   ENTRANCE ANIMATIONS
   ======================================== */

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

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

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

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

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

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

@keyframes scaleInBounce {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

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

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

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

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

/* ========================================
   CONTINUOUS ANIMATIONS
   ======================================== */

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

/* Subtle pulse for buttons */
@keyframes pulseSubtle {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 140, 0, 0.4);
  }
  50% {
    box-shadow: 0 0 0 15px rgba(255, 140, 0, 0);
  }
}

/* Float effect */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

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

/* Swing */
@keyframes swing {
  20% {
    transform: rotate(15deg);
  }
  40% {
    transform: rotate(-10deg);
  }
  60% {
    transform: rotate(5deg);
  }
  80% {
    transform: rotate(-5deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

/* Shake */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

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

/* ========================================
   SPECIAL EFFECTS
   ======================================== */

/* Shimmer loading effect */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Glow effect */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(255, 140, 0, 0.5),
                0 0 10px rgba(255, 140, 0, 0.3),
                0 0 15px rgba(255, 140, 0, 0.1);
  }
  50% {
    box-shadow: 0 0 10px rgba(255, 140, 0, 0.8),
                0 0 20px rgba(255, 140, 0, 0.5),
                0 0 30px rgba(255, 140, 0, 0.3);
  }
}

/* Text gradient animation */
@keyframes gradientText {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.animated-gradient-text {
  background: linear-gradient(
    90deg,
    hsl(24, 100%, 50%),
    hsl(45, 100%, 51%),
    hsl(262, 83%, 58%),
    hsl(24, 100%, 50%)
  );
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientText 4s ease infinite;
}

/* Ripple effect */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: scale(0);
  pointer-events: none;
}

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

/* ========================================
   MARQUEE ANIMATIONS
   ======================================== */

@keyframes marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

@keyframes marqueeReverse {
  0% {
    transform: translateX(-50%);
  }
  100% {
    transform: translateX(0);
  }
}

.marquee {
  display: flex;
  animation: marquee 30s linear infinite;
}

.marquee:hover {
  animation-play-state: paused;
}

.marquee-reverse {
  animation: marqueeReverse 30s linear infinite;
}

/* ========================================
   WHATSAPP BUTTON ANIMATION
   ======================================== */

@keyframes whatsappPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
  }
  70% {
    box-shadow: 0 0 0 20px rgba(37, 211, 102, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
  }
}

.whatsapp-btn {
  animation: whatsappPulse 2s infinite;
}

/* ========================================
   CART BADGE ANIMATION
   ======================================== */

@keyframes cartBadgePop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

.cart-badge.updated {
  animation: cartBadgePop 0.3s ease;
}

/* ========================================
   LOADING ANIMATIONS
   ======================================== */

/* Spinner */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 140, 0, 0.3);
  border-top-color: hsl(24, 100%, 50%);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Dots loading */
@keyframes dotsLoading {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

.dots-loading {
  display: flex;
  gap: 8px;
}

.dots-loading span {
  width: 12px;
  height: 12px;
  background: hsl(24, 100%, 50%);
  border-radius: 50%;
  animation: dotsLoading 1.4s ease-in-out infinite both;
}

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

/* Skeleton loading */
.skeleton {
  background: linear-gradient(
    90deg,
    hsl(220, 14%, 96%) 25%,
    hsl(220, 14%, 90%) 50%,
    hsl(220, 14%, 96%) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

/* ========================================
   HOVER EFFECTS
   ======================================== */

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

.hover-lift:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Scale effect */
.hover-scale {
  transition: transform 0.3s ease;
}

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

/* Glow effect on hover */
.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 30px rgba(255, 140, 0, 0.4);
}

/* Underline effect */
.hover-underline {
  position: relative;
}

.hover-underline::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(135deg, hsl(24, 100%, 50%), hsl(45, 100%, 51%));
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

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

/* ========================================
   PAGE TRANSITION
   ======================================== */

.page-transition-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-transition-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.page-transition-exit {
  opacity: 1;
}

.page-transition-exit-active {
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* ========================================
   TOAST ANIMATIONS
   ======================================== */

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 16px 24px;
  background: hsl(222, 47%, 11%);
  color: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  transform: translateX(120%);
  transition: transform 0.3s ease;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast.show {
  transform: translateX(0);
}

.toast-success {
  border-left: 4px solid hsl(142, 76%, 36%);
}

.toast-error {
  border-left: 4px solid hsl(0, 84%, 60%);
}

.toast-warning {
  border-left: 4px solid hsl(38, 92%, 50%);
}

.toast-info {
  border-left: 4px solid hsl(199, 89%, 48%);
}

.toast-close {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.toast-close:hover {
  opacity: 1;
}

/* ========================================
   ANIMATION UTILITY CLASSES
   ======================================== */

.animate-fade-in { animation: fadeIn 0.6s ease forwards; }
.animate-fade-in-up { animation: fadeInUp 0.6s ease forwards; }
.animate-fade-in-down { animation: fadeInDown 0.6s ease forwards; }
.animate-fade-in-left { animation: fadeInLeft 0.6s ease forwards; }
.animate-fade-in-right { animation: fadeInRight 0.6s ease forwards; }

.animate-scale-in { animation: scaleIn 0.4s ease forwards; }
.animate-scale-bounce { animation: scaleInBounce 0.6s ease forwards; }

.animate-slide-in-right { animation: slideInRight 0.5s ease forwards; }
.animate-slide-in-left { animation: slideInLeft 0.5s ease forwards; }
.animate-slide-in-up { animation: slideInUp 0.5s ease forwards; }
.animate-slide-in-down { animation: slideInDown 0.5s ease forwards; }

.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-bounce { animation: bounce 2s ease infinite; }
.animate-swing { animation: swing 1s ease infinite; }
.animate-shake { animation: shake 0.5s ease; }
.animate-glow { animation: glow 2s ease-in-out infinite; }

/* Animation delays */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-900 { animation-delay: 0.9s; }
.delay-1000 { animation-delay: 1s; }

/* Initial state for animated elements */
[data-animate] {
  opacity: 0;
}

[data-animate="fade-up"] {
  transform: translateY(30px);
}

[data-animate="fade-down"] {
  transform: translateY(-30px);
}

[data-animate="fade-left"] {
  transform: translateX(-30px);
}

[data-animate="fade-right"] {
  transform: translateX(30px);
}

[data-animate="scale"] {
  transform: scale(0.9);
}

/* Visible state */
[data-animate].visible {
  opacity: 1;
  transform: translate(0) scale(1);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
