/* === POPUP CHECKOUT TOÀN MÀN HÌNH === */
#checkoutPopup {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  justify-content: center;
  align-items: center;
  font-family: 'Be Vietnam Pro', sans-serif;
}

.checkout-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1; /* ✅ lớp nền mờ nằm dưới */
}

.checkout-content {
  position: relative;
  z-index: 10; /* ✅ nội dung popup nằm trên và có thể click */
  width: 100%;
  max-width: 480px;
  height: 100%;
  height: 100dvh;
  min-width: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Desktop only: 1.5x the original 480px checkout width. */
@media (min-width: 769px) {
  .checkout-content {
    max-width: 720px;
  }
  .checkout-content .checkout-inner-scroll {
    padding: 30px;
  }
  .checkout-content .checkout-close {
    top: 16px;
    right: 12px;
    font-size: 52px;
  }
  .checkout-content .checkout-section-title {
    margin: 30px 0 15px;
    font-size: 21px;
  }
  .checkout-content .cart-item {
    gap: 15px;
    margin-bottom: 18px;
    padding-bottom: 15px;
  }
  .checkout-content .cart-item img {
    width: 90px;
    height: 90px;
  }
  .checkout-content .cart-item-name,
  .checkout-content .cart-empty {
    font-size: 21px;
  }
  .checkout-content .cart-item-price {
    font-size: 19px;
  }
  .checkout-content .cart-item-qty {
    gap: 9px;
    font-size: 18px;
  }
  .checkout-content .cart-item-qty button {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
  .checkout-content .checkout-summary .row {
    font-size: 21px;
    margin-bottom: 9px;
  }
  .checkout-content .checkout-summary .total-row {
    margin-top: 15px;
    font-size: 24px;
  }
  .checkout-content .checkout-summary .note {
    margin-top: 12px;
    font-size: 19px;
  }
  .checkout-content .checkout-form {
    margin-top: 24px;
    gap: 12px;
  }
  .checkout-content .checkout-form .form-row {
    gap: 12px;
  }
  .checkout-content .checkout-form input {
    padding: 12px;
    font-size: 21px;
    border-radius: 9px;
  }
  .checkout-content #checkoutSubmitBtn {
    padding: 21px;
    margin-top: 24px;
    font-size: 22px;
    border-radius: 12px;
  }
}


.checkout-inner-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

/* === NÚT ĐÓNG === */
.checkout-close {
  .checkout-content {
  padding-top: env(safe-area-inset-top, 12px); /* ✅ tránh bị tràn lên notch */
}
  top: 12px;       /* ✅ top vừa phải, không sát nữa */
  right: 6px;
  font-size: 42px;
  color: #000;
  line-height: 1;
  position: absolute;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 10;
}

/* === TIÊU ĐỀ === */
.checkout-section-title {
  font-weight: bold;
  margin: 20px 0 10px;
  font-size: 14px;
  color: #333;
}

/* === DANH SÁCH SẢN PHẨM === */
.cart-item {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  align-items: center;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.cart-item .remove-btn {
  background: rgba(0, 0, 0, 0.07); /* ✅ xám nhạt, mờ 70% */
  border: none;
  color: #000;                    /* ✅ chữ X màu đen */
  font-size: 14px;
  width: 24px;                    /* ✅ nhỏ hơn */
  height: 24px;
  border-radius: 4px;             /* ✅ vuông nhẹ */
  display: flex;
  align-items: center;
  justify-content: center;        /* ✅ căn giữa chữ */
  cursor: pointer;
  margin-right: 4px;
}
.cart-item img {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
}

.cart-item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.cart-item-name {
  font-size: 14px;
  color: #000;
  margin-bottom: 4px;
}

.cart-item-price-qty {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-item-price {
  font-size: 13px;
  color: #000;
}

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cart-item-qty button {
  width: 24px;
  height: 24px;
  border: none;
  background: #f0f0f0;
  color: #000;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
}

.cart-item-qty span {
  min-width: 20px;
  text-align: center;
}

.cart-empty {
  text-align: center;
  font-size: 14px;
  color: #666;
  padding: 20px;
}

/* === ORDER SUMMARY === */
.checkout-summary .row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 6px;
  color: #000;
}

.checkout-summary .total-row {
  font-weight: bold;
  font-size: 16px;
  margin-top: 10px;
}

.checkout-summary .note {
  font-size: 13px;
  color: #000;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.checkout-summary .note .red-dot {
  width: 10px;
  height: 10px;
  background: red;
  border-radius: 50%;
  display: inline-block;
}

/* === FORM THÔNG TIN NGƯỜI NHẬN === */
.checkout-form {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkout-form .form-row {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.checkout-form input {
  padding: 8px;
  font-size: 16px;
  line-height: 1.35;
  border: 1px solid #ccc;
  border-radius: 6px;
  flex: 1 1 0;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  background: #fff;
  color: #000;
  appearance: none;
  -webkit-appearance: none;
}

.checkout-form .form-row input {
  width: 0;
}

.checkout-form input:focus {
  outline: none;
  border-color: #777;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

/* === NÚT ĐẶT HÀNG === */
#checkoutSubmitBtn {
  width: 100%;
  padding: 14px;
  background: #e53935;
  color: #fff;
  font-weight: bold;
  font-size: 15px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 16px;
}

/* === ICON GIỎ HÀNG FIXED === */
#cartIcon {
  position: fixed;
  top: 10px;
  right: max(12px, calc((100vw - 1168px) / 2));
  font-size: 22px;
  background: #e53935;
  color: #fff;
  padding: 8px 12px;
  border-radius: 50px;
  cursor: pointer;
  z-index: 10001;
}
.note {
  font-size: 12px;
  color: #000;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-style: italic;
}

.red-dot-icon {
  color: #e53935;
  font-size: 14px;
  line-height: 1;
}
/* === ICON GIỎ HÀNG === */
#cartIcon {
  position: fixed;
  top: 12px;
  right: max(12px, calc((100vw - 1168px) / 2));
  background: white;
  width: 42px;
  height: 42px;
  padding: 6px;
  box-sizing: border-box;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(0,0,0,0.2);
  z-index: 9998;
  cursor: pointer;
  opacity: 0.85;
  color: #8a8a8a;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-icon-img {
  width: 30px;
  height: 30px;
  display: block;
}

/* === BADGE SỐ LƯỢNG === */
#cartItemCount {
  position: absolute;
  bottom: -6px;
  right: -6px;
  background: red;
  color: white;
  font-size: 13px;
  font-weight: bold;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0;
  text-align: center;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 0 3px rgba(0,0,0,0.2);
}


/* PROMO CODE - NHẸ NHÀNG, KHÔNG NỔI BẬT */
.promo-code-wrapper {
  margin: 4px 0 2px;
  padding: 2px 0;
}
.promo-toggle-btn {
  background: #f0f0f0;
  border: 1px solid #ddd;
  color: #555;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  font-family: 'Be Vietnam Pro', sans-serif;
  transition: 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.promo-toggle-btn:hover {
  background: #e0e0e0;
}
.promo-input-group {
  display: flex;
  gap: 6px;
  align-items: center;
}
.promo-input {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 16px;
  font-size: 12px;
  font-family: 'Be Vietnam Pro', sans-serif;
  background: #fff;
}
.promo-apply-gray {
  background: #e0e0e0;
  border: none;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  color: #333;
  font-weight: 500;
}
.promo-apply-gray:hover {
  background: #d0d0d0;
}
.promo-message {
  font-size: 11px;
  margin-top: 4px;
  color: #e53935;
}
.promo-applied {
  background: #f1f8e9;
  padding: 4px 8px;
  border-radius: 16px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #2e7d32;
}
.promo-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #777;
}
