/* ── Cart Overlay ── */
#ew-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#ew-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ── Cart Drawer ── */
#ew-drawer {
  position: fixed;
  right: 0;
  top: 0;
  width: 380px;
  height: 100%;
  background: #fff;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.18);
}

#ew-drawer.open {
  transform: translateX(0);
}

/* ── Drawer Header ── */
.drawer-head {
  background: #1a3a1a;
  color: #fff;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.drawer-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.drawer-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ── Drawer Items Area ── */
#ew-drawer-items {
  flex-grow: 1;
  overflow-y: auto;
  padding: 16px;
}

/* ── Individual Cart Item ── */
.drawer-item {
  padding: 14px 0;
  border-bottom: 1px solid #eee;
}

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

.drawer-item-name {
  font-size: 15px;
  font-weight: 700;
  color: #111;
  margin-bottom: 4px;
}

.drawer-item-unit {
  font-size: 12px;
  color: #888;
  margin-bottom: 10px;
}

.drawer-item-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.drawer-qty-control {
  display: flex;
  align-items: center;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
}

.dq-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: #f5f5f5;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.dq-btn:hover {
  background: #e0e0e0;
}

.dq-val {
  width: 36px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 32px;
  border-left: 1.5px solid #ddd;
  border-right: 1.5px solid #ddd;
}

.drawer-line-total {
  font-size: 14px;
  font-weight: 700;
  color: #2e7d32;
  flex: 1;
  text-align: right;
}

.drawer-trash {
  background: none;
  border: none;
  cursor: pointer;
  color: #e53935;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.15s;
}

.drawer-trash:hover {
  background: #fdecea;
}

/* ── Empty State ── */
.drawer-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px 20px;
  color: #bbb;
}

.drawer-empty .fas {
  font-size: 56px;
  margin-bottom: 16px;
  color: #ddd;
}

.drawer-empty p {
  font-size: 18px;
  font-weight: 700;
  color: #aaa;
  margin-bottom: 6px;
}

.drawer-empty span {
  font-size: 13px;
  color: #ccc;
}

/* ── Drawer Footer ── */
.drawer-foot {
  padding: 16px;
  border-top: 1px solid #eee;
  flex-shrink: 0;
}

.drawer-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.drawer-total-label {
  font-size: 15px;
  font-weight: 700;
  color: #333;
}

.drawer-total-amount {
  font-size: 22px;
  font-weight: 900;
  color: #2e7d32;
}

.drawer-whatsapp-btn {
  width: 100%;
  height: 50px;
  background: #25D366;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.2s;
  letter-spacing: 0.3px;
  margin-bottom: 10px;
}

.drawer-whatsapp-btn:hover:not(:disabled) {
  background: #1ebe5d;
}

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

.drawer-note {
  font-size: 11px;
  color: #aaa;
  text-align: center;
  line-height: 1.5;
}

/* ── Toast ── */
#ew-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #1a3a1a;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 999px;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
}

#ew-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Badge Pop Animation ── */
@keyframes badge-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.6); }
  100% { transform: scale(1); }
}

.cart-badge.pop {
  animation: badge-pop 0.3s ease;
}

/* ── Mobile Cart Drawer ── */
@media (max-width: 768px) {
  #ew-drawer {
    width: 100%;
    box-shadow: none;
  }

  #ew-toast {
    bottom: 72px; /* above sticky add-to-cart button */
    font-size: 12px;
    padding: 9px 18px;
  }

  .dq-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .dq-val {
    width: 44px;
    line-height: 40px;
    font-size: 16px;
  }

  .drawer-whatsapp-btn {
    height: 54px;
    font-size: 16px;
  }
}
