/* ==========================================================================
   TasteLokal — Cart Drawer (slide-in from right)
   ========================================================================== */

.cart-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  z-index: 1100;
  animation: cd-fade 0.2s ease;
}
.cart-overlay.open { display: block; }
@keyframes cd-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.cart-drawer {
  position: fixed;
  top: 0; right: -100%;
  width: 100%;
  max-width: 420px;
  height: 100dvh;
  background: #fff;
  z-index: 1101;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 30px rgba(0,0,0,0.15);
  transition: right 0.32s cubic-bezier(.4,0,.2,1);
}
.cart-drawer.open { right: 0; }

/* Header */
.cd-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  background: #fff;
}
.cd-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 8px;
}
.cd-pill {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--teal);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  min-width: 24px; height: 24px;
  border-radius: 999px;
  padding: 0 8px;
}
.cd-close {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  width: 36px; height: 36px;
  border-radius: 10px;
  color: var(--navy);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.cd-close:hover { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Progress / free delivery bar */
.cd-progress {
  padding: 14px 20px;
  background: linear-gradient(135deg, #ecfdf5 0%, #ccfbf1 100%);
  border-bottom: 1px solid var(--border-light);
}
.cd-progress-text {
  font-size: 12px;
  color: var(--teal-dark);
  margin-bottom: 6px;
  text-align: center;
}
.cd-progress-text strong { font-weight: 800; }
.cd-progress-bar {
  height: 6px;
  background: rgba(13, 148, 136, 0.15);
  border-radius: 999px;
  overflow: hidden;
}
.cd-progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal) 0%, var(--green) 100%);
  border-radius: 999px;
  transition: width .35s ease;
}

/* Body / items list */
.cd-body {
  flex: 1; overflow-y: auto;
  padding: 0;
  -webkit-overflow-scrolling: touch;
}
.cd-items {
  list-style: none;
  margin: 0;
  padding: 0;
}
.cd-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  position: relative;
  align-items: flex-start;
}
.cd-item:last-child { border-bottom: 0; }
.cd-item-img {
  display: block;
  width: 72px; height: 72px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--border-light);
  flex-shrink: 0;
}
.cd-item-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.cd-item-meta {
  display: flex; flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.cd-item-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  text-decoration: none;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cd-item-name:hover { color: var(--teal); }
.cd-item-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px;
}
.cd-qty-num {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-soft);
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
}
.cd-item-price {
  font-size: 14px;
  font-weight: 800;
  color: var(--navy);
}
.cd-item-remove {
  position: absolute;
  top: 14px; right: 16px;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  width: 24px; height: 24px;
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: all .15s;
}
.cd-item-remove:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Footer / checkout */
.cd-foot {
  flex: 0 0 auto;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.04);
}
.cd-subtotal {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 4px;
}
.cd-subtotal span { font-size: 14px; color: var(--text-muted); }
.cd-subtotal strong, .cd-subtotal-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.01em;
}
.cd-note {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0 0 14px;
}
.cd-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
}
.cd-actions .btn {
  padding: 12px 14px;
  font-size: 13px;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.cd-actions .btn-ghost {
  background: var(--bg-soft);
  color: var(--navy);
  border: 1px solid var(--border);
}
.cd-actions .btn-ghost:hover { background: var(--border-light); }
.cd-actions .btn-primary {
  background: var(--teal);
  color: #fff;
  border: 0;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}
.cd-actions .btn-primary:hover { background: var(--teal-dark); }

/* Empty state */
.cd-empty {
  text-align: center;
  padding: 60px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.cd-empty-icon {
  width: 88px; height: 88px;
  background: var(--bg-soft);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.cd-empty h4 {
  font-size: 18px;
  font-weight: 800;
  color: var(--navy);
  margin: 0;
}
.cd-empty p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 12px;
  max-width: 280px;
  line-height: 1.5;
}
.cd-shop-btn {
  background: var(--teal);
  color: #fff;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}
.cd-shop-btn:hover { background: var(--teal-dark); color: #fff; }

/* Loading state */
.cart-drawer.loading .cd-body { opacity: 0.4; pointer-events: none; }
.cart-drawer.loading::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: cd-spin 0.7s linear infinite;
}
@keyframes cd-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Body lock when drawer open */
body.cd-open { overflow: hidden; }

/* Tablet+ */
@media (min-width: 640px) {
  .cart-drawer { max-width: 440px; }
}
