/* =========================================
   CART & SIDEBAR — FULLY MERGED GOLD STANDARD
========================================= */

/* ===== Cart Icon & Badge ===== */
.cart-wrapper {
  display: flex;
  align-items: center;
  margin-left: 15px;
}

.cart-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  position: relative;
  z-index: 10;
  padding: 0;
  cursor: pointer;
  transition: transform 0.3s ease;
  color: #222; /* inherit color for local SVGs */

  /* ADD THESE: remove the visible “button” behind the icon */
  background: transparent;
  border: none;
  appearance: none;        /* hides default button style in most browsers */
}

.cart-icon img {
  width: 20px;
  height: 20px;
  display: block;

  /* Default color (dark icon) */
  filter: none;

  transition:
    filter 0.4s ease,
    transform 0.25s ease;
}

.cz-header.scrolled .cart-icon img {
  filter: brightness(0) invert(1);
}

.cart-icon:hover,
.cart-icon:focus { transform: scale(1.1); outline: none; }

.cart-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: #555;
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  opacity: 0;
  transform-origin: top right;
  transition: transform 0.36s cubic-bezier(.22,.9,.34,1), opacity 0.28s ease;
}

.cart-badge.active {
  transform: scale(1);
  opacity: 1;
  animation: bounceBadge 0.45s ease;
}

@keyframes bounceBadge {
  0%,100% { transform: scale(1); }
  30% { transform: scale(1.3); }
  50% { transform: scale(0.9); }
  80% { transform: scale(1.1); }
}

/* ===== Sidebar ===== */
.shopping-sidebar {
  position: fixed;
  top: 0;
  right: -400px;
  width: 350px;
  max-width: 90%;
  height: 100%;
  background: #fff;
  box-shadow: -3px 0 15px rgba(0,0,0,0.2);
  transition: right 0.3s ease-in-out;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  padding: 20px;
  border-left: 3px solid #007bff1a;
  backdrop-filter: blur(4px);
  color: #222;
}

.shopping-sidebar.open { right: 0; }

.shopping-sidebar-header,
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.25rem;
  color: #222;
  padding: 1rem;
  border-bottom: 1px solid #ddd;
}

.shopping-sidebar-header h2 { font-size: 1.25rem; }
.shopping-sidebar-header button,
.shopping-sidebar .close {
  background: none; border: none; cursor: pointer; font-size: 1.5rem; color: #222;
}
.shopping-sidebar .close:hover { color: #161616; }

.shopping-sidebar-content,
#cartContents {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Cart Item */
.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 10px;
  border-bottom: 1px solid #eee;
  min-height: 70px;
  max-height: 120px;
  transition: all 0.3s ease;
}

.cart-item img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
}

.cart-item-left-mid {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cart-item-name,
.cart-item-price {
  font-size: 0.95rem;
  color: #222;
}

.cart-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 5px;
}

.cart-item-qty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  font-weight: 600;
  color: #111;
}

.cart-plus,
.cart-minus {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: #cce4ff;
  color: currentColor; /* will inherit from parent, e.g., #222 */
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s, all 0.3s ease;
  border: 1px solid #ccc;
}
.cart-plus:hover,
.cart-minus:hover { background: #99ccff; }

.remove-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: #E1E1E1;
  cursor: pointer;
  transition: transform 0.3s ease, color 0.3s ease;
}
.remove-btn:hover { color: #b02a37; transform: scale(1.1); }
.remove-btn:focus { outline: 2px solid #007bff; outline-offset: 2px; }

/* Delete Modal */
body.show-delete-overlay::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 140;
  pointer-events: auto;
}

.delete-confirmation {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  padding: 20px 25px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  z-index: 150;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.delete-confirmation p {
  margin-bottom: 0;
  font-size: 14px;
  color: black;
  text-align: center;
}

.delete-confirmation .button-group {
  display: flex;
  flex-direction: row;
  gap: 10px;
}
.delete-confirmation button {
  padding: 5px 12px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  font-size: 14px;
}
.delete-confirmation .confirm-btn { background-color: #28a745; color: white; }
.delete-confirmation .cancel-btn { background-color: #555; color: white; }

/* Grand Total & Checkout */
.shopping-sidebar .grand-total {
  padding: 1rem;
  font-weight: 600;
  border-top: 1px solid #ddd;
}

.shopping-sidebar .checkout-btn {
  width: 100%;
  padding: 0.75rem;
  background: #cce4ff;
  color: #222;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}
.shopping-sidebar .checkout-btn:hover { background: #99ccff; }
.shopping-sidebar .checkout-btn:disabled { background: #ccc; cursor: not-allowed; }

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
}
.toast {
  min-width: 250px;
  max-width: 300px;
  padding: 12px 16px 12px 45px;
  border-radius: 5px;
  background: #555;
  color: white;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  opacity: 0;
  transform: translateY(20px);
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: auto;
  position: relative;
}
.toast.bag-toast { background: #94A7B0; color: white; z-index: 110; }
.toast.trash-toast { background: #4BAC46; color: white; z-index: 110; }
.toast.hide { opacity: 0; transform: translateY(50px); }
.toast.show { animation: toastSlideUp 2.8s ease forwards; }
@keyframes toastSlideUp {
  0% { opacity:0; transform:translateY(40px); }
  25% { opacity:1; transform:translateY(0); }
  75% { opacity:1; transform:translateY(0); }
  100% { opacity:0; transform:translateY(40px); }
}

/* ===== MEDIA QUERIES ===== */
@media (max-width: 900px) {
  .shopping-sidebar { width: 280px; }
  .shopping-sidebar .checkout-btn { font-size: 14px; padding: 10px 0; }
  .toast { min-width: 220px; font-size: 13px; }
}
@media (max-width: 600px) {
  .cart-item-controls { gap: 2px; }
  .cart-item-controls .cart-item-qty { min-width: 16px; margin: 0; }
  .cart-item-right { width: 100%; justify-content: space-between; margin-top: 5px; }
  .shopping-sidebar { width: 260px; }
  .shopping-sidebar .checkout-btn { font-size: 13px; padding: 8px 0; }
  .toast { min-width: 200px; font-size: 12px; }
}
@media (max-width: 400px) {
  .cart-item { flex-direction: column; align-items: flex-start; min-height: 55px; max-height: 90px; }
  .cart-item-controls .cart-item-qty { min-width: 20px; }
  .delete-confirmation .button-group { flex-wrap: wrap; justify-content: center; }
  .cart-item-img { width: 40px; height: 40px; }
  .shopping-sidebar { width: 240px; }
  .shopping-sidebar .checkout-btn { font-size: 12px; padding: 6px 0; }
  .toast { min-width: 180px; font-size: 11px; }
}
