/* ==============================================
   ADV Add Cart V2.0 - Special Effects & Animations
   Unique animation names to avoid conflicts with FAAC
   ============================================== */

/* ==============================================
   LOADER STYLES - Apple-inspired smooth animations
   ============================================== */

/* Bouncing Dots - Apple Style */
.advcart-v2-dots-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  width: 60px;
}

.advcart-v2-dot {
  width: 10px;
  height: 10px;
  background-color: #ffffff;
  border-radius: 50%;
  animation: advcart-bounce-dot 1.4s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

.advcart-v2-dot:nth-child(1) {
  animation-delay: 0s;
}

.advcart-v2-dot:nth-child(2) {
  animation-delay: 0.16s;
}

.advcart-v2-dot:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes advcart-bounce-dot {
  0%, 80%, 100% {
    transform: scale(0.7) translateY(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1) translateY(-12px);
    opacity: 1;
  }
}

/* Pulse Circle - Apple Style */
.advcart-v2-pulse {
  width: 40px;
  height: 40px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  animation: advcart-pulse-ring 1.5s cubic-bezier(0.215, 0.610, 0.355, 1.000) infinite;
}

@keyframes advcart-pulse-ring {
  0% {
    transform: scale(0.95);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.7;
  }
  100% {
    transform: scale(0.95);
    opacity: 1;
  }
}

/* Wave Bars - Apple Style */
.advcart-v2-bars-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 3px;
  width: 50px;
  height: 40px;
}

.advcart-v2-bar {
  width: 4px;
  height: 100%;
  background-color: #ffffff;
  border-radius: 2px;
  animation: advcart-wave-bar 1.2s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
  opacity: 0.3;
}

.advcart-v2-bar:nth-child(1) {
  animation-delay: 0s;
}

.advcart-v2-bar:nth-child(2) {
  animation-delay: 0.1s;
}

.advcart-v2-bar:nth-child(3) {
  animation-delay: 0.2s;
}

.advcart-v2-bar:nth-child(4) {
  animation-delay: 0.3s;
}

.advcart-v2-bar:nth-child(5) {
  animation-delay: 0.4s;
}

@keyframes advcart-wave-bar {
  0%, 100% {
    transform: scaleY(0.4);
    opacity: 0.3;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

/* Ripple - Apple Style */
.advcart-v2-ripple-wrapper {
  position: relative;
  width: 60px;
  height: 60px;
}

.advcart-v2-ripple {
  position: absolute;
  border: 2px solid #ffffff;
  opacity: 1;
  border-radius: 50%;
  animation: advcart-ripple 2s cubic-bezier(0.215, 0.610, 0.355, 1.000) infinite;
}

.advcart-v2-ripple:nth-child(2) {
  animation-delay: -1s;
}

@keyframes advcart-ripple {
  0% {
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    margin-top: 0;
    margin-left: 0;
    opacity: 1;
  }
  100% {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin-top: 0;
    margin-left: 0;
    opacity: 0;
  }
}

/* ==============================================
   GLOW EFFECT (With customizable color)
   ============================================== */

.adv-effect-glow {
  --glow-color: #e74c3c;
  animation: adv-glow 2s ease-in-out infinite alternate;
}

@keyframes adv-glow {
  from {
    text-shadow: 0 0 5px var(--glow-color),
                 0 0 10px var(--glow-color),
                 0 0 15px var(--glow-color);
  }
  to {
    text-shadow: 0 0 10px var(--glow-color),
                 0 0 20px var(--glow-color),
                 0 0 30px var(--glow-color),
                 0 0 40px var(--glow-color);
  }
}

.adv-cart-v2-sale-badge.adv-effect-glow {
  --glow-color: #e74c3c;
  animation: adv-badge-glow 2s ease-in-out infinite alternate;
}

@keyframes adv-badge-glow {
  from {
    box-shadow: 0 0 5px var(--glow-color),
                0 0 10px var(--glow-color);
  }
  to {
    box-shadow: 0 0 15px var(--glow-color),
                0 0 25px var(--glow-color),
                0 0 35px var(--glow-color);
  }
}

/* ==============================================
   PULSE EFFECT
   ============================================== */

.adv-effect-pulse {
  animation: adv-pulse 1.5s ease-in-out infinite;
}

@keyframes adv-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.9;
  }
}

.adv-cart-v2-sale-badge.adv-effect-pulse {
  animation: adv-badge-pulse 1.5s ease-in-out infinite;
}

@keyframes adv-badge-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* ==============================================
   BOUNCE EFFECT
   ============================================== */

.adv-effect-bounce {
  animation: adv-bounce 2s ease-in-out infinite;
}

@keyframes adv-bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

.adv-cart-v2-sale-badge.adv-effect-bounce {
  animation: adv-badge-bounce 2s ease-in-out infinite;
}

@keyframes adv-badge-bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0) scale(1);
  }
  40% {
    transform: translateY(-5px) scale(1.05);
  }
  60% {
    transform: translateY(-2px) scale(1.02);
  }
}

/* ==============================================
   SHAKE EFFECT
   ============================================== */

.adv-effect-shake {
  animation: adv-shake 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) infinite;
}

@keyframes adv-shake {
  10%, 90% {
    transform: translate3d(-1px, 0, 0);
  }
  20%, 80% {
    transform: translate3d(2px, 0, 0);
  }
  30%, 50%, 70% {
    transform: translate3d(-3px, 0, 0);
  }
  40%, 60% {
    transform: translate3d(3px, 0, 0);
  }
}

/* ==============================================
   FADE-IN EFFECT (For initial load)
   ============================================== */

.adv-fade-in {
  animation: adv-fade-in 0.5s ease-in-out;
}

@keyframes adv-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==============================================
   SLIDE-IN EFFECT
   ============================================== */

.adv-slide-in-right {
  animation: adv-slide-in-right 0.4s ease-out;
}

@keyframes adv-slide-in-right {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.adv-slide-in-left {
  animation: adv-slide-in-left 0.4s ease-out;
}

@keyframes adv-slide-in-left {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==============================================
   ROTATE EFFECT (Subtle)
   ============================================== */

.adv-effect-rotate {
  animation: adv-rotate 3s linear infinite;
}

@keyframes adv-rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ==============================================
   FLASH EFFECT
   ============================================== */

.adv-effect-flash {
  animation: adv-flash 2s ease-in-out infinite;
}

@keyframes adv-flash {
  0%, 50%, 100% {
    opacity: 1;
  }
  25%, 75% {
    opacity: 0.7;
  }
}

/* ==============================================
   HEARTBEAT EFFECT
   ============================================== */

.adv-effect-heartbeat {
  animation: adv-heartbeat 1.5s ease-in-out infinite;
}

@keyframes adv-heartbeat {
  0%, 100% {
    transform: scale(1);
  }
  10%, 30% {
    transform: scale(1.1);
  }
  20%, 40% {
    transform: scale(0.95);
  }
}

/* ==============================================
   TADA EFFECT (Attention grabber)
   ============================================== */

.adv-effect-tada {
  animation: adv-tada 1.5s ease-in-out infinite;
}

@keyframes adv-tada {
  0% {
    transform: scale(1) rotate(0deg);
  }
  10%, 20% {
    transform: scale(0.9) rotate(-3deg);
  }
  30%, 50%, 70%, 90% {
    transform: scale(1.1) rotate(3deg);
  }
  40%, 60%, 80% {
    transform: scale(1.1) rotate(-3deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

/* ==============================================
   WOBBLE EFFECT
   ============================================== */

.adv-effect-wobble {
  animation: adv-wobble 2s ease-in-out infinite;
}

@keyframes adv-wobble {
  0%, 100% {
    transform: translateX(0) rotate(0deg);
  }
  15% {
    transform: translateX(-5px) rotate(-5deg);
  }
  30% {
    transform: translateX(4px) rotate(3deg);
  }
  45% {
    transform: translateX(-3px) rotate(-3deg);
  }
  60% {
    transform: translateX(2px) rotate(2deg);
  }
  75% {
    transform: translateX(-1px) rotate(-1deg);
  }
}

/* ==============================================
   SWING EFFECT
   ============================================== */

.adv-effect-swing {
  animation: adv-swing 2s ease-in-out infinite;
  transform-origin: top center;
}

@keyframes adv-swing {
  20% {
    transform: rotate(15deg);
  }
  40% {
    transform: rotate(-10deg);
  }
  60% {
    transform: rotate(5deg);
  }
  80% {
    transform: rotate(-5deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

/* ==============================================
   ZOOM-IN EFFECT (On hover for elements)
   ============================================== */

.adv-hover-zoom {
  transition: transform 0.3s ease;
}

.adv-hover-zoom:hover {
  transform: scale(1.1);
}

/* ==============================================
   NEON GLOW (Enhanced glow with colors)
   ============================================== */

.adv-effect-neon {
  animation: adv-neon 1.5s ease-in-out infinite alternate;
}

@keyframes adv-neon {
  from {
    text-shadow: 0 0 10px #fff,
                 0 0 20px #fff,
                 0 0 30px #e74c3c,
                 0 0 40px #e74c3c,
                 0 0 50px #e74c3c;
  }
  to {
    text-shadow: 0 0 20px #fff,
                 0 0 30px #ff4500,
                 0 0 40px #ff4500,
                 0 0 50px #ff4500,
                 0 0 60px #ff4500,
                 0 0 70px #ff4500;
  }
}

/* ==============================================
   RESPONSIVE ADJUSTMENTS
   ============================================== */

@media (max-width: 768px) {
  /* Reduce animation intensity on mobile for performance */
  .adv-effect-glow,
  .adv-effect-pulse,
  .adv-effect-bounce,
  .adv-effect-shake,
  .adv-effect-tada,
  .adv-effect-wobble,
  .adv-effect-swing,
  .adv-effect-heartbeat,
  .adv-effect-neon {
    animation-duration: calc(1.5 * var(--animation-duration, 2s));
  }
}

/* ==============================================
   PREFERS REDUCED MOTION
   ============================================== */

@media (prefers-reduced-motion: reduce) {
  .adv-effect-glow,
  .adv-effect-pulse,
  .adv-effect-bounce,
  .adv-effect-shake,
  .adv-effect-flash,
  .adv-effect-heartbeat,
  .adv-effect-tada,
  .adv-effect-wobble,
  .adv-effect-swing,
  .adv-effect-rotate,
  .adv-effect-neon,
  .adv-fade-in,
  .adv-slide-in-right,
  .adv-slide-in-left {
    animation: none !important;
    transition: none !important;
  }
}

/* ==============================================
   ADVANCED CLICK TRANSITIONS
   ============================================== */

/* Base spinner overlay */
.faac-spinner-overlay {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Success checkmark (hidden by default) */
.faac-success-check {
  position: absolute;
  font-size: 40px;
  color: #22c55e;
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s ease;
}

/* Fade & Scale Effect */
.faac-spinner-overlay.adv-effect-fade-scale.active {
  animation: fadeScaleIn 0.3s ease forwards;
}

@keyframes fadeScaleIn {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Slide Up Effect */
.faac-spinner-overlay.adv-effect-slide-up.active {
  animation: slideUpIn 0.3s ease forwards;
}

@keyframes slideUpIn {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Flip Effect */
.faac-spinner-overlay.adv-effect-flip.active {
  animation: flipIn 0.5s ease forwards;
}

@keyframes flipIn {
  0% {
    opacity: 0;
    transform: perspective(400px) rotateX(-90deg);
  }
  100% {
    opacity: 1;
    transform: perspective(400px) rotateX(0deg);
  }
}

/* Zoom & Rotate Effect */
.faac-spinner-overlay.adv-effect-zoom-rotate.active {
  animation: zoomRotateIn 0.4s ease forwards;
}

@keyframes zoomRotateIn {
  0% {
    opacity: 0;
    transform: scale(0) rotate(-180deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* Success Checkmark Effect */
.faac-spinner-overlay.adv-effect-success.active .faac-spinner {
  animation: spinnerToCheck 0.6s ease forwards;
}

.faac-spinner-overlay.adv-effect-success.active .faac-success-check {
  animation: checkmarkAppear 0.6s ease 0.3s forwards;
}

@keyframes spinnerToCheck {
  0% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1) rotate(360deg);
  }
  70% {
    opacity: 0;
    transform: scale(0.5);
  }
  100% {
    opacity: 0;
    transform: scale(0);
  }
}

@keyframes checkmarkAppear {
  0% {
    opacity: 0;
    transform: scale(0) rotate(-45deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.2) rotate(0deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* Button state transitions */
.aac-add-btn {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.aac-add-btn:active {
  transform: scale(0.95);
}

/* Smooth transition for button to quantity controls */
.advanced-add-to-cart {
  transition: all 0.3s ease;
}