/* cart.css */

.cartOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  visibility: hidden;
  transition: 0.3s;
  z-index: 2000; /* up from 1000 */
}

.cartOverlay.active {
  opacity: 1;
  visibility: visible;
}

.cart-item.out-of-stock {
  opacity: 0.5;
  pointer-events: none;
}

.cart-item.out-of-stock .delete-btn,
.cart-item.out-of-stock .qty-btn.minus {
  pointer-events: auto; /* allow remove */
}

.stock-error {
  color: #d9534f;
  font-size: 13px;
  margin-top: 4px;
}


.cart {
  position: fixed;
  top: 0;
  right: -400px; /* hidden */
  width: 350px;
  height: 100%;
  background: #fff;
  box-shadow: -2px 0 10px rgba(0,0,0,0.2);
  transition: 0.3s;
  z-index: 2001; /* up from 1001 */
  padding: 20px;
  display: flex;
  flex-direction: column; /* make footer stick at bottom */
}

.cart-items {
  flex: 1;               /* take all available space */
  overflow-y: auto;      /* scroll only items */
  padding-bottom: 80px;  /* prevent overlap with checkout button */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE & Edge */
}

.cart-items::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}

.cart-footer {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding: 12px;
  border-top: 1px solid #eee;
}

.checkout-btn {
  width: 100%;
  padding: 14px;
  background: #ffc107; /* Yellow */
  color: #000;
  font-weight: bold;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s ease;
}

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

.cart.active {
  right: 0;
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.cart-header h2 {
  margin: 0;
}

.close-cart {
  cursor: pointer;
  font-size: 20px;
  border: none;
  background: none;
}

.cart-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: calc(100% - 60px);
  text-align: center;
}

.spinner {
  border: 5px solid #f3f3f3;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.cart-item {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  position: relative; /* important for absolute positioning */
  padding-right: 30px; /* give space for delete button */
}

.cart-item-img {
  width: 60px;
  height: 60px;
  object-fit: contain;   /* show whole image without cropping */
  background: #f9f9f9;   /* add light background behind transparent parts */
  border-radius: 6px;
  margin-right: 10px;
}

.cart-img-container{
  min-width: 70px;
  min-height: 70px;
  max-width: 70px;
  max-height: 70px;
}

.cart-product-title{
  display: -webkit-box;
  -webkit-line-clamp: 2;      /* show max 2 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4em;         /* control line spacing */
  max-height: 2.8em;  
}
.cart-item-details p {
  margin: 2px 0;
  font-size: 14px;
}

.coupon-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 15px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.coupon-box input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  padding: 10px;
  border-radius: 8px;
  background: #fff;
}

.coupon-box input::placeholder {
  color: #888;
}

.coupon-box button {
  margin-left: 10px;
  padding: 10px 18px;
  background: #007bff;
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s ease;
}

.coupon-box button:hover {
  background: #0056b3;
}

.quantity-controls {
  display: flex;
  align-items: center;
  margin: 6px 0;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #f5f5f5;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 6px;
}

.qty-btn:hover {
  background: #ddd;
}

.qty {
  min-width: 20px;
  text-align: center;
  font-weight: bold;
}

.delete-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: #d9534f;
  transition: 0.2s;
}

.delete-btn:hover {
  color: #c9302c;
}

.cart-blocker {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.6); /* semi-transparent white */
  backdrop-filter: blur(3px);        /* blur effect */
  display: none;                     /* hidden by default */
  align-items: center;
  justify-content: center;
  z-index: 2000;                     /* higher than cart items */
}

.cart-blocker.active {
  display: flex;
}

.cart-blocker-spinner {
  border: 6px solid #f3f3f3;
  border-top: 6px solid #007bff;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  animation: spin 1s linear infinite;
}



/* ======================
   COUPON SECTION STYLES
====================== */

.show-coupon-btn {
  width: 100%;
  padding: 12px;
  background: #007bff;
  color: #fff;
  font-size: 15px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s ease;
  margin-bottom: 12px;
}

.show-coupon-btn:hover {
  background: #0056b3;
}

.available-coupons {
  background: #f9f9f9;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 14px;
  max-height: 150px;
  overflow-y: auto;
}

.available-coupons h4 {
  margin-bottom: 8px;
  font-size: 15px;
}

.coupon-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.coupon-card strong {
  color: #007bff;
}

.coupon-card p {
  margin: 5px 0;
  font-size: 14px;
}

.coupon-card .strong2 {
  color: #000000; /* highlight title */
  margin-left: 4px;
}

/* ====================
   MOBILE RESPONSIVE
==================== */


@media (max-width: 768px) {
  .cart {
    width: 100%;
    right: -100%;  /* hide full screen */
  }

  .cart.active {
    right: 0;
  }

  .cart-header h2 {
    font-size: 20px;
  }
}