/* ═══ Public Cart Drawer ═══ */

.public-cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s,
    visibility 0.3s;
}
.public-cart-overlay.open {
  opacity: 1;
  visibility: visible;
}

.public-cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 92vw;
  height: 100vh;
  background: #fff;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.public-cart-drawer.open {
  transform: translateX(0);
}

/* Header */
.public-cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
}
.public-cart-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #111;
  margin: 0;
}
.public-cart-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #6b7280;
  transition: color 0.15s;
}
.public-cart-close:hover {
  color: #111;
}

/* Items list */
.public-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.public-cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #9ca3af;
  gap: 12px;
}
.public-cart-empty svg {
  width: 56px;
  height: 56px;
  opacity: 0.4;
}
.public-cart-empty p {
  font-size: 0.95rem;
}

.public-cart-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 180px;
  color: #6b7280;
  gap: 12px;
}

.public-cart-loading p {
  font-size: 0.92rem;
  font-weight: 600;
}

.public-cart-loading-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid #dbeafe;
  border-top-color: #2563eb;
  border-radius: 999px;
  animation: public-cart-spin 0.7s linear infinite;
}

@keyframes public-cart-spin {
  to {
    transform: rotate(360deg);
  }
}

.public-cart-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid #f3f4f6;
  align-items: flex-start;
}
.public-cart-item:last-child {
  border-bottom: none;
}

.public-cart-item-thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  background: #f3f4f6;
  flex-shrink: 0;
}

.public-cart-item-info {
  flex: 1;
  min-width: 0;
}
.public-cart-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.public-cart-item-price {
  font-size: 0.85rem;
  color: #2563eb;
  font-weight: 600;
}

.public-cart-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #d1d5db;
  padding: 4px;
  flex-shrink: 0;
  transition: color 0.15s;
}
.public-cart-item-remove:hover {
  color: #ef4444;
}

/* Qty controls */
.public-cart-qty {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.public-cart-qty button {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.public-cart-qty button:hover {
  background: #e5e7eb;
}
.public-cart-qty span {
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

/* Footer */
.public-cart-footer {
  padding: 20px 24px;
  border-top: 1px solid #e5e7eb;
}
.public-cart-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.public-cart-subtotal-label {
  font-size: 0.95rem;
  color: #6b7280;
}
.public-cart-subtotal-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: #111;
}

.public-cart-checkout-btn {
  display: block;
  width: 100%;
  padding: 14px 0;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s;
}
.public-cart-checkout-btn:hover {
  background: #1d4ed8;
}
.public-cart-checkout-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Nav toggle button */
.public-cart-toggle {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: inherit;
  display: flex;
  align-items: center;
}
.public-cart-toggle svg {
  width: 22px;
  height: 22px;
}

.public-cart-badge {
  position: absolute;
  top: -2px;
  right: -6px;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

/* Toast notification for cart actions */
.public-cart-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #111827;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.88rem;
  z-index: 10000;
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.3s,
    transform 0.3s;
  pointer-events: none;
}
.public-cart-toast.show {
  opacity: 1;
  transform: translateY(0);
}
.public-cart-toast.error {
  background: #dc2626;
}

/* Button in product cards */
.btn-prod-cart {
  background: none;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  padding: 6px 10px;
  font-size: 1rem;
  transition:
    border-color 0.15s,
    background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-prod-cart:hover {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.06);
}

/* Marketplace add-to-cart button */
.marketplace-add-cart-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s;
  margin-top: 8px;
}
.marketplace-add-cart-btn:hover {
  background: #1d4ed8;
}

/* ═══ Responsive ═══ */
@media (max-width: 480px) {
  .public-cart-drawer {
    width: 100vw;
    max-width: 100vw;
  }
}
