/* ============================================================
   Sour Life Bakery — Cart Sidebar
   ============================================================ */

/* ── Overlay ────────────────────────────────────────────────── */
#cart-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
}

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

/* ── Sidebar ────────────────────────────────────────────────── */
#cart-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: var(--white);
  z-index: 400;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 40px rgba(44, 36, 22, 0.15);
}

#cart-sidebar.is-open {
  transform: translateX(0);
}

/* Header */
.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--cream-dark);
  flex-shrink: 0;
}

.cart-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--text-dark);
}

.cart-title span {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-light);
  margin-left: 8px;
}

.cart-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--cream-dark);
  color: var(--text-mid);
  cursor: pointer;
  transition: var(--transition);
  border: none;
}

.cart-close-btn:hover {
  background: var(--cream-deeper);
  color: var(--text-dark);
}

/* Items container */
.cart-items-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--cream-deeper) transparent;
}

.cart-items-wrap::-webkit-scrollbar {
  width: 4px;
}
.cart-items-wrap::-webkit-scrollbar-thumb {
  background: var(--cream-deeper);
  border-radius: 2px;
}

/* Empty state */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  padding: 40px;
  text-align: center;
  color: var(--text-ghost);
}

.cart-empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.cart-empty-text {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--text-ghost);
}

/* Cart item row */
.cart-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--cream-dark);
  animation: fadeUp 0.2s ease;
}

.cart-item-color {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-unit-price {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* Quantity controls */
.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.qty-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--cream-deeper);
  background: var(--cream);
  color: var(--text-mid);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}

.qty-btn:hover {
  border-color: var(--green);
  background: var(--green-pale);
  color: var(--green-dark);
}

.qty-value {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-dark);
  min-width: 20px;
  text-align: center;
}

.cart-item-remove {
  font-size: 0.72rem;
  color: var(--text-ghost);
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  transition: var(--transition);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cart-item-remove:hover {
  color: var(--error);
}

/* Item subtotal */
.cart-item-subtotal {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-dark);
  min-width: 52px;
  text-align: right;
  flex-shrink: 0;
}

/* Footer */
.cart-footer {
  padding: 20px 24px 28px;
  border-top: 1.5px solid var(--cream-dark);
  background: var(--cream);
  flex-shrink: 0;
}

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

.cart-total-label {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--text-mid);
}

.cart-total-amount {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-dark);
}

.cart-checkout-btn {
  width: 100%;
  background: var(--green);
  color: var(--cream);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 16px;
  border-radius: var(--radius-xl);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(109, 143, 89, 0.25);
}

.cart-checkout-btn:hover {
  background: var(--green-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(109, 143, 89, 0.35);
}

.cart-checkout-btn:active {
  transform: translateY(0);
}

.cart-note {
  font-size: 0.75rem;
  color: var(--text-ghost);
  text-align: center;
  margin-top: 12px;
}
