/* =====================================================================
 * MasnoonHub Express - Faceted shop filters
 * Desktop sticky sidebar card + active-filter chips + mobile top
 * filter/sort bar + bottom sheet. Ported from faceted-filters-mockup.html
 * (Saif-approved), scoped under .mh-catalog, mhf- prefixed so nothing
 * collides with the existing catalog CSS. Companion JS: shop-filters.js.
 *
 * Number font: Noto Serif Bengali for all DISPLAY numerals (prices, counts,
 * badges, slider, chip values). Body/labels stay Hind Siliguri. The font is
 * enqueued by inc/mh-shop-filters.php (handle mh-sf-fonts).
 *
 * Breakpoint 960px matches woo-catalog.css (where .desk-side hides): at/below
 * it the sidebar is gone and the mobile bar + sheet take over.
 * ===================================================================== */

:root{ --mhf-green:#1f8a4c; --mhf-cream:#f7f3ec; }

/* ---- numeral font (catalog-wide, scoped) -------------------------------- */
.mh-catalog .mhub-price__now,
.mh-catalog .mhub-price__was,
.mh-catalog .mhub-badge,
.mh-catalog .desk-cathead .sub b,
.mh-catalog .desk-toolbar .cnt b,
.mh-catalog .mhf-pv,
.mh-catalog .mhf-ct,
.mh-catalog .mhf-chip b,
.mh-catalog .mhf-tools__n{
  font-family:'Noto Serif Bengali', var(--font-body), serif;
  font-variant-numeric:tabular-nums;
}

/* =====================================================================
 * 01 - DESKTOP SIDEBAR SHELL
 * The existing .desk-side was a bordered scroll column; the new design is a
 * self-contained white card, so neutralise the old chrome and let the card own
 * the look. .desk-side is already display:none <=960px (woo-catalog.css).
 * ===================================================================== */
.mh-catalog .desk-side{
  border-right:0; padding:16px 16px 24px; max-height:none; overflow:visible;
}
.mh-catalog .mhf-filters{
  background:var(--surface,#fff); border:1px solid var(--line); border-radius:var(--r-md,14px);
  box-shadow:0 1px 3px rgba(20,29,51,.08), 0 6px 18px rgba(20,29,51,.06);
  position:sticky; top:16px; overflow:hidden;
}
.mh-catalog .mhf-top{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:14px 16px; background:var(--mhf-cream); border-bottom:1px solid var(--line);
}
.mh-catalog .mhf-top h2{
  font-family:var(--font-body); font-size:15.5px; font-weight:800; color:var(--navy);
  display:flex; align-items:center; gap:8px; margin:0; letter-spacing:0;
}
.mh-catalog .mhf-top h2 svg{ width:17px; height:17px; color:var(--brand); }
.mh-catalog .mhf-clr{
  font-size:13px; color:var(--brand); font-weight:700; cursor:pointer;
  background:none; border:0; text-decoration:none;
}
.mh-catalog .mhf-clr:hover{ text-decoration:underline; }

/* =====================================================================
 * 02 - FACET GROUPS (shared by sidebar + sheet)
 * ===================================================================== */
.mh-catalog .mhf-group{ padding:15px 16px; border-bottom:1px solid var(--line); }
.mh-catalog .mhf-group:last-child{ border-bottom:0; }
.mh-catalog .mhf-applywrap{ padding:14px 16px 16px; }
.mh-catalog .mhf-title{
  font-size:13.5px; font-weight:800; color:var(--navy); margin-bottom:13px;
  display:flex; align-items:center; justify-content:space-between; gap:8px; text-transform:none; letter-spacing:0;
}
.mh-catalog .mhf-title .mhf-car{ color:var(--ink-3); font-weight:600; }

/* ---- price slider (premium) -------------------------------------------- */
.mh-catalog .mhf-range{ position:relative; height:34px; margin:8px 5px 16px; }
.mh-catalog .mhf-track{
  position:absolute; top:15px; left:0; right:0; height:6px; border-radius:6px;
  background:linear-gradient(var(--mhf-cream),#efe7d8); box-shadow:inset 0 1px 2px rgba(20,29,51,.09);
}
.mh-catalog .mhf-fill{
  position:absolute; top:15px; height:6px; border-radius:6px;
  background:linear-gradient(90deg,var(--brand-bright,#f26417),var(--brand,#e0530f));
  box-shadow:0 1px 5px -1px rgba(224,83,15,.55);
}
.mh-catalog .mhf-range input[type=range]{
  position:absolute; top:5px; left:0; width:100%; height:24px; margin:0; background:none;
  pointer-events:none; -webkit-appearance:none; appearance:none;
}
.mh-catalog .mhf-range input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none; appearance:none; pointer-events:auto; width:22px; height:22px; border-radius:50%;
  background:#fff; border:2.5px solid var(--brand); cursor:grab;
  box-shadow:0 2px 6px rgba(20,29,51,.22), 0 0 0 0 rgba(224,83,15,0); transition:box-shadow .15s ease, transform .1s ease;
}
.mh-catalog .mhf-range input[type=range]::-webkit-slider-thumb:hover{ box-shadow:0 2px 9px rgba(20,29,51,.28), 0 0 0 5px rgba(224,83,15,.13); }
.mh-catalog .mhf-range input[type=range]:active::-webkit-slider-thumb{ cursor:grabbing; transform:scale(1.08); }
.mh-catalog .mhf-range input[type=range]::-moz-range-thumb{
  pointer-events:auto; width:22px; height:22px; border-radius:50%; background:#fff; border:2.5px solid var(--brand);
  box-shadow:0 2px 6px rgba(20,29,51,.22); cursor:grab;
}
.mh-catalog .mhf-pricevals{
  display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:14px;
}
.mh-catalog .mhf-pricevals span{ color:var(--ink-3); font-size:12.5px; font-weight:500; }
.mh-catalog .mhf-pv{
  font-weight:700; color:var(--navy); background:#fff; border:1px solid var(--line); border-radius:10px;
  padding:6px 12px; min-width:80px; text-align:center; box-shadow:0 1px 2px rgba(20,29,51,.05);
}

/* ---- checkbox / link option rows --------------------------------------- */
.mh-catalog .mhf-list{ display:flex; flex-direction:column; gap:3px; }
.mh-catalog .mhf-opt{
  display:flex; align-items:center; gap:10px; cursor:pointer; font-size:14px; color:var(--ink);
  user-select:none; padding:7px 0; text-decoration:none;
}
.mh-catalog .mhf-opt input{ position:absolute; opacity:0; width:0; height:0; }
.mh-catalog .mhf-box{
  width:20px; height:20px; border-radius:6px; border:1.8px solid var(--line); flex:none;
  display:grid; place-items:center; color:#fff; transition:background .12s, border-color .12s;
}
.mh-catalog .mhf-box svg{ width:12px; height:12px; opacity:0; transition:opacity .12s; }
.mh-catalog .mhf-opt input:checked + .mhf-box,
.mh-catalog .mhf-opt.on .mhf-box{ background:var(--brand); border-color:var(--brand); }
.mh-catalog .mhf-opt input:checked + .mhf-box svg,
.mh-catalog .mhf-opt.on .mhf-box svg{ opacity:1; }
.mh-catalog .mhf-nm{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mh-catalog .mhf-opt:hover .mhf-nm{ color:var(--brand); }
.mh-catalog .mhf-ct{ color:var(--ink-3); font-size:13px; font-weight:600; flex:none; }

/* ---- in-stock toggle ---------------------------------------------------- */
.mh-catalog .mhf-toggle{
  display:flex; align-items:center; justify-content:space-between; gap:10px; cursor:pointer;
}
.mh-catalog .mhf-tn{ font-size:14px; font-weight:600; color:var(--ink); }
.mh-catalog .mhf-toggle input{ position:absolute; opacity:0; width:0; height:0; }
.mh-catalog .mhf-sw{
  width:42px; height:24px; border-radius:999px; background:var(--line); position:relative; flex:none; transition:background .15s;
}
.mh-catalog .mhf-sw::after{
  content:""; position:absolute; top:3px; left:3px; width:18px; height:18px; border-radius:50%;
  background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.2); transition:transform .15s;
}
.mh-catalog .mhf-toggle input:checked + .mhf-sw{ background:var(--mhf-green); }
.mh-catalog .mhf-toggle input:checked + .mhf-sw::after{ transform:translateX(18px); }

/* ---- apply button ------------------------------------------------------- */
.mh-catalog .mhf-apply{
  width:100%; padding:12px; border:0; border-radius:11px; background:var(--brand); color:#fff;
  font-family:var(--font-body); font-weight:700; font-size:15px; cursor:pointer;
  box-shadow:0 4px 12px rgba(224,83,15,.3); transition:background .15s;
}
.mh-catalog .mhf-apply:hover{ background:var(--navy); }

/* =====================================================================
 * 03 - ACTIVE-FILTER CHIPS (desktop, above the layout)
 * ===================================================================== */
.mh-catalog .mhf-chips{
  display:flex; flex-wrap:wrap; gap:8px; align-items:center;
  padding:4px clamp(14px,1.6vw,28px) 0; margin-top:6px;
}
.mh-catalog .mhf-chips__lbl{ font-size:13px; color:var(--ink-2); margin-right:2px; }
.mh-catalog .mhf-chip{
  display:inline-flex; align-items:center; gap:7px; background:var(--surface,#fff); border:1px solid var(--line);
  color:var(--navy); font-weight:500; font-size:13px; padding:6px 11px; border-radius:var(--r-pill,999px);
  box-shadow:0 1px 3px rgba(20,29,51,.06);
}
.mh-catalog .mhf-chip b{ color:var(--brand); font-weight:600; }
.mh-catalog .mhf-x{
  cursor:pointer; width:16px; height:16px; border-radius:50%; background:var(--mhf-cream);
  display:grid; place-items:center; color:var(--ink-2); font-size:11px; line-height:1; text-decoration:none;
}
.mh-catalog .mhf-x:hover{ background:var(--brand); color:#fff; }
.mh-catalog .mhf-chips .mhf-clear{ margin-left:auto; font-size:13px; color:var(--brand); font-weight:700; }

/* =====================================================================
 * 04 - MOBILE FILTER / SORT BAR (sticky top of listing; hidden >960px)
 * ===================================================================== */
.mh-catalog .mhf-tools{ display:none; }
.mh-catalog .mhf-tools__btn{
  flex:1; display:flex; align-items:center; justify-content:center; gap:7px; padding:13px 8px;
  border:0; background:#fff; font-family:var(--font-body); font-weight:700; font-size:14px; color:var(--navy); cursor:pointer;
}
.mh-catalog .mhf-tools__btn:first-child{ border-right:1px solid var(--line); }
.mh-catalog .mhf-tools__ic{ width:17px; height:17px; }
.mh-catalog .mhf-tools__n{
  background:var(--brand); color:#fff; font-size:11px; line-height:1; border-radius:999px; padding:3px 7px; font-weight:700;
}

/* =====================================================================
 * 05 - MOBILE SCRIM + BOTTOM SHEETS (fixed, ABOVE the bottom nav z-index:1200)
 * ===================================================================== */
.mh-catalog .mhf-scrim{
  position:fixed; inset:0; background:rgba(20,29,51,.5); z-index:1400;
  opacity:0; transition:opacity .2s ease;
}
.mh-catalog .mhf-scrim.open{ opacity:1; }
.mh-catalog .mhf-sheet{
  position:fixed; left:0; right:0; bottom:0; max-height:86vh; z-index:1410;
  background:#fff; border-radius:20px 20px 0 0; box-shadow:0 -10px 30px rgba(20,29,51,.2);
  display:flex; flex-direction:column; transform:translateY(100%); transition:transform .26s cubic-bezier(.22,1,.36,1);
}
.mh-catalog .mhf-sheet.open{ transform:translateY(0); }
.mh-catalog .mhf-sheet__form{ display:flex; flex-direction:column; min-height:0; }
.mh-catalog .mhf-grab{
  width:42px; height:5px; border-radius:5px; background:var(--line); margin:9px auto 4px; cursor:pointer; flex:none;
}
.mh-catalog .mhf-shead{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:4px 18px 12px; border-bottom:1px solid var(--line); flex:none;
}
.mh-catalog .mhf-shead h4{ font-size:16px; color:var(--navy); font-weight:800; margin:0; }
.mh-catalog .mhf-sbody{ flex:1 1 auto; overflow-y:auto; -webkit-overflow-scrolling:touch; padding:2px 18px; min-height:0; }
.mh-catalog .mhf-sbody .mhf-group{ padding:14px 0; }
.mh-catalog .mhf-sfoot{ padding:12px 18px calc(12px + env(safe-area-inset-bottom)); border-top:1px solid var(--line); flex:none; }

/* sort sheet rows */
.mh-catalog .mhf-sortlist{ padding-top:6px; padding-bottom:14px; }
.mh-catalog .mhf-sortopt{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:14px 2px; font-size:15px; color:var(--ink); text-decoration:none; border-bottom:1px solid var(--line-2,#f0ece3);
}
.mh-catalog .mhf-sortopt:last-child{ border-bottom:0; }
.mh-catalog .mhf-sortopt.on{ color:var(--brand); font-weight:700; }
.mh-catalog .mhf-sortopt svg{ width:18px; height:18px; color:var(--brand); }

/* =====================================================================
 * 06 - AJAX BUSY STATE on the grid
 * ===================================================================== */
.mh-catalog .desk-body.mhf-busy{ position:relative; }
.mh-catalog .desk-body.mhf-busy ul.products{ opacity:.45; transition:opacity .15s ease; pointer-events:none; }
.mh-catalog .mhf-spin{
  position:absolute; top:80px; left:50%; transform:translateX(-50%); z-index:5;
  width:34px; height:34px; border-radius:50%; border:3px solid var(--line); border-top-color:var(--brand);
  animation:mhf-spin .8s linear infinite;
}
@keyframes mhf-spin{ to{ transform:translateX(-50%) rotate(360deg); } }

/* =====================================================================
 * 07 - RESPONSIVE TOGGLES
 * ===================================================================== */
@media (max-width:960px){
  .mh-catalog .mhf-chips{ display:none; }
  .mh-catalog .mhf-tools{
    display:flex; background:#fff; border-bottom:1px solid var(--line);
    box-shadow:0 2px 6px rgba(20,29,51,.05); position:sticky; top:0; z-index:6;
  }
  /* the .mhf-tools bar replaces the desktop count+sort toolbar on phones
     (count already shows in the header; sort is the "সাজান" sheet). */
  .mh-catalog .desk-toolbar{ display:none; }
}
@media (min-width:961px){
  .mh-catalog .mhf-scrim,
  .mh-catalog .mhf-sheet{ display:none !important; }
}

/* lock body scroll while a sheet is open (class set by JS on <html>) */
html.mhf-sheet-open, html.mhf-sheet-open body{ overflow:hidden; }
