/* Cart Drawer Styles */
#cart-drawer {
  position: fixed;
  top: 0;
  right: -450px; /* Hidden by default */
  width: 450px;
  height: 100%;
  background-color: #ffffff;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
  z-index: 99999; /* Ensure it's on top of everything */
  transition: right 0.4s cubic-bezier(0.19, 1, 0.22, 1); /* Smooth Slide */
  display: flex;
  flex-direction: column;
  font-family: "Open Sans", sans-serif; /* Match site font if possible */
  zoom: 1.5; /* Increased scale per user request */
}

#cart-drawer.open {
  right: 0;
}

.cart-drawer-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

/* Header */
.cart-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 30px;
  border-bottom: 1px solid #f0f0f0;
  background-color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.cart-drawer-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: #1a1a1a;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.close-drawer {
  background: none;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  color: #999;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.close-drawer:hover {
  color: #333;
  background-color: #f5f5f5;
}

/* Body (Items) */
.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 30px;
}

/* Promotion Styles - Modern */
.promotion-container {
  padding: 20px;
  background: linear-gradient(135deg, #fdfbf7, #fffefb);
  border: 1px solid #f0e6d2;
  border-radius: 12px;
  margin-bottom: 24px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(242, 178, 52, 0.08);
}

.promotion-text {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 12px;
  font-size: 1rem;
}

.promotion-progress-bar-bg {
  width: 100%;
  height: 8px;
  background: #eef1f5;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
  position: relative;
}

.promotion-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f2b234, #e67e22);
  width: 0%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 99px;
  box-shadow: 0 2px 4px rgba(242, 178, 52, 0.3);
}

.promotion-disclaimer {
  font-size: 0.75rem;
  color: #95a5a6;
  margin-top: 8px;
  letter-spacing: 0.3px;
}

.drawer-items .cart-item {
  display: flex;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #f0f0f0;
  align-items: center;
  transition: opacity 0.3s ease;
}

.drawer-items .cart-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.drawer-items .item-image {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid #f0f0f0;
  margin-right: 20px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.drawer-items .item-details {
  flex: 1;
  min-width: 0; /* Fix flex text overflow */
}

.drawer-items .item-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 4px;
  color: #1a1a1a;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-items .item-meta {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 12px;
}

/* Modern Item Price / Controls */
.item-price {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-qty-controls {
  display: flex;
  align-items: center;
  background: #f7f9fa;
  border-radius: 30px; /* Pill shape */
  padding: 2px;
  border: 1px solid #e1e8ed;
  width: fit-content;
}

.drawer-qty-btn {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 1rem;
  color: #555;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.drawer-qty-btn:hover {
  background: #fff;
  color: #1a1a1a;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.drawer-qty-controls span {
  padding: 0 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
  min-width: 20px;
  text-align: center;
}

.price-display {
  font-weight: 700;
  color: #1a1a1a;
  font-size: 0.95rem;
}

/* Footer */
.cart-drawer-footer {
  padding: 30px;
  background-color: #fff;
  border-top: 1px solid #f0f0f0;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.03);
}

.cart-drawer-total {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: #555;
}

.drawer-discount {
  color: #27ae60;
}

.total-row-main {
  font-size: 1.4rem;
  color: #1a1a1a;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 2px solid #f5f5f5;
}

.cart-drawer-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.cart-drawer-actions .btn {
  width: 100%;
  padding: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-radius: 50px; /* Pill buttons */
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  text-align: center;
  font-size: 0.9rem;
  cursor: pointer;
}

.cart-drawer-actions .continue-shopping {
  background-color: transparent;
  border: 2px solid #e0e0e0;
  color: #888;
}

.cart-drawer-actions .continue-shopping:hover {
  border-color: #333;
  color: #333;
}

.cart-drawer-actions .checkout-btn {
  background: linear-gradient(135deg, #f2b234, #ed8f03); /* Richer gradient */
  border: none;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(242, 178, 52, 0.3);
}

.cart-drawer-actions .checkout-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(242, 178, 52, 0.4);
  color: #fff;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  #cart-drawer {
    width: 100%;
    right: -100%;
  }

  /* -- Mobile Text Scaling & Contrast Overrides -- */

  /* Header */
  .cart-drawer-header {
    padding: 20px;
  }
  .cart-drawer-header h2 {
    font-size: 1.5rem;
  }
  .close-drawer {
    font-size: 2.2rem;
    color: #444;
  }

  /* Items */
  .drawer-items .item-title {
    font-size: 1.3rem;
    font-weight: 700;
  }
  .drawer-items .item-meta {
    font-size: 1.1rem;
    color: #444;
    margin-bottom: 8px;
  }
  .drawer-items .item-image {
    width: 80px;
    height: 80px;
  } /* Slightly larger image */

  /* Price & Controls */
  .price-display {
    font-size: 1.3rem;
  }
  .drawer-qty-controls {
    padding: 4px;
  }
  .drawer-qty-controls span {
    font-size: 1.3rem;
    min-width: 35px;
    color: #111;
  }
  .drawer-qty-btn {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    color: #222;
  }

  /* Remove Button */
  .drawer-remove-btn {
    font-size: 1.6rem;
    color: #666;
    width: 32px;
    height: 32px;
  }

  /* Footer */
  .cart-drawer-total {
    font-size: 1.2rem;
    color: #222;
  }
  .total-row-main {
    font-size: 1.7rem;
  }
  .cart-drawer-actions .btn {
    font-size: 1.1rem;
    padding: 18px;
  }
}

/* Optimistic Quantity Controls */
.product-quantity-controls {
  display: none; /* Hidden by default */
  align-items: stretch;
  justify-content: space-between;
  width: 100%; /* Match 'Add to Cart' width */
  margin: 0;
  padding: 0;
  background-color: #fff;
  border: 1px solid #f2b234;
  min-height: 48px;
  box-sizing: border-box;
  overflow: hidden; /* Ensure content stays in */
  order: 1 !important; /* Force to left side (relative to others) */
}

#purchase-options-dropdown {
  order: 2 !important;
}

.product-quantity-controls button {
  background-color: #f2b234;
  color: #ffffff !important;
  border: none;
  width: 50px;
  font-family: Arial, sans-serif; /* Safe font */
  font-weight: 700;
  font-size: 24px; /* Explicit pixel size */
  line-height: 1; /* Center vertically */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
}

.product-quantity-controls button:hover {
  background-color: #d99e28;
}

.product-quantity-controls .qty-display {
  font-family: "Open Sans", sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: #333 !important;
  flex-grow: 1;
  text-align: center;
  line-height: 46px; /* Match container height - border approx */
  margin: 0;

  display: block;
}

/* Update to item layout for header/remove button */
.item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
}

.drawer-items .item-title {
  /* Override existing if necessary, or rely on flex behavior */
  white-space: normal; /* Allow wrapping if needed with button */
  padding-right: 5px;
}

.drawer-remove-btn {
  background: none;
  border: none;
  color: #bbb;
  cursor: pointer;
  font-size: 1.2rem; /* Icon size */
  padding: 0;
  margin-left: 5px;
  line-height: 1;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  width: 20px;
  border-radius: 4px;
}

.drawer-remove-btn:hover {
  color: #e74c3c; /* Red on hover */
  background-color: rgba(231, 76, 60, 0.1);
}
