/* ================= NGĂN KÉO GIỎ HÀNG RIÊNG BIỆT ================= */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(35, 23, 14, 0.52);
  backdrop-filter: blur(2px);
  z-index: 90;
}
.overlay.show { display: block; }

.cart-drawer {
  position: fixed;
  top: 0;
  right: -440px;
  width: 100%;
  max-width: 420px;
  height: 100vh;
  height: 100dvh;
  background: var(--surface);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: right 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: -10px 0 32px rgba(35, 23, 14, 0.16);
}
.cart-drawer.open { right: 0; }

.cart-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.cart-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--cream);
  color: var(--text);
  cursor: pointer;
  transition: 0.2s;
}
.close-btn:hover {
  background: var(--brand);
  color: #FFFFFF;
  border-color: var(--brand);
}

/* Màn hình khóa giỏ hàng khi chưa đăng nhập */
.cart-auth-gate {
  flex: 1;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
}

.cag-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--cream);
  border: 1px solid var(--border);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.cart-auth-gate h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.cart-auth-gate p {
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 8px;
}

.cag-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cag-actions a,
.cag-actions button {
  width: 100%;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}

.cag-actions .btn-brand-solid {
  background: var(--brand);
  color: #FFFFFF;
  border: 1px solid var(--brand);
}
.cag-actions .btn-brand-solid:hover {
  background: var(--brand-dark);
}

.cag-actions .btn-brand-outline {
  background: var(--cream);
  color: var(--brand-dark);
  border: 1px solid var(--border);
}
.cag-actions .btn-brand-outline:hover {
  border-color: var(--brand);
}

/* Khu vực giỏ hàng khi đã đăng nhập */
.cart-logged-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cart-items {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-empty {
  margin: auto 0;
  text-align: center;
  color: var(--muted);
  font-size: 14.5px;
  padding: 24px 12px;
}

.cart-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 14px;
  background: var(--cream);
  border: 1px solid var(--border);
}
.ci-info {
  flex: 1;
  min-width: 0;
}
.ci-info strong {
  display: block;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}
.ci-info span {
  display: block;
  color: var(--brand-dark);
  font-size: 13.5px;
  margin-top: 2px;
}

.ci-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.ci-qty button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}
.ci-qty button:hover {
  background: var(--brand);
  color: #FFFFFF;
  border-color: var(--brand);
}

/* Form thanh toán & tính phí giao hàng theo km */
.checkout-form {
  flex-shrink: 0;
  max-height: 64vh;
  max-height: 64dvh;
  overflow-y: auto;
  padding: 12px 20px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-page, #FAF6F0);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.ship-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--cream);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.ship-mode-pill {
  text-align: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: 0.2s;
  user-select: none;
}
.ship-mode-pill input { display: none; }
.ship-mode-pill.active {
  background: var(--brand);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(178, 110, 40, 0.24);
}

/* Khối Địa chỉ giao hàng mặc định + Nút Định vị GPS + Nút Thay đổi */
.ship-addr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sac-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.sac-prompt {
  font-size: 12px;
  color: var(--muted);
}

.sac-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.sac-gps-btn,
.sac-change-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--cream);
  color: var(--brand-dark);
  transition: 0.15s;
}

.sac-gps-btn:hover,
.sac-change-btn:hover {
  background: var(--brand);
  color: #FFFFFF;
  border-color: var(--brand);
}

.sac-gps-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

.sac-current-addr {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.sac-picker-list {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  flex-direction: column;
  gap: 6px;
}

.sac-picker-item {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-page, #FAF6F0);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: 0.15s;
}

.sac-picker-item:hover,
.sac-picker-item.active {
  background: var(--cream);
  border-color: var(--brand);
}

.sac-picker-item strong {
  font-size: 12.5px;
  color: var(--brand-dark);
}

.sac-picker-item span {
  font-size: 12.5px;
  color: var(--text);
}

.sac-empty-note {
  font-size: 12.5px;
  color: var(--muted);
}

.sac-manage-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand-dark);
  text-decoration: none;
  padding-top: 2px;
}

.sac-manage-link:hover {
  text-decoration: underline;
}

/* Khung thông báo số km & phí vận chuyển */
.ship-quote-box {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--brand-dark);
  background: var(--cream);
  border: 1px dashed var(--border);
  padding: 7px 11px;
  border-radius: 10px;
}

.checkout-form input[type="text"],
.checkout-form select {
  width: 100%;
  padding: 9.5px 13px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: 0.2s;
}
.checkout-form input[type="text"]:focus,
.checkout-form select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(178, 110, 40, 0.12);
}

.fee-breakdown {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  color: var(--muted);
}
.fb-row strong {
  color: var(--text);
  font-weight: 600;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 4px;
  border-top: 1px dashed var(--border);
}
.total-row span {
  font-weight: 600;
  color: var(--text);
}
.total-row strong {
  font-size: 18px;
  font-weight: 600;
  color: var(--brand-dark);
}

.submit-order-btn {
  padding: 13px;
  border-radius: 999px;
  border: none;
  background: var(--brand);
  color: #FFFFFF;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: 0.2s;
}
.submit-order-btn:hover:not(:disabled) {
  background: var(--brand-dark);
}
.submit-order-btn:disabled {
  cursor: not-allowed;
}

/* Thanh nổi Giỏ hàng nhanh trên Mobile */
.mobile-cart-bar { display: none; }
@media (max-width: 640px) {
  .mobile-cart-bar.has-items {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: 14px;
    z-index: 45;
    background: var(--brand);
    color: #FFFFFF;
    padding: 13px 18px;
    border-radius: 999px;
    box-shadow: 0 10px 26px rgba(44, 29, 17, 0.28);
    cursor: pointer;
  }
  .mcb-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
  }
  .mcb-cta {
    font-size: 14px;
    font-weight: 600;
  }
}
