#cart {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: #ff4d6d;
  color: white;
  padding: 18px 28px;
  border-radius: 50px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
  z-index: 10001 !important;
  background-color: #ff4d6d !important;
}

/* Updated #cart-overlay styles */
#cart-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 9998 !important;
  pointer-events: none;
  transition: opacity 0.3s ease;
  opacity: 0;
}

#cart-overlay.active {
  display: block;
  pointer-events: auto;
  opacity: 1;
}

/* Updated #cart-modal styles */
#cart-modal {
  position: fixed;
  left: 50%;
  transform: translate(-50%, 0) scale(0.8);
  opacity: 0;
  transition: all 0.3s ease;
  bottom: 160px;
  width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  background: white;
  border-radius: 24px;
  box-shadow: 0 16px 60px rgba(0,0,0,0.3);
  font-family: 'Poppins', sans-serif;
  font-size: 22px;
  z-index: 9999;
  filter: none;
  pointer-events: none;
}

#cart-modal.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
  pointer-events: auto;
}

.flying-img {
  position: fixed;
  z-index: 9999;
  transition: all 0.7s ease-in-out;
  pointer-events: none;
}


/* Modal giỏ hàng trên mobile: Đã gộp thành một block duy nhất, không cần ghi đè #cart-modal ở đây */

/* Tối ưu cho vùng hiển thị sản phẩm */
#cart-items {
  max-height: 300px !important;
  overflow-y: auto !important;
}

/* Media query cho các thiết bị màn hình nhỏ hơn 600px */
@media (max-width: 600px) {
  #cart {
    bottom: 40px !important;
    right: 20px !important;
    font-size: 18px !important;
    padding: 12px 20px !important;
  }
  /* Không ghi đè lại #cart-modal trong media query này */
}

#addCart {
  position: relative;
  z-index: 900;
}

@keyframes flyToCart {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--fly-x), var(--fly-y)) scale(0.1);
  }
}

.fly-clone {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  animation: flyToCart 0.8s forwards;
  border-radius: 8px;
  background-color: #ff4d6d;
  color: white;
  font-weight: 600;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 24px;
  will-change: transform, opacity;
}
.highlight-cart {
  animation: highlightCart 0.5s ease forwards;
}

@keyframes highlightCart {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(255, 77, 109, 0); }
  50% { transform: scale(1.2); box-shadow: 0 0 10px 5px rgba(255, 77, 109, 0.7); }
  100% { transform: scale(1); box-shadow: 0 0 0 rgba(255, 77, 109, 0); }
}
