
.btn-cart {
  position: relative;
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 9999px;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; cursor: pointer;
  transition: background .2s;
  flex-shrink: 0;
}
.btn-cart:hover { background: rgba(255,255,255,.22); }
.cart-badge {
  position: absolute; top: -4px; right: -4px;
  background: #e63946; color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 17px; height: 17px;
  border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  display: none;
}
.cart-badge.show { display: flex; }


.cart-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  z-index: 500; display: none;
  align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto;
  overscroll-behavior: contain;
}
.cart-overlay.open { display: flex; }

.cart-drawer {
  background: #fff;
  width: 100%; max-width: 420px;
  max-height: 92vh;
  display: flex; flex-direction: column;
  border-radius: 20px; overflow: hidden;
  position: relative;
  box-shadow: 0 12px 48px rgba(0,0,0,.22);
  animation: cartPop .22s cubic-bezier(.4,0,.2,1);
}
@keyframes cartPop { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.cart-grab { display: none; width: 40px; height: 5px; border-radius: 3px; background: #d1d1d6; margin: 9px auto 0; flex-shrink: 0; }

.cart-header {
  padding: 18px 20px;
  border-bottom: 1px solid #e5e5ea;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.cart-header h2 { font-size: 17px; font-weight: 700; }
.cart-close {
  background: none; border: none; font-size: 20px;
  cursor: pointer; color: #6e6e73; padding: 4px; line-height: 1;
}


.cart-items { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 16px; }

.cart-empty {
  text-align: center; padding: 60px 20px;
  color: #6e6e73; font-size: 14px;
}
.cart-empty .ico { font-size: 40px; margin-bottom: 12px; }

.cart-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f5;
}
.cart-item:last-child { border-bottom: none; }
.cart-item-img {
  width: 52px; height: 52px; border-radius: 8px;
  object-fit: cover; background: #f5f5f7; flex-shrink: 0;
}
.cart-item-img-ph {
  width: 52px; height: 52px; border-radius: 8px;
  background: #f5f5f7; display: flex; align-items: center;
  justify-content: center; font-size: 22px; flex-shrink: 0;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name {
  font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: 2px;
}
.cart-item-meta { font-size: 11px; color: #6e6e73; margin-bottom: 6px; }
.cart-item-price { font-size: 14px; font-weight: 600; }
.cart-item-controls {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.qty-btn {
  width: 26px; height: 26px; border-radius: 50%;
  background: #f5f5f7; border: none; cursor: pointer;
  font-size: 15px; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.qty-btn:hover { background: #e5e5ea; }
.qty-num { font-size: 14px; font-weight: 600; min-width: 20px; text-align: center; }
.cart-item-rm {
  background: none; border: none; color: #e63946;
  font-size: 15px; cursor: pointer; padding: 4px; margin-left: 4px;
}

.cart-footer {
  padding: 16px 20px;
  border-top: 1px solid #e5e5ea;
  flex-shrink: 0;
  background: #fff;
}
.cart-total-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.cart-total-label { font-size: 14px; color: #6e6e73; }
.cart-total-val { font-size: 20px; font-weight: 700; }
.btn-checkout {
  width: 100%; height: 48px;
  background: #1d1d1f; color: #fff; border: none;
  border-radius: 12px; font-family: inherit;
  font-size: 16px; font-weight: 700;
  cursor: pointer; transition: background .2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-checkout:hover { background: #000; }
.btn-checkout:disabled { background: #c7c7cc; cursor: default; }
.cart-clear {
  width: 100%; margin-top: 8px; padding: 8px;
  background: none; border: none; color: #6e6e73;
  font-family: inherit; font-size: 13px; cursor: pointer;
}
.cart-clear:hover { color: #e63946; }


.cart-shop-group { margin-bottom: 4px; }
.cart-shop-label {
  font-size: 11px; font-weight: 700; color: #6e6e73;
  text-transform: uppercase; letter-spacing: .5px;
  padding: 8px 0 4px; border-top: 1px solid #f0f0f5;
  margin-top: 4px;
}
.cart-shop-label:first-child { border-top: none; margin-top: 0; }

@media (max-width: 480px) {
  
  .cart-overlay { padding: 0; align-items: flex-end; }
  .cart-drawer {
    width: 100%; max-width: 100%;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 32px rgba(0,0,0,.18);
    animation: cartPopUp .24s cubic-bezier(.4,0,.2,1);
  }
  .cart-grab { display: block; }
  .cart-footer {
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
  }
  .cart-header { padding: 14px 16px; }
  .cart-items { padding: 8px 12px; }
  .cart-item-img, .cart-item-img-ph { width: 44px; height: 44px; }
  .cart-item-name { font-size: 12px; }
  .cart-item-price { font-size: 13px; }
  .btn-checkout { height: 52px; font-size: 15px; border-radius: 14px; }
  .cart-total-val { font-size: 18px; }
}
@keyframes cartPopUp { from { opacity: 0; transform: translateY(100%); } to { opacity: 1; transform: none; } }


@media(max-width:600px){
  .qty-btn{width:34px;height:34px;font-size:17px}
  .cart-item-rm{min-width:34px;min-height:34px}
}
