/* =========================================================
   Lebak Cafe - Cart Sheet (Fasa 3)
   - Hidden by default (attribute hidden) supaya TAK ganggu tap/click.
   - Bila open: add class .sheet--open
   ========================================================= */

.sheet[hidden] { display: none !important; }

.sheet {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  border: 0;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity .18s ease;
}

.sheet__panel {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%) translateY(100%);
  width: min(560px, calc(100% - 16px));
  max-height: min(78vh, 720px);
  background: #fff;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -18px 40px rgba(0,0,0,.35);
  overflow: hidden;
  transition: transform .22s ease;
  will-change: transform;
}

.sheet--open .sheet__backdrop { opacity: 1; }
.sheet--open .sheet__panel { transform: translateX(-50%) translateY(0); }

.sheet__handle {
  width: 56px;
  height: 5px;
  border-radius: 999px;
  background: rgba(0,0,0,0.12);
  margin: 10px auto 8px;
}

.sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #eee;
}

.sheet__title {
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: .2px;
}

.sheet__close {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 0;
  background: #f3f4f6;
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
}

.sheet__view {
  display: flex;
  flex-direction: column;
  height: min(78vh, 720px);
}

.sheet__body {
  padding: 12px 14px;
  overflow: auto;
}

.sheet__empty {
  background: #f9fafb;
  border: 1px dashed #e5e7eb;
  border-radius: 14px;
  padding: 14px;
  color: #111;
}

.sheet__list { display: grid; gap: 10px; }

.cart-row {
  border: 1px solid #eee;
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cart-row__name { font-weight: 900; font-size: .98rem; }

.cart-row__sub {
  font-size: .85rem;
  color: #6b7280;
  margin-top: 2px;
  display: grid;
  gap: 4px;
}

.cart-row__note {
  font-size: .82rem;
  color: #111;
  background: #f9fafb;
  border: 1px solid #eef2f7;
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
}

.cart-row__note--muted { color: #6b7280; }

.cart-row__ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 0;
  background: #111;
  color: #fff;
  cursor: pointer;
  font-weight: 900;
}

.qty-val { min-width: 22px; text-align: center; font-weight: 900; }

.sheet__footer {
  padding: 12px 14px 14px;
  border-top: 1px solid #eee;
  background: #fff;
}

.sheet__total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .92rem;
  margin-bottom: 10px;
}

.sheet__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sheet__btn {
  height: 46px;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  background: #fff;
  font-weight: 900;
  cursor: pointer;
}

.sheet__btn--primary {
  background: #d60000;
  border-color: #d60000;
  color: #fff;
}

.sheet__disclaimer {
  margin-top: 10px;
  font-size: .78rem;
  color: #6b7280;
}

/* meta */
.sheet__meta { display: grid; gap: 14px; }
.sheet__subtitle { font-weight: 900; font-size: 1rem; }

.meta__group {
  border: 1px solid #eee;
  border-radius: 14px;
  padding: 12px;
}

.meta__label { font-weight: 900; margin-bottom: 8px; }
.meta__row { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  border: 1px solid #e5e7eb;
  background: #fff;
  height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  font-weight: 900;
  cursor: pointer;
}

.chip.is-active {
  background: #111;
  color: #fff;
  border-color: #111;
}

.meta__input, .meta__select {
  width: 100%;
  height: 42px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 0 12px;
  font-weight: 700;
}

.meta__hint { font-size: .78rem; color: #6b7280; margin-top: 6px; }

.sheet-lock { overflow: hidden; }

/* ===== Cart: 1 scroll sahaja (scroll pada panel) ===== */
#cartSheet .sheet__panel{
  max-height: 88vh;
  overflow-y: auto;             /* ✅ satu tempat scroll */
  -webkit-overflow-scrolling: touch;
  display: block;               /* jangan flex supaya tak jadi 2 scroll */
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}

/* Matikan scroll dalaman */
#cartSheet .sheet__view,
#cartSheet .sheet__body{
  overflow: visible !important;
  max-height: none !important;
}

/* Buang sticky footer supaya ia jadi sebahagian dari scroll yang sama */
#cartSheet .sheet__footer{
  position: static !important;
  border-top: 1px solid rgba(0,0,0,0.06);
  background: #fff;
}


/* Pastikan cart sheet duduk atas semua */
#cartSheet.sheet { z-index: 3000; }
.bottom-bar { z-index: 1200; } /* bawah sheet */


/* =====================================
   FIX GAP BESAR CART BILA KOSONG
===================================== */

/* Struktur utama cart */
.cart-sheet {
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

/* Bahagian items */
.cart-items {
    flex: 1;
    overflow-y: auto;
}

/* ======= BILA CART KOSONG ======= */
.cart-items:empty {
    flex: 0;
    min-height: 0;
    padding: 0;
}

/* ======= FOOTER (Booking / Bungkus) ======= */
.cart-footer {
    margin-top: 12px;
}

/* ======= MAKLUMAT (Hari, Pax, Tarikh) ======= */
.cart-info {
    margin-top: 12px;
}

/* =========================================
   FIX: Gap besar bila cart kosong + hidden view leak
   (untuk cartSheet versi 1-scroll panel)
========================================= */

/* 1) Paksa semua elemen hidden betul-betul hilang */
#cartSheet [hidden]{
  display: none !important;
}

/* 2) Buang height tetap pada view (ini punca ruang kosong) */
#cartSheet .sheet__view{
  height: auto !important;
}

/* 3) Pastikan panel kekal 1-scroll sahaja */
#cartSheet .sheet__panel{
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 4) Bila cart kosong, bagi body cukup padat (optional kemas) */
#cartSheet #cartEmpty{
  margin: 10px 0 0;
}
