
/* Base layout  */
.bb-cart{padding:24px 0 40px;}
.bb-cart__head{margin-bottom:12px;}
.bb-cart__title{margin:0 0 2px;font-size:28px;font-weight:400;line-height:1.45;transform:skewX(-6deg);color:#3b2419;}
.bb-cart__sub{margin:0;color:var(--bb-muted);font-size:14px;}

:root{
  --bb-blue: #0970fa;
  --bb-orange: #fc7801;
  --bb-muted: #64748b;
  --bb-border: #e5e7eb;
  --bb-card: #ffffff;
  --bb-radius: 16px;
  --bb-shadow: 0 10px 30px rgba(0,0,0,.06);
}


/* กริดซ้าย-ขวา */
.bb-cart__grid{
  display:grid; grid-template-columns:1fr; gap:18px; margin-top:18px;
}
@media (min-width:960px){ .bb-cart__grid{ grid-template-columns:2fr 1fr; } }

/* Card */
.bb-card{ background:var(--bb-card); border:1px solid var(--bb-border); border-radius:var(--bb-radius); box-shadow:var(--bb-shadow); }
.bb-card__head{ padding:16px 18px; border-bottom:1px solid var(--bb-border); display:flex; align-items:center; justify-content:space-between; gap:12px; }
.bb-card__title{ margin:0; font-size:18px; font-weight:600; }
.bb-card__body{ padding:12px 18px; }

/* ปุ่มเล็ก */
.bb-btn{ display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:10px 14px; border-radius:12px; border:1px solid var(--bb-border); background:#fff; cursor:pointer; text-decoration:none; color:inherit; }
.bb-btn--primary{ background:var(--bb-blue); color:#fff; border-color:transparent; }
.bb-btn--ghost{ background:#fff; }

/* แถบแจ้งเตือนใต้ลิสต์ */
.bb-list__foot{ padding:12px 18px 18px; border-top:1px solid var(--bb-border); }
.bb-note{ background:#fff7ed; color:#9a3412; border:1px solid #fed7aa; border-radius:12px; padding:10px 12px; font-size:13px; display:flex; gap:10px; align-items:flex-start; }

/* Summary (ขวา) */
.summary-row{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 0; font-size:15px; }
.summary-row.is-total{ font-weight:700; font-size:18px; padding-top:12px; border-top:1px dashed #e8eaee; }
.bb-checkout{ display:flex; flex-direction:column; gap:10px; padding:12px 18px 18px; }
.bb-cta{ height:46px; border-radius:12px; border:0; font-weight:700; cursor:pointer; }
.bb-cta--primary{ background:var(--bb-orange); color:#fff; }
/* Radio pill .bb-cta--ghost{ background:#fff; border:1px solid var(--bb-border);  } */

/* Radio pill */
.bb-radio{ display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
.bb-radio label{ display:inline-flex; align-items:center; gap:8px; padding:8px 12px; border:1px solid var(--bb-border); border-radius:999px; background:#fff; cursor:pointer; }
.bb-radio input{ appearance:none; width:14px; height:14px; border-radius:50%; border:2px solid var(--bb-blue); position:relative; }
.bb-radio input:checked::after{ content:""; position:absolute; inset:3px; border-radius:50%; background:var(--bb-blue); }

/* Sticky bar (mobile only) */
.sticky-checkout{ position:sticky; bottom:0; z-index:20; background:#fff; border-top:1px solid var(--bb-border); display:none; }
.sticky-checkout .row{ display:flex; align-items:center; justify-content:space-between; gap:14px; padding:10px 16px; }
.sticky-checkout .total{ font-size:18px; font-weight:700; }
.sticky-checkout .go{ display:inline-flex; align-items:center; justify-content:center; height:44px; padding:0 18px; background:var(--bb-orange); color:#fff; border-radius:12px; border:0; font-weight:700; cursor:pointer; }
@media (max-width:959.98px){ .sticky-checkout{ display:block; } }

/* ===== Empty state  ===== */
.bb-empty{ display:grid; place-items:center; text-align:center; padding:40px 24px; }
.bb-empty__img{ width:min(420px,72vw); opacity:.95; margin:0 auto 12px; }
.bb-empty__title{ margin:0 0 6px; font-size:28px; }
.bb-empty__desc{ margin:0 0 14px; color:var(--bb-muted); }
.bb-empty[hidden]{ display:none !important; }

/* ====== Toast (Top Right) ====== */
.bb-toast{
  position: fixed;
  top: 88px;          
  right: 16px;
  bottom: auto;       
  z-index: 9999;      

  display: flex;
  gap: 10px;
  align-items: flex-start;

  background: #fff;
  border: 1px solid var(--bb-border);
  padding: 12px 14px;
  border-radius: 14px;
  box-shadow: var(--bb-shadow);

  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
  transition: opacity .25s ease, transform .25s ease;
}

.bb-toast.is-show{
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.bb-toast__title{
  font-weight: 700;
  margin-bottom: 2px;
}

.bb-toast__desc{
  color: var(--bb-muted);
  font-size: 13px;
}


.bb-modal{ position:fixed; inset:0; z-index:60; }
.bb-modal[hidden]{ display:none; }
.bb-modal__backdrop{ position:absolute; inset:0; background:rgba(0,0,0,.35); }
.bb-modal__panel{ position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); width:min(560px, calc(100% - 32px)); background:#fff; border-radius:16px; overflow:hidden; box-shadow:var(--bb-shadow); }
.bb-modal__head{ padding:14px 16px; border-bottom:1px solid var(--bb-border); font-weight:700; }
.bb-modal__body{ padding:14px 16px; color:var(--bb-muted); }
.bb-modal__foot{ padding:12px 16px; display:flex; justify-content:flex-end; gap:10px; border-top:1px solid var(--bb-border); }
.bb-modal__btn{ height:40px; padding:0 14px; border-radius:12px; border:1px solid var(--bb-border); background:#fff; cursor:pointer; }
.bb-modal__btn--ok{ background:var(--bb-orange); color:#fff; border-color:transparent; }


/* คูปอง */
.bb-coupon{ display:flex; gap:10px; margin:4px 0 12px; }
.bb-input{ flex:1; height:40px; padding:0 12px; border-radius:12px; border:1px solid var(--bb-border); outline:none; }
.bb-input:focus{ box-shadow: 0 0 0 3px rgba(9,112,250,.18); border-color: transparent; }

/* กลุ่มการจัดส่ง + เส้นคั่น */
.summary-group{ padding:6px 0 2px; }
.summary-label{ font-weight:600; margin-bottom:6px; }
.summary-divider{ height:1px; background:#e8eaee; margin:10px 0; }

.summary-row{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 0; font-size:15px; }
.summary-row.is-total{ font-weight:700; font-size:18px; }





/* ====== ITEM LIST (แก้รูปใหญ่เต็มการ์ด) ====== */
#bb-items{ padding: 4px 0; }

.bb-item{
  display:grid;
  grid-template-columns:
    84px
    minmax(0,1fr)
    auto
    36px;
  gap:14px;
  align-items:center;
  padding:12px 0;
  border-bottom:1px dashed #e8eaee;
}


.bb-item > *{
  min-width: 0;
}

.bb-item:last-child{ border-bottom:none; }

.bb-item__img{
  width:84px; height:84px;
  border-radius:12px;
  object-fit:cover;
  border:1px solid var(--bb-border);
  background:#fff;
}
.bb-item__ph{
  width:84px; height:84px;
  border-radius:12px;
  background:#f8fafc;
  border:1px solid var(--bb-border);
}

.bb-item__title{ margin:0 0 4px; font-size:16px; font-weight:600; }
.bb-item__meta{ margin:0; color:var(--bb-muted); font-size:13px; }

.bb-item__actions{ margin-top:10px; display:flex; align-items:center; gap:10px; }

/* ตัวเพิ่ม/ลดจำนวน */
.bb-qty{
  display:inline-flex;
  border:1px solid var(--bb-border);
  border-radius:12px;
  overflow:hidden;
  background:#fff;
}
.bb-qty button{
  width:34px; height:34px; border:0; background:#fff; cursor:pointer;
  font-size:18px; line-height:1;
}
.bb-qty input{
  width:48px; height:34px; border:0; text-align:center; font:inherit; outline:none;
  border-left:1px solid var(--bb-border); border-right:1px solid var(--bb-border);
}

/* ราคา + ปุ่มถังขยะ */
.bb-item__price{ font-weight:700; min-width:0; text-align:right; }
.bb-remove{
  width:36px; height:36px; border-radius:10px;
  border:1px solid var(--bb-border); background:#fff; color:#9ca3af;
  display:inline-flex; align-items:center; justify-content:center; cursor:pointer;
}
.bb-remove:hover{ color:#ef4444; border-color:#fecaca; background:#fff5f5; }



@media (max-width: 640px){

  .bb-item{
    display:grid;
    grid-template-columns: 72px minmax(0,1fr) auto 32px;
    grid-template-areas:
      "img title price remove"
      "img qty   price remove";
    grid-auto-rows: auto;
    gap:8px 10px;
    align-items:start;
  }


  /* map ตำแหน่ง */
  .bb-item__img,
  .bb-item__ph{ grid-area: img; }

  .bb-item__info{ grid-area: title; }

  .bb-item__actions{
  grid-area: qty;
  align-self: start;
}

  .bb-item__price{
    grid-area: price;
    align-self:end;
    white-space:nowrap;
    font-size:17px;
  }

  .bb-remove{
    grid-area: remove;
    align-self:end;
  }

  /* รูป */
  .bb-item__img,
  .bb-item__ph{
    width:72px;
    height:72px;
  }

  /* ชื่อสินค้า */
  .bb-item__title{
    font-size:15px;
    line-height:1.35;
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;
    word-break:keep-all;
    overflow-wrap:anywhere;
  }

  .bb-item__meta{
    font-size:12px;
  }

  /* ปุ่มเพิ่มลด */
.bb-qty{
  margin-top: auto;        /* ดันลงล่าง */
  align-self: flex-start;  /* ชิดซ้าย */
}


  /* ปุ่มลบ */
  .bb-remove{
    width:32px;
    height:32px;
  }
}

.bb-item__actions{
  grid-area: qty;
  justify-self: start;
  margin-left: -80px;   /* ← ดึงกลับมาชิดใต้รูป */
}



/* เผื่อพื้นที่ให้ sticky checkout (มือถือ) */
@media (max-width: 959.98px){
  .bb-cart{
    padding-bottom: 96px; /* สูงกว่า sticky-checkout นิดนึง */
  }
}


