/* Cart Icon Styles */
.cart-icon {
  position: relative;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 35px;
  height: 35px;
  background: #e04f39;
  color: white;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.cart-icon:hover {
  background: #c73e2a;
  transform: scale(1.1);
}

.cart-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #333;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
}

/* Add to Cart Button */
.add-to-cart-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  background: rgba(224, 79, 57, 0.95);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.3s ease;
  opacity: 0;
  z-index: 10;
}

.item:hover .add-to-cart-btn {
  opacity: 1;
}

.add-to-cart-btn:hover {
  background: #c73e2a;
  transform: scale(1.1);
}

.add-to-cart-btn.added {
  background: #28a745;
}

/* Tooltip */
.tooltip-cart {
  position: absolute;
  background: #333;
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  top: -35px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.tooltip-cart::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #333;
}

.add-to-cart-btn:hover .tooltip-cart {
  opacity: 1;
}

/* Cart Popup */
.cart-popup {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 380px;
  max-height: 500px;
  background: white;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  z-index: 9999;
  transform: translateY(600px);
  transition: transform 0.3s ease;
}

.cart-popup.show {
  transform: translateY(0);
}

.cart-header {
  background: #e04f39;
  color: white;
  padding: 15px 20px;
  border-radius: 10px 10px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-header h3 {
  margin: 0;
  font-size: 18px;
}

.close-cart {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-items {
  max-height: 300px;
  overflow-y: auto;
  padding: 15px;
}

.cart-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-image {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 5px;
}

.cart-item-details {
  flex: 1;
}

.cart-item-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 5px;
}

.cart-item-price {
  color: #e04f39;
  font-weight: 500;
  font-size: 13px;
}

.cart-item-remove {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 18px;
  padding: 0 10px;
}

.cart-item-remove:hover {
  color: #e04f39;
}

.cart-empty {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}

.cart-footer {
  padding: 15px 20px;
  border-top: 2px solid #eee;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 15px;
}

.checkout-btn {
  width: 100%;
  background: #e04f39;
  color: white;
  border: none;
  padding: 12px;
  border-radius: 5px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease;
}

.checkout-btn:hover {
  background: #c73e2a;
}

/* Item position relative for absolute button */
.item {
  position: relative;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .cart-popup {
    width: calc(100% - 40px);
    right: 20px;
  }
}

/* Quantity Popup Styles */
.quantity-popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.quantity-popup.show {
  display: flex;
}

.quantity-popup-content {
  background: white;
  padding: 30px;
  border-radius: 10px;
  width: 90%;
  max-width: 400px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.close-popup {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
}

.close-popup:hover {
  color: #333;
}

.quantity-popup h3 {
  margin-bottom: 20px;
  text-align: center;
  color: #333;
}

.product-info {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.popup-image {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  margin-right: 15px;
}

.product-details h4 {
  margin: 0 0 5px 0;
  color: #333;
}

.price-display {
  color: #666;
  font-weight: bold;
}

.quantity-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 25px 0;
  gap: 10px;
}

.quantity-btn {
  width: 40px;
  height: 40px;
  border: 1px solid #ddd;
  background: #f8f8f8;
  border-radius: 5px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quantity-btn:hover {
  background: #e8e8e8;
}

.quantity-input {
  width: 80px;
  height: 40px;
  text-align: center;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
  font-weight: bold;
}

.quantity-unit {
  margin-left: 5px;
  font-weight: bold;
  color: #666;
}

.total-price {
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  margin: 20px 0;
  color: #333;
}

.confirm-btn {
  width: 100%;
  padding: 15px;
  background: #4caf50;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
}

.confirm-btn:hover {
  background: #45a049;
}

.confirm-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}
