:root{
  --bnav-bg:#fff;
  --bnav-text:#0f172a;
  --bnav-muted:#64748b;
  --bnav-border:#e5e7eb;
  --bnav-shadow:0 -6px 24px rgba(2,6,23,.08);
  --bnav-safe: env(safe-area-inset-bottom, 0px);
}

/* Bottom Nav */
.ecu-bnav{
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
  display: grid; grid-template-columns: repeat(5,1fr); gap: 2px;
  background: var(--bnav-bg); color: var(--bnav-text);
  border-top:1px solid var(--bnav-border);
  box-shadow: var(--bnav-shadow);
  padding: 6px 8px calc(6px + var(--bnav-safe));
}
.bnav__item{
  -webkit-appearance:none; appearance:none; background:none; border:0; outline:none;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:4px; padding:8px 6px; border-radius:10px; text-decoration:none; color:inherit;
  font-size:11.5px; line-height:1; position:relative;
}
.bnav__item:hover{ background:#f8fafc; }
.bnav__item svg{ width:28px; height:28px; }

/* Badge (shared กับ edd-cart-count) */
.bnav__badge,
.edd-cart-count{
  display:none; min-width:18px; height:18px; padding:0 5px;
  align-items:center; justify-content:center; border-radius:999px;
  background:#ef4444; color:#fff; font-size:11px; font-weight:700;
  position:absolute; top:2px; right:18px;
}
.edd-cart-count.is-empty{ display:none; }
.bnav__badge[data-count]:not([data-count="0"]){ display:flex; }
/* กันเนื้อหาโดนบัง */
body{ padding-bottom: max(64px, calc(56px + var(--bnav-safe))); }

/* Optional: แสดงเฉพาะบนมือถือ (เปิดด้วย class is-mobile-only ที่ปลั๊กอินแปะให้เมื่อเปิดฟิลเตอร์) */
.ecu-bnav.is-mobile-only{ display:grid; }
@media (min-width:1024px){
  .ecu-bnav.is-mobile-only{ display:none !important; }
}

/* ========== Account Sheet (ใช้ markup .ecu-sheet) ========== */
:root{
  --acc-bg:#fff; --acc-text:#0f172a; --acc-muted:#64748b;
  --acc-border:#e5e7eb; --acc-shadow:0 20px 50px rgba(2,6,23,.16);
  --acc-radius:18px; --acc-safe: env(safe-area-inset-bottom, 0px);
}

#ecu-account-sheet.ecu-sheet{
  position: fixed; inset: 0; z-index: 1200;
  display: grid; grid-template-columns: 1fr;
  pointer-events: none; visibility: hidden;
}
#ecu-account-sheet .ecu-sheet__backdrop{
  background: rgba(15,23,42,.45);
  opacity: 0; transition: opacity .2s ease;
}

/* mobile: bottom sheet */
#ecu-account-sheet .ecu-sheet__panel{
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--acc-bg); color: var(--acc-text);
  border-top-left-radius: var(--acc-radius);
  border-top-right-radius: var(--acc-radius);
  box-shadow: var(--acc-shadow);
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.2,.6,.2,1);
  max-height: calc(92vh - var(--acc-safe));
  display: flex; flex-direction: column;
  outline: none;
}
.ecu-sheet__header{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px; border-bottom:1px solid var(--acc-border);
  position: sticky; top: 0; background: var(--acc-bg);
  border-top-left-radius: var(--acc-radius); border-top-right-radius: var(--acc-radius);
}
.ecu-sheet__close{
  background:transparent; border:0; font-size:20px; line-height:1; color:#334155;
  padding:6px; border-radius:10px; cursor:pointer;
}
.ecu-sheet__close:hover{ background:#f1f5f9; }

.ecu-sheet__list{ padding:8px; overflow:auto; }
.sheet__item{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px; margin:8px 0; padding:14px 12px;
  background:#fff; border:1px solid var(--acc-border); border-radius:12px;
  color:inherit; text-decoration:none;
}
.sheet__item:hover{ background:#f8fafc; }
.sheet__danger{ background:#fee2e2; border-color:#fecaca; color:#991b1b; }

#ecu-account-sheet.open{ pointer-events:auto; visibility:visible; }
#ecu-account-sheet.open .ecu-sheet__backdrop{ opacity:1; }
#ecu-account-sheet.open .ecu-sheet__panel{ transform: translateY(0); }

/* desktop: side drawer ขวา */
@media (min-width: 992px){
  #ecu-account-sheet .ecu-sheet__panel{
    top: 0; bottom: 0; right: 0; left: auto;
    width: min(380px, 92vw);
    border-top-left-radius: 0; 
    border-top-right-radius: 0; 
    border-bottom-left-radius: 0;
    border-left: 1px solid var(--acc-border);
    transform: translateX(8px);
  }
  #ecu-account-sheet.open .ecu-sheet__panel{ transform: translateX(0); }
}

/* เมื่อเปิด sheet ให้ล็อกสกรอลล์พื้นหลัง */
body.ecu-acc-lock{ overflow:hidden; touch-action:none; }

