/**
 * 618 campaign — product & UI motion (respects prefers-reduced-motion)
 */

@keyframes s618-fade-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes s618-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes s618-scale-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes s618-badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes s618-shine {
  0% { left: -100%; }
  100% { left: 120%; }
}

@keyframes s618-spin-gold {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes s618-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Staggered product grid entrance */
#main-content .priceRate.s618-animate-in {
  animation: s618-fade-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  animation-delay: var(--s618-delay, 0s);
}

#main-content .flash-content.s618-animate-in,
#main-content .content.active > .flash-content {
  animation: s618-scale-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

/* Product card hover */
#main-content .product-item {
  transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
}

#main-content .product-item:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 28px rgba(255, 87, 34, 0.22);
  border-color: #ff5722;
}

#main-content .product-item .swiper-slide img {
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

#main-content .product-item:hover .swiper-slide-active img {
  transform: scale(1.05);
}

/* Hot label */
#main-content .bg-star {
  animation: s618-badge-pulse 2.2s ease-in-out infinite;
}

/* Buy button shine on hover */
#main-content .btn-buy {
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#main-content .btn-buy::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 55%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0.35) 45%,
    transparent 100%
  );
  pointer-events: none;
}

#main-content .btn-buy:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 14px rgba(255, 87, 34, 0.45);
}

#main-content .btn-buy:hover::after {
  animation: s618-shine 0.65s ease;
}

/* Countdown block */
#main-content .flash-content #countdown li span {
  transition: transform 0.15s ease;
}

#main-content .flash-content #countdown ul:hover li span {
  transform: scale(1.08);
}

/* Store slider cards */
#main-content .box03.s618-animate-in {
  animation: s618-fade-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  animation-delay: var(--s618-delay, 0s);
}

#main-content .box03 {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#main-content .box03:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* Back to top */
#main-content .back-to-top {
  transition: transform 0.25s ease, background-color 0.25s ease, color 0.25s ease;
}

#main-content .back-to-top:hover {
  transform: translateY(-3px);
}

#main-content .back-to-top.s618-visible {
  animation: s618-float 2.5s ease-in-out infinite;
}

/* Navbar flash tab subtle glow */
#main-content .navbar-nav .nav-link#flash {
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

#main-content .navbar-nav .nav-link#flash:hover,
#main-content .navbar-nav .nav-link#flash.active {
  box-shadow: 0 4px 12px rgba(255, 87, 34, 0.45);
}

/* Tab content switch (visible panel children) */
#main-content .content.active .container > .row > .priceRate {
  /* re-stagger handled by JS on tab change */
}

/* Loading spinner — campaign colors */
.loading-spinner {
  border-color: rgba(249, 212, 35, 0.35);
  border-top-color: #ff5722;
  animation: s618-spin-gold 0.85s linear infinite;
}

/* Section fade when switching category */
#main-content .content.s618-tab-enter .priceRate {
  animation: s618-fade-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  animation-delay: var(--s618-delay, 0s);
}

@media (prefers-reduced-motion: reduce) {
  #main-content .priceRate.s618-animate-in,
  #main-content .flash-content.s618-animate-in,
  #main-content .content.active > .flash-content,
  #main-content .content.s618-tab-enter .priceRate,
  #main-content .bg-star,
  #main-content .back-to-top.s618-visible,
  .loading-spinner {
    animation: none !important;
  }

  #main-content .product-item,
  #main-content .product-item .swiper-slide img,
  #main-content .btn-buy,
  #main-content .box03,
  #main-content .back-to-top,
  #main-content .navbar-nav .nav-link#flash {
    transition: none !important;
  }

  #main-content .product-item:hover,
  #main-content .btn-buy:hover {
    transform: none;
  }
}
