/* Liquid Glass Cart Animations */

/* Optimized Fade In Animation */
@keyframes optimizedFadeIn {
  0% { 
    opacity: 0; 
    transform: translateY(20px);
  }
  100% { 
    opacity: 1; 
    transform: translateY(0);
  }
}

/* Optimized Cart Entrance Animation */
.cart-content {
  animation: optimizedFadeIn 0.5s ease-out;
}

/* Optimized Empty Cart Animation */
.cart-empty {
  animation: optimizedFadeIn 0.6s ease-out;
}

.cart-empty-icon {
  animation: simpleFloat 2s infinite ease-in-out;
}

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

/* Simplified Button Hover Effects */
.btn-continue-shopping,
.btn-clear-cart,
.btn-checkout,
.sidebar-checkout-btn {
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.btn-continue-shopping:hover,
.btn-clear-cart:hover,
.btn-checkout:hover,
.sidebar-checkout-btn:hover {
  transform: translateY(-2px);
}

/* Optimized Cart Item Animations */
.cart-item {
  animation: slideIn 0.4s ease-out;
  animation-fill-mode: both;
}

.cart-item:nth-child(1) { animation-delay: 0.05s; }
.cart-item:nth-child(2) { animation-delay: 0.1s; }
.cart-item:nth-child(3) { animation-delay: 0.15s; }
.cart-item:nth-child(4) { animation-delay: 0.2s; }
.cart-item:nth-child(5) { animation-delay: 0.25s; }

@keyframes slideIn {
  0% {
    opacity: 0;
    transform: translateX(-20px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Simplified Quantity Button Animations */
.cart-qty-button {
  transition: transform 0.2s ease;
}

.cart-qty-button:active {
  transform: scale(0.92);
}

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

/* Remove complex ripple effects */
/* Ripple effects removed for better performance */

/* Optimized remove item animation */
.cart-item.removing {
  animation: removeItem 0.3s forwards;
}

@keyframes removeItem {
  0% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(30px); height: 0; margin: 0; padding: 0; }
}

/* Item update flash animation */
@keyframes itemUpdated {
  0% { background-color: transparent; }
  50% { background-color: rgba(198, 165, 124, 0.15); }
  100% { background-color: transparent; }
}

.cart-item.updated {
  animation: itemUpdated 0.8s ease;
}

/* Modal animations */
.modal-overlay {
  transition: opacity 0.25s ease;
  will-change: opacity;
}

.modal-container {
  transition: transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1),
              opacity 0.25s ease;
  will-change: transform, opacity;
}

/* Loading spinner animation */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  animation: spin 1s linear infinite;
  will-change: transform;
}

/* Optimized Button Pulse Animation */
.cart-empty .btn-continue-shopping {
  animation: buttonPulse 3s infinite ease-in-out;
  will-change: box-shadow;
}

@keyframes buttonPulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(198, 165, 124, 0.25); }
  50% { box-shadow: 0 6px 20px rgba(198, 165, 124, 0.45); }
}

/* Liquid Glass Summary Animations */
.cart-summary {
  animation: liquidSummaryEntrance 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.3s both;
}

@keyframes liquidSummaryEntrance {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.8);
    filter: blur(10px);
  }
  50% {
    opacity: 0.7;
    transform: translateY(20px) scale(0.9);
    filter: blur(5px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* Cart Summary Row Hover Animation */
.cart-summary-row {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-summary-row:hover {
  transform: translateX(5px);
  background: rgba(255, 255, 255, 0.1);
}

/* Loading Spinner Enhanced Animation */
@keyframes liquidSpinner {
  0% { 
    transform: rotate(0deg) scale(1);
    border-top-color: var(--gold);
    filter: brightness(1);
  }
  25% { 
    transform: rotate(90deg) scale(1.1);
    border-top-color: #d4b78e;
    filter: brightness(1.2);
  }
  50% { 
    transform: rotate(180deg) scale(1);
    border-top-color: var(--navy-accent);
    filter: brightness(0.8);
  }
  75% { 
    transform: rotate(270deg) scale(1.1);
    border-top-color: #d4b78e;
    filter: brightness(1.2);
  }
  100% { 
    transform: rotate(360deg) scale(1);
    border-top-color: var(--gold);
    filter: brightness(1);
  }
}

.spinner {
  animation: liquidSpinner 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Floating Particle Effect for Background */
.cart-page-container::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 25% 25%, rgba(198, 165, 124, 0.1) 2px, transparent 2px),
    radial-gradient(circle at 75% 75%, rgba(0, 21, 86, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, rgba(198, 165, 124, 0.08) 1px, transparent 1px);
  background-size: 50px 50px, 30px 30px, 40px 40px;
  animation: floatingParticles 20s linear infinite;
  pointer-events: none;
  z-index: -1;
  opacity: 0.3;
}

@keyframes floatingParticles {
  0% { transform: translateY(0px) translateX(0px); }
  25% { transform: translateY(-20px) translateX(10px); }
  50% { transform: translateY(-40px) translateX(-5px); }
  75% { transform: translateY(-20px) translateX(-10px); }
  100% { transform: translateY(0px) translateX(0px); }
}

/* Mobile Animation Optimizations */
@media (max-width: 768px) {
  .cart-page-container::after {
    animation-duration: 30s;
    opacity: 0.2;
  }
  
  .cart-item {
    animation-duration: 0.4s;
  }
  
  .liquidFloat {
    animation-duration: 4s;
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .cart-item,
  .cart-summary,
  .cart-empty,
  .spinner {
    animation: none;
  }
  
  .cart-page-container::after {
    animation: none;
  }
  
  .cart-qty-button:hover,
  .cart-item:hover {
    transform: none;
  }
}
