/* ==========================================================================
   Bison – Card sản phẩm (WooCommerce)
   Các trạng thái: cơ bản · nhiều biến thể · giá 0 đặt trước · hết hàng
   Phạm vi: .bcard, .bcard-sheet – không ảnh hưởng style khác của Flatsome
   ========================================================================== */

.bcard,
.bcard-sheet {
  --bcard-red: #C8161D;
  --bcard-red-dark: #9E1016;
  --bcard-black: #141414;
  --bcard-bg-soft: #F4F4F4;
  --bcard-line: #E3E3E3;
  --bcard-line-strong: #CFCFCF;
  --bcard-text-3: #4A4A4A;
  --bcard-muted: #6B6B6B;
  --bcard-star: #E8A317;
  --bcard-star-empty: #DADADA;
  --bcard-zalo: #015CE0;
  --bcard-zalo-dark: #0049B3;
  --bcard-ok: #1F6B3A;
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--bcard-black);
}
.bcard *, .bcard *::before, .bcard *::after,
.bcard-sheet *, .bcard-sheet *::before, .bcard-sheet *::after { box-sizing: border-box; }

/* Reset style mặc định của Flatsome cho button trong card */
.bcard button, .bcard-sheet button {
  margin: 0; min-height: 0; line-height: 1.2; letter-spacing: normal;
  text-transform: none; box-shadow: none; font-family: inherit;
}
.bcard a:focus-visible, .bcard button:focus-visible,
.bcard-sheet a:focus-visible, .bcard-sheet button:focus-visible { outline: 3px solid var(--bcard-red); outline-offset: 2px; }

/* ---------- Khung card ---------- */
.bcard {
  position: relative; display: flex; flex-direction: column; width: 100%; height: 100%;
  background: #fff; border: 1px solid var(--bcard-line); border-radius: 14px; overflow: hidden;
  transition: border-color .15s ease;
}
.bcard:hover { border-color: var(--bcard-black); }

/* ---------- Ảnh + nhãn ---------- */
.bcard__media { position: relative; display: block; aspect-ratio: 1 / 1; background: var(--bcard-bg-soft); overflow: hidden; }
.bcard__media img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; padding: 8%; transition: opacity .25s ease;
}
.bcard__img--alt { opacity: 0; object-fit: cover !important; padding: 0 !important; }
@media (hover: hover) {
  .bcard:hover .bcard__img--alt { opacity: 1; }
  .bcard:hover .bcard__img--main.has-alt { opacity: 0; }
}
.bcard__badge {
  position: absolute; top: 12px; z-index: 2;
  font-size: 13px; font-weight: 700; line-height: 1.2; padding: 5px 10px; border-radius: 6px;
}
.bcard__badge--left { left: 12px; background: var(--bcard-red); color: #fff; }
.bcard__badge--right { right: 12px; }
/* Màu nhãn góc phải (08/10/2026): Bán chạy đỏ · Mới xanh dương · Đặt trước cam · Hot đen · Combo viền đỏ */
.bcard__badge--ban-chay { background: var(--bcard-red); color: #fff; }
.bcard__badge--moi { background: #1565C0; color: #fff; }
.bcard__badge--dat-truoc { background: #D9480F; color: #fff; }
.bcard__badge--hot { background: var(--bcard-black); color: #fff; }
.bcard__badge--combo { background: #fff; color: var(--bcard-red); border: 1.5px solid var(--bcard-red); padding: 3.5px 8.5px; }

.bcard--oos .bcard__media img { opacity: .5; }
.bcard__oos {
  position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .55);
}
.bcard__oos span { background: var(--bcard-black); color: #fff; font-size: 15px; font-weight: 700; padding: 8px 18px; border-radius: 20px; }

/* ---------- Thân card ---------- */
.bcard__body { display: flex; flex-direction: column; gap: 7px; flex: 1; padding: 14px 16px 16px; }
.bcard__name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.7em; font-size: 17px; font-weight: 700; line-height: 1.35;
  color: var(--bcard-black); text-decoration: none;
}
.bcard__name:hover { color: var(--bcard-red); }

.bcard__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; min-height: 20px; font-size: 13px; }
.bcard__stars {
  --r: 0;
  display: inline-block; width: 85px; height: 16px; flex: none;
  background: linear-gradient(90deg, var(--bcard-star) calc(var(--r) / 5 * 100%), var(--bcard-star-empty) 0);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 24'%3E%3Cpath d='M12 2.5l2.9 6.1 6.6.8-4.9 4.6 1.3 6.6L12 17.3l-5.9 3.3 1.3-6.6L2.5 9.4l6.6-.8z'/%3E%3C/svg%3E") repeat-x 0 0 / 17px 16px;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 24'%3E%3Cpath d='M12 2.5l2.9 6.1 6.6.8-4.9 4.6 1.3 6.6L12 17.3l-5.9 3.3 1.3-6.6L2.5 9.4l6.6-.8z'/%3E%3C/svg%3E") repeat-x 0 0 / 17px 16px;
}
.bcard__score { font-weight: 600; }
.bcard__count { color: var(--bcard-muted); }
.bcard__dot { color: #BDBDBD; }
.bcard__sold { color: var(--bcard-text-3); }

.bcard__spec { font-size: 14px; line-height: 1.4; color: var(--bcard-text-3); }
.bcard__options { font-size: 13px; line-height: 1.4; font-weight: 600; }

.bcard__price { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 8px; row-gap: 2px; margin-top: 2px; }
.bcard__price-now { font-size: 21px; font-weight: 800; color: var(--bcard-red); }
.bcard__price-old { font-size: 14px; font-weight: 500; color: var(--bcard-muted); }
.bcard--preorder .bcard__price-now { font-size: 17px; color: var(--bcard-black); }

/* ---------- Nút ---------- */
.bcard__actions { margin-top: auto; padding-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.bcard__row { display: flex; gap: 8px; }
.bcard__buy {
  flex: 1; min-width: 0; height: 48px; border: 0; border-radius: 10px;
  background: var(--bcard-red); color: #fff; font-size: 16px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; text-decoration: none;
}
.bcard__buy:hover { background: var(--bcard-red-dark); color: #fff; }
.bcard__cart {
  flex: none; width: 48px; height: 48px; border-radius: 10px; cursor: pointer; padding: 0;
  border: 1.5px solid var(--bcard-black); background: #fff; color: var(--bcard-black);
  display: flex; align-items: center; justify-content: center;
}
.bcard__cart:hover { background: var(--bcard-bg-soft); color: var(--bcard-black); }
.bcard__cart .bcard-ic-loading, .bcard__cart .bcard-ic-done { display: none; }
.bcard__cart[data-state="loading"] .bcard-ic-cart,
.bcard__cart[data-state="done"] .bcard-ic-cart { display: none; }
.bcard__cart[data-state="loading"] .bcard-ic-loading { display: block; animation: bcard-spin .8s linear infinite; }
.bcard__cart[data-state="done"] { background: var(--bcard-black); color: #fff; }
.bcard__cart[data-state="done"] .bcard-ic-done { display: block; }
.bcard [aria-busy="true"] { pointer-events: none; opacity: .75; }
@keyframes bcard-spin { to { transform: rotate(360deg); } }

.bcard__zalo {
  height: 48px; border-radius: 10px; padding: 0 10px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 16px; font-weight: 700; text-decoration: none; text-align: center; line-height: 1.2;
}
.bcard__zalo img { width: 26px; height: 26px; flex: none; border-radius: 6px; background: #fff; }
.bcard__zalo--preorder { background: var(--bcard-red); color: #fff; }
.bcard__zalo--preorder:hover { background: var(--bcard-red-dark); color: #fff; }
.bcard__zalo--oos { background: var(--bcard-zalo); color: #fff; }
.bcard__zalo--oos:hover { background: var(--bcard-zalo-dark); color: #fff; }

.bcard__msg { display: flex; align-items: center; gap: 6px; min-height: 0; font-size: 13px; font-weight: 600; color: var(--bcard-ok); }
.bcard__msg:empty { display: none; }
.bcard__msg.is-error { color: var(--bcard-red); }

/* ---------- Bảng chọn biến thể trong card (desktop) ---------- */
.bcard__picker {
  /* Cao vừa nội dung, áp đáy card; nội dung dài hơn card thì cuộn bên trong */
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 100%; z-index: 5;
  background: #fff; border-top: 2px solid var(--bcard-black);
  padding: 14px 16px 16px; overflow-y: auto;
  box-shadow: 0 -8px 20px rgba(20, 20, 20, .08);
}
.bcard__picker[hidden] { display: none; }
/* Trong card (PC): bảng chọn gọn hơn để đủ chỗ cho Số lượng + giá */
.bcard__picker .bcard-pick { gap: 10px; min-height: 0; }
.bcard__picker .bcard-pick__foot { margin-top: 2px; }
.bcard__picker .bcard-pick__stepper button { width: 36px; height: 36px; font-size: 20px; }
.bcard__picker .bcard-pick__stepper output { width: 36px; font-size: 15px; }
.bcard-pick__total { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }

/* ---------- Nội dung bảng chọn (dùng chung card + sheet) ---------- */
.bcard-pick { display: flex; flex-direction: column; gap: 12px; min-height: 100%; }
.bcard-pick__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bcard-pick__title { margin: 0; font-size: 15px; font-weight: 700; }
.bcard-pick__close {
  width: 40px; height: 40px; flex: none; border: 0; border-radius: 10px; padding: 0;
  background: var(--bcard-bg-soft); color: var(--bcard-black); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.bcard-pick__group { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; }
.bcard-pick__label { font-size: 13px; color: var(--bcard-text-3); padding: 0; }
.bcard-pick__label strong { color: var(--bcard-black); }
.bcard-pick__opts { display: flex; flex-wrap: wrap; gap: 8px; }
.bcard-pick__opt {
  min-width: 48px; height: 40px; padding: 0 12px; border-radius: 8px; cursor: pointer;
  border: 1.5px solid var(--bcard-line-strong); background: #fff; color: var(--bcard-black);
  font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px;
}
.bcard-pick__opt:hover { border-color: var(--bcard-black); background: #fff; color: var(--bcard-black); }
.bcard-pick__opt[aria-pressed="true"] { background: var(--bcard-black); border-color: var(--bcard-black); color: #fff; }
.bcard-pick__opt.is-out { background: var(--bcard-bg-soft); color: #9A9A9A; border-style: dashed; text-decoration: line-through; cursor: not-allowed; }
.bcard-pick__swatch { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .12); flex: none; }
.bcard-pick__foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.bcard-pick__price { font-size: 20px; font-weight: 800; color: var(--bcard-red); }
.bcard-pick__btns { display: flex; gap: 10px; }
.bcard-pick__btn {
  flex: 1; height: 48px; border-radius: 10px; cursor: pointer; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.bcard-pick__btn--primary { border: 0; background: var(--bcard-red); color: #fff; }
.bcard-pick__btn--primary:hover { background: var(--bcard-red-dark); color: #fff; }
.bcard-pick__btn--ghost { border: 1.5px solid var(--bcard-black); background: #fff; color: var(--bcard-black); }
.bcard-pick__btn--ghost:hover { background: var(--bcard-bg-soft); color: var(--bcard-black); }
.bcard-pick__msg { font-size: 13px; font-weight: 600; color: var(--bcard-red); min-height: 0; }
.bcard-pick__msg:empty { display: none; }
.bcard-pick__loading { padding: 24px 0; text-align: center; color: var(--bcard-text-3); font-size: 14px; }

/* ---------- Bottom sheet (mobile) ---------- */
.bcard-sheet { position: fixed; inset: 0; z-index: 100000; }
.bcard-sheet[hidden] { display: none; }
.bcard-sheet__backdrop { position: absolute; inset: 0; background: rgba(20, 20, 20, .5); border: 0; padding: 0; width: 100%; cursor: pointer; }
.bcard-sheet__panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto;
  background: #fff; border-radius: 20px 20px 0 0;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  animation: bcard-up .22s ease-out;
}
.bcard-sheet__grip { display: block; width: 44px; height: 5px; border-radius: 3px; background: #D9D9D9; margin: 0 auto 12px; }
.bcard-sheet .bcard-pick { gap: 16px; }
.bcard-sheet .bcard-pick__opt { height: 44px; font-size: 15px; padding: 0 14px; }
.bcard-sheet .bcard-pick__btn { height: 52px; font-size: 16px; border-radius: 12px; }
.bcard-pick__product { display: flex; gap: 12px; align-items: center; }
.bcard-pick__thumb { width: 80px; height: 80px; flex: none; border-radius: 10px; background: var(--bcard-bg-soft); object-fit: contain; padding: 6px; }
.bcard-pick__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.bcard-pick__name { font-size: 15px; font-weight: 700; line-height: 1.35; }
.bcard-pick__unit { font-size: 13px; color: var(--bcard-muted); }
.bcard-pick__summary { font-size: 13px; color: var(--bcard-text-3); }
.bcard-pick__qty { display: flex; align-items: center; justify-content: space-between; }
.bcard-pick__stepper { display: flex; align-items: center; border: 1.5px solid var(--bcard-line-strong); border-radius: 10px; overflow: hidden; }
.bcard-pick__stepper button { width: 44px; height: 44px; border: 0; background: #fff; color: var(--bcard-black); font-size: 22px; cursor: pointer; padding: 0; }
.bcard-pick__stepper output { width: 44px; text-align: center; font-size: 16px; font-weight: 700; }
html.bcard-lock, html.bcard-lock body { overflow: hidden; }
@keyframes bcard-up { from { transform: translateY(100%); } to { transform: none; } }

/* ---------- Mobile: card nhỏ (2 cột) ---------- */
@media (max-width: 767px) {
  .bcard { border-radius: 12px; }
  .bcard__badge { top: 8px; font-size: 11px; padding: 3px 7px; }
  .bcard__badge--left { left: 8px; }
  .bcard__badge--right { right: 8px; }
  .bcard__badge--combo { padding: 1.5px 5.5px; }
  .bcard__oos span { font-size: 13px; padding: 6px 14px; }
  .bcard__body { gap: 5px; padding: 10px 10px 12px; }
  .bcard__name { font-size: 14px; }
  .bcard__meta { font-size: 12px; min-height: 17px; gap: 4px; }
  .bcard__stars { width: 69px; height: 13px; -webkit-mask-size: 14px 13px; mask-size: 14px 13px; }
  .bcard__spec, .bcard__options { font-size: 12px; }
  .bcard__price-now { font-size: 17px; }
  .bcard__price-old { font-size: 12px; }
  .bcard--preorder .bcard__price-now { font-size: 15px; }
  .bcard__buy { height: 44px; font-size: 14px; }
  .bcard__cart { width: 44px; height: 44px; }
  .bcard__zalo { height: 44px; font-size: 13px; gap: 6px; padding: 0 6px; }
  .bcard__zalo img { width: 22px; height: 22px; }
  .bcard__msg { font-size: 12px; }
  .bcard__picker { display: none !important; } /* Mobile dùng bottom sheet */
}

@media (prefers-reduced-motion: reduce) {
  .bcard, .bcard *, .bcard-sheet__panel { transition: none !important; animation: none !important; }
}
