/* Giỏ hàng + thanh toán COD — kiểu trung tính, theme riêng có thể ghi đè. Dùng chung ô nhập của order-form.css. */

.aomua-atc, .aomua-cart, .aomua-toast {
    --of-primary: #0066B2;
    --of-border: #dee2e6;
    box-sizing: border-box;
}
.aomua-atc *, .aomua-cart *, .aomua-cart *::before, .aomua-cart *::after { box-sizing: border-box; }
.aomua-opt { font-weight: 400; color: #6b7280; }

/* Nút mặc định (theme có thể truyền class nút riêng) */
.aomua-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 42px; padding: 0 20px; font-size: 15px;
    border: 1px solid var(--of-primary); border-radius: 8px;
    background: var(--of-primary); color: #fff;
    font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.aomua-btn:hover { filter: brightness(0.92); color: #fff; }
.aomua-btn--outline { background: #fff; color: var(--of-primary); }
.aomua-btn--outline:hover { background: #f1f7fb; color: var(--of-primary); filter: none; }

/* Ô số lượng */
.aomua-qty { display: inline-flex; align-items: stretch; height: 40px; border: 1px solid var(--of-border); border-radius: 8px; overflow: hidden; background: #fff; }
.aomua-qty button { width: 36px; padding: 0; border: 0; background: #f6f7f9; color: #1f2937; font-size: 18px; line-height: 1; cursor: pointer; }
.aomua-qty button:hover { background: #e9edf2; }
.aomua-qty input { width: 52px; padding: 0; border: 0; border-inline: 1px solid var(--of-border); border-radius: 0; text-align: center; font: inherit; font-weight: 600; color: inherit; background: #fff; -moz-appearance: textfield; appearance: textfield; }
.aomua-qty input::-webkit-outer-spin-button, .aomua-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.aomua-qty input:focus { outline: 2px solid var(--of-primary); outline-offset: -2px; }

/* --- Trang sản phẩm: thêm vào giỏ ------------------------------------------ */
.aomua-atc { margin: 1.1rem 0 0; }
.aomua-atc .aomua-of-choices { margin-bottom: 0.85rem; }
/* Số lượng + Thêm vào giỏ + Mua ngay nằm trên 1 hàng */
.aomua-atc-actions { display: flex; align-items: stretch; gap: 0.6rem; margin-top: 0.25rem; }
.aomua-atc-actions .aomua-qty { flex: none; height: auto; min-height: 40px; }
.aomua-atc-actions > button { flex: 1 1 0; min-width: 0; padding-inline: 12px; white-space: nowrap; }
.aomua-atc-note { margin: 0.75rem 0 0; font-size: 0.82rem; color: #6b7280; }

/* --- Thông báo "Đã thêm vào giỏ hàng" -------------------------------------- */
.aomua-toast {
    position: fixed; left: 50%; bottom: 24px; z-index: 9999;
    display: flex; align-items: center; gap: 14px;
    max-width: calc(100vw - 32px); padding: 12px 18px;
    border-radius: 10px; background: #1f2937; color: #fff; font-size: 15px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
    transform: translate(-50%, 20px); opacity: 0; visibility: hidden;
    transition: opacity .2s, transform .2s, visibility .2s;
}
.aomua-toast.is-open { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.aomua-toast a { color: #fff; font-weight: 700; text-decoration: underline; white-space: nowrap; }

/* --- Trang giỏ hàng --------------------------------------------------------- */
.aomua-cart { color: #1f2937; font-size: 15px; }
.aomua-cart [hidden] { display: none !important; }
.aomua-cart-loading { margin: 0; padding: 2.5rem 1rem; text-align: center; color: #6b7280; }
.aomua-cart-empty { padding: 3rem 1rem; text-align: center; border-radius: 12px; background: #fff; }
.aomua-cart-empty p { margin: 0 0 1rem; }

.aomua-cart-body { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.aomua-cart-main { display: grid; gap: 20px; min-width: 0; }
.aomua-cart-box { padding: 1.25rem 1.5rem 1.5rem; border: 1px solid var(--of-border); border-radius: 12px; background: #fff; }
.aomua-cart-box h2 { margin: 0 0 1rem; padding: 0; border: 0; font-size: 1.1rem; font-weight: 700; line-height: 1.4; }
.aomua-cart-form h2 { margin-top: 1.5rem; }
.aomua-cart-side { position: sticky; top: 90px; }

.aomua-cart-line { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto 110px 32px; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid #eef0f3; }
.aomua-cart-line:first-child { border-top: 0; padding-top: 0; }
.aomua-cart-img { display: block; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; background: #f3f5f8; }
.aomua-cart-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.aomua-cart-info { display: grid; gap: 3px; min-width: 0; }
.aomua-cart-name { color: inherit; font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.aomua-cart-name:hover { color: var(--of-primary); }
.aomua-cart-info small { color: #6b7280; font-size: 0.82rem; }
.aomua-cart-info .aomua-cart-err { color: #dc2626; }
.aomua-cart-price { color: #6b7280; font-size: 0.88rem; }
.aomua-cart-total { text-align: right; color: #dc2626; white-space: nowrap; }
.aomua-cart-remove { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #9ca3af; font-size: 22px; line-height: 1; cursor: pointer; }
.aomua-cart-remove:hover { background: #fef2f2; color: #dc2626; }
.aomua-cart-line.has-error .aomua-cart-img { opacity: 0.5; }
.aomua-cart-more { margin: 1rem 0 0; font-size: 0.9rem; }

.aomua-cart-pay { display: flex; align-items: flex-start; gap: 10px; padding: 0.85rem 1rem; border: 1px solid var(--of-primary); border-radius: 8px; background: #f5fafd; cursor: pointer; }
.aomua-cart-pay input { margin: 3px 0 0; accent-color: var(--of-primary); }
.aomua-cart-pay span { display: grid; gap: 2px; }
.aomua-cart-pay small { color: #6b7280; font-size: 0.85rem; }

.aomua-cart-sum { display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; margin: 0; }
.aomua-cart-sum dt { margin: 0; font-weight: 400; color: #4b5563; }
.aomua-cart-sum dd { margin: 0; text-align: right; font-weight: 600; }
.aomua-cart-sum .is-total { padding-top: 12px; border-top: 1px solid #eef0f3; font-weight: 700; color: #1f2937; }
.aomua-cart-sum dd.is-total { color: #dc2626; font-size: 1.2rem; }
.aomua-cart-ship { margin: 0.85rem 0 0; padding: 0.6rem 0.8rem; border-radius: 8px; background: #fff7ed; color: #9a3412; font-size: 0.85rem; line-height: 1.5; }

.aomua-cart-done { padding: 2.5rem 1.5rem; text-align: center; }
.aomua-cart-done:focus { outline: none; }
.aomua-cart-done-ic { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; margin-bottom: 0.75rem; border-radius: 50%; background: #dcfce7; color: #15803d; font-size: 32px; font-weight: 700; }
.aomua-cart-done h2 { font-size: 1.4rem; margin-bottom: 0.5rem; }
.aomua-cart-done p { margin: 0 auto 0.6rem; max-width: 560px; }
.aomua-cart-done-code { font-size: 1.05rem; }
.aomua-cart-done-code strong { color: var(--of-primary); font-size: 1.2rem; }
.aomua-cart-done .aomua-btn { margin-top: 0.75rem; }

@media (max-width: 960px) {
    .aomua-cart-body { grid-template-columns: 1fr; }
    .aomua-cart-side { position: static; }
}

@media (max-width: 600px) {
    .aomua-cart-box { padding: 1rem; }
    .aomua-cart-line { grid-template-columns: 60px minmax(0, 1fr) auto; grid-template-areas: "img info remove" "img qty total"; gap: 8px 12px; align-items: start; }
    .aomua-cart-img { grid-area: img; width: 60px; height: 60px; }
    .aomua-cart-info { grid-area: info; }
    .aomua-cart-line .aomua-qty { grid-area: qty; justify-self: start; height: 36px; }
    .aomua-cart-total { grid-area: total; align-self: center; }
    .aomua-cart-remove { grid-area: remove; justify-self: end; }
    .aomua-cart-form .aomua-of-grid--2 { grid-template-columns: 1fr; }
    .aomua-toast { bottom: 76px; }
    .aomua-atc-actions { gap: 0.4rem; }
    .aomua-atc-actions .aomua-qty button { width: 30px; }
    .aomua-atc-actions .aomua-qty input { width: 38px; }
    .aomua-atc-actions > button { padding-inline: 8px; font-size: 14px; }
}
