/* ============================================================
   ANIMATIONS.CSS - Maxikdo
   Festive, bling-bling coupon/discount platform animations
   ============================================================ */

/* ============================================================
   1. @KEYFRAMES DEFINITIONS
   ============================================================ */

/* --- Fade Ins --- */

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

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

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

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

/* --- Slides --- */

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

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

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

/* --- Scale --- */

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

/* --- Pulse --- */

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

/* --- Bounce --- */

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

/* --- Shimmer (skeleton loading) --- */

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* --- Float (gentle up-down) --- */

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-12px);
  }
}

/* --- Rotate 360 --- */

@keyframes rotate360 {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* --- Glow (orange box-shadow pulse) --- */

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(255, 140, 0, 0.4),
                0 0 10px rgba(255, 140, 0, 0.2);
  }
  50% {
    box-shadow: 0 0 15px rgba(255, 140, 0, 0.7),
                0 0 30px rgba(255, 140, 0, 0.4),
                0 0 45px rgba(255, 140, 0, 0.2);
  }
}

/* --- Confetti Fall --- */

@keyframes confettiFall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  75% {
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* --- Ticker Scroll (promo banner) --- */

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

/* --- Ripple (click effect) --- */

@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 0.6;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

/* --- Shake (error inputs) --- */

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

/* --- Countdown Pulse (urgency) --- */

@keyframes countdown-pulse {
  0%, 100% {
    transform: scale(1);
    color: inherit;
  }
  50% {
    transform: scale(1.15);
    color: #e53e3e;
  }
}

/* --- Sparkle (star flicker) --- */

@keyframes sparkle {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  25% {
    opacity: 0.4;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
  75% {
    opacity: 0.6;
    transform: scale(0.9);
  }
}

/* --- Gradient Shift (background) --- */

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* --- Stamp Reveal (coupon stamp bounce) --- */

@keyframes stampReveal {
  0% {
    transform: scale(3) rotate(-15deg);
    opacity: 0;
  }
  50% {
    transform: scale(0.9) rotate(2deg);
    opacity: 1;
  }
  70% {
    transform: scale(1.05) rotate(-1deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* --- Scissors Cut (coupon cut line) --- */

@keyframes scissorsCut {
  0% {
    clip-path: inset(0 100% 0 0);
  }
  100% {
    clip-path: inset(0 0 0 0);
  }
}

/* --- Price Slash (strikethrough on original price) --- */

@keyframes priceSlash {
  0% {
    width: 0;
  }
  100% {
    width: 100%;
  }
}


/* ============================================================
   2. UTILITY CLASSES
   ============================================================ */

/* --- Scroll-triggered animations --- */

.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  will-change: opacity, transform;
}

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

/* --- Animation delay helpers --- */

.delay-100 {
  animation-delay: 100ms;
  transition-delay: 100ms;
}

.delay-200 {
  animation-delay: 200ms;
  transition-delay: 200ms;
}

.delay-300 {
  animation-delay: 300ms;
  transition-delay: 300ms;
}

.delay-400 {
  animation-delay: 400ms;
  transition-delay: 400ms;
}

.delay-500 {
  animation-delay: 500ms;
  transition-delay: 500ms;
}

/* --- Looping animation utilities --- */

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-bounce {
  animation: bounce 1.4s ease-in-out infinite;
}

.animate-glow {
  animation: glow 2s ease-in-out infinite;
}

.animate-sparkle {
  animation: sparkle 1.8s ease-in-out infinite;
}

.animate-rotate {
  animation: rotate360 2s linear infinite;
}

.animate-shake {
  animation: shake 0.5s ease-in-out;
}

.animate-gradient {
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
}

.animate-countdown {
  animation: countdown-pulse 1s ease-in-out infinite;
}

/* --- One-shot entrance animations --- */

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out both;
}

.animate-fade-in-down {
  animation: fadeInDown 0.6s ease-out both;
}

.animate-fade-in-left {
  animation: fadeInLeft 0.6s ease-out both;
}

.animate-fade-in-right {
  animation: fadeInRight 0.6s ease-out both;
}

.animate-scale-in {
  animation: scaleIn 0.4s ease-out both;
}

.animate-slide-in-left {
  animation: slideInLeft 0.5s ease-out both;
}

.animate-slide-in-right {
  animation: slideInRight 0.5s ease-out both;
}

.animate-slide-down {
  animation: slideDown 0.4s ease-out both;
}

.animate-stamp {
  animation: stampReveal 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* --- Staggered children --- */

.stagger-children > *:nth-child(1) {
  animation-delay: 0ms;
  transition-delay: 0ms;
}

.stagger-children > *:nth-child(2) {
  animation-delay: 80ms;
  transition-delay: 80ms;
}

.stagger-children > *:nth-child(3) {
  animation-delay: 160ms;
  transition-delay: 160ms;
}

.stagger-children > *:nth-child(4) {
  animation-delay: 240ms;
  transition-delay: 240ms;
}

.stagger-children > *:nth-child(5) {
  animation-delay: 320ms;
  transition-delay: 320ms;
}

.stagger-children > *:nth-child(6) {
  animation-delay: 400ms;
  transition-delay: 400ms;
}

.stagger-children > *:nth-child(7) {
  animation-delay: 480ms;
  transition-delay: 480ms;
}

.stagger-children > *:nth-child(8) {
  animation-delay: 560ms;
  transition-delay: 560ms;
}

.stagger-children > *:nth-child(9) {
  animation-delay: 640ms;
  transition-delay: 640ms;
}

.stagger-children > *:nth-child(10) {
  animation-delay: 720ms;
  transition-delay: 720ms;
}

.stagger-children > *:nth-child(11) {
  animation-delay: 800ms;
  transition-delay: 800ms;
}

.stagger-children > *:nth-child(12) {
  animation-delay: 880ms;
  transition-delay: 880ms;
}


/* ============================================================
   3. HOVER EFFECTS
   ============================================================ */

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

.hover-lift:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15),
              0 4px 10px rgba(0, 0, 0, 0.08);
}

.hover-scale {
  transition: transform 0.3s ease;
}

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

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

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

.hover-rotate {
  transition: transform 0.3s ease;
}

.hover-rotate:hover {
  transform: rotate(3deg);
}

/* Combined hover for coupon cards */
.hover-coupon {
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.hover-coupon:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 16px 32px rgba(255, 140, 0, 0.15),
              0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: rgba(255, 140, 0, 0.4);
}

/* Shine sweep on hover (gift/bling effect) */
.hover-shine {
  position: relative;
  overflow: hidden;
}

.hover-shine::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -75%;
  width: 50%;
  height: 200%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.25),
    transparent
  );
  transform: skewX(-25deg);
  transition: left 0.6s ease;
  pointer-events: none;
}

.hover-shine:hover::after {
  left: 125%;
}


/* ============================================================
   4. PAGE TRANSITIONS
   ============================================================ */

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

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

.page-exit {
  opacity: 1;
  transform: translateY(0);
}

.page-exit-active {
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.3s ease-in, transform 0.3s ease-in;
}

/* Overlay transition for modals */
.overlay-enter {
  opacity: 0;
}

.overlay-enter-active {
  opacity: 1;
  transition: opacity 0.3s ease-out;
}

.overlay-exit {
  opacity: 1;
}

.overlay-exit-active {
  opacity: 0;
  transition: opacity 0.25s ease-in;
}

/* Modal content transition */
.modal-enter {
  opacity: 0;
  transform: scale(0.9) translateY(20px);
}

.modal-enter-active {
  opacity: 1;
  transform: scale(1) translateY(0);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.modal-exit {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.modal-exit-active {
  opacity: 0;
  transform: scale(0.9) translateY(20px);
  transition: opacity 0.2s ease-in, transform 0.2s ease-in;
}


/* ============================================================
   5. CONFETTI
   ============================================================ */

.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 9999;
}

.confetti {
  position: absolute;
  top: -10px;
  width: 10px;
  height: 10px;
  opacity: 0;
  animation: confettiFall linear forwards;
}

.confetti--1 {
  left: 5%;
  width: 12px;
  height: 12px;
  background: #ff6b35;
  animation-duration: 3.2s;
  animation-delay: 0s;
}

.confetti--2 {
  left: 15%;
  width: 8px;
  height: 14px;
  background: #ffd700;
  animation-duration: 2.8s;
  animation-delay: 0.2s;
  border-radius: 50%;
}

.confetti--3 {
  left: 25%;
  width: 10px;
  height: 10px;
  background: #e53e3e;
  animation-duration: 3.5s;
  animation-delay: 0.5s;
}

.confetti--4 {
  left: 35%;
  width: 14px;
  height: 8px;
  background: #ff8c00;
  animation-duration: 3s;
  animation-delay: 0.1s;
  border-radius: 2px;
}

.confetti--5 {
  left: 45%;
  width: 10px;
  height: 10px;
  background: #48bb78;
  animation-duration: 3.3s;
  animation-delay: 0.7s;
  border-radius: 50%;
}

.confetti--6 {
  left: 55%;
  width: 8px;
  height: 12px;
  background: #ffd700;
  animation-duration: 2.9s;
  animation-delay: 0.3s;
}

.confetti--7 {
  left: 65%;
  width: 12px;
  height: 12px;
  background: #ff6b35;
  animation-duration: 3.4s;
  animation-delay: 0.6s;
  border-radius: 50%;
}

.confetti--8 {
  left: 75%;
  width: 10px;
  height: 8px;
  background: #e53e3e;
  animation-duration: 3.1s;
  animation-delay: 0.15s;
  border-radius: 2px;
}

.confetti--9 {
  left: 85%;
  width: 8px;
  height: 14px;
  background: #ff8c00;
  animation-duration: 2.7s;
  animation-delay: 0.45s;
}

.confetti--10 {
  left: 95%;
  width: 12px;
  height: 10px;
  background: #ffd700;
  animation-duration: 3.6s;
  animation-delay: 0.8s;
  border-radius: 50%;
}

/* Star-shaped confetti pieces */
.confetti--star {
  clip-path: polygon(
    50% 0%, 61% 35%, 98% 35%, 68% 57%,
    79% 91%, 50% 70%, 21% 91%, 32% 57%,
    2% 35%, 39% 35%
  );
}

.confetti--star.confetti--1 {
  background: #ffd700;
}

.confetti--star.confetti--3 {
  background: #ff8c00;
}


/* ============================================================
   6. LOADING STATES
   ============================================================ */

/* --- Skeleton shimmer --- */

.skeleton {
  background: linear-gradient(
    90deg,
    #e8e8e8 25%,
    #f5f5f5 50%,
    #e8e8e8 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-text {
  height: 14px;
  margin-bottom: 10px;
  border-radius: 4px;
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-text--title {
  height: 22px;
  width: 70%;
  margin-bottom: 14px;
}

.skeleton-text--subtitle {
  height: 16px;
  width: 50%;
}

.skeleton-image {
  width: 100%;
  height: 200px;
  border-radius: 8px;
}

.skeleton-image--square {
  aspect-ratio: 1;
  height: auto;
}

.skeleton-image--avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.skeleton-card {
  padding: 16px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.skeleton-card .skeleton-image {
  margin-bottom: 14px;
}

.skeleton-badge {
  width: 80px;
  height: 28px;
  border-radius: 14px;
}

.skeleton-button {
  width: 120px;
  height: 40px;
  border-radius: 8px;
}

/* --- Spinner --- */

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e8e8e8;
  border-top-color: #ff8c00;
  border-radius: 50%;
  animation: rotate360 0.8s linear infinite;
}

.spinner--sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.spinner--lg {
  width: 52px;
  height: 52px;
  border-width: 4px;
}

.spinner--white {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
}

/* Full-page loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  z-index: 9998;
  animation: fadeInUp 0.3s ease-out;
}

/* Dot pulse loader */
.loader-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.loader-dots span {
  width: 10px;
  height: 10px;
  background: #ff8c00;
  border-radius: 50%;
  animation: pulse 1.2s ease-in-out infinite;
}

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

.loader-dots span:nth-child(3) {
  animation-delay: 0.4s;
}


/* ============================================================
   7. SPECIAL COUPON / PROMO EFFECTS
   ============================================================ */

/* Ticker banner for promo strip */
.ticker-banner {
  overflow: hidden;
  white-space: nowrap;
}

.ticker-banner__content {
  display: inline-block;
  animation: tickerScroll 20s linear infinite;
}

/* Ripple on click */
.ripple-effect {
  position: relative;
  overflow: hidden;
}

.ripple-effect .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 140, 0, 0.3);
  transform: scale(0);
  animation: ripple 0.6s ease-out;
  pointer-events: none;
}

/* Price slash strikethrough */
.price-original {
  position: relative;
  display: inline-block;
  color: #999;
}

.price-original::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  height: 2px;
  width: 0;
  background: #e53e3e;
  transform: translateY(-50%) rotate(-5deg);
  animation: priceSlash 0.4s 0.2s ease-out forwards;
}

/* Scissors cut line */
.scissors-cut {
  position: relative;
  overflow: hidden;
}

.scissors-cut::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  animation: scissorsCut 0.8s ease-out forwards;
}

/* Coupon stamp */
.coupon-stamp {
  animation: stampReveal 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Percentage badge pop */
.badge-pop {
  animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Countdown timer digits */
.countdown-digit {
  display: inline-block;
  animation: countdown-pulse 1s ease-in-out infinite;
}

.countdown-digit--urgent {
  animation: countdown-pulse 0.5s ease-in-out infinite;
  color: #e53e3e;
}

/* Sparkle stars for bling effect */
.sparkle-star {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #ffd700;
  clip-path: polygon(
    50% 0%, 61% 35%, 98% 35%, 68% 57%,
    79% 91%, 50% 70%, 21% 91%, 32% 57%,
    2% 35%, 39% 35%
  );
  animation: sparkle 1.5s ease-in-out infinite;
  pointer-events: none;
}

.sparkle-star:nth-child(2) {
  animation-delay: 0.3s;
  width: 8px;
  height: 8px;
}

.sparkle-star:nth-child(3) {
  animation-delay: 0.6s;
  width: 5px;
  height: 5px;
}

.sparkle-star:nth-child(4) {
  animation-delay: 0.9s;
  width: 7px;
  height: 7px;
}

/* Gift bow bounce */
.gift-bounce {
  animation: bounce 1.4s ease-in-out;
  transform-origin: center bottom;
}


/* ============================================================
   8. REDUCED MOTION (ACCESSIBILITY)
   ============================================================ */

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .animate-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .animate-float,
  .animate-pulse,
  .animate-bounce,
  .animate-glow,
  .animate-sparkle,
  .animate-rotate,
  .animate-gradient,
  .animate-countdown {
    animation: none;
  }

  .hover-lift:hover {
    transform: none;
  }

  .hover-scale:hover {
    transform: none;
  }

  .hover-rotate:hover {
    transform: none;
  }

  .hover-shine::after {
    display: none;
  }

  .ticker-banner__content {
    animation: none;
  }

  .confetti-container {
    display: none;
  }

  .skeleton {
    animation: none;
    background: #e8e8e8;
  }

  .spinner {
    animation: none;
    border-top-color: transparent;
    opacity: 0.5;
  }

  .countdown-digit,
  .countdown-digit--urgent {
    animation: none;
  }

  .sparkle-star {
    animation: none;
    opacity: 0.6;
  }
}
