/* Maxmart redesign — product listings: search results (board 04), category (05), mobile listing with
   the filter sheet (13). Filter behaviour: js/mm-filter.js. */

.mm-listing { display: flex; flex-direction: column; gap: 24px; padding-bottom: 16px; }
.mm-listing__head { display: flex; flex-direction: column; gap: 6px; }
.mm-listing__head .mm-h1 { font-size: 30px; }

.mm-chips-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mm-chips-row .mm-chip { padding: 10px 16px; font-size: var(--mm-fs-md); }
.mm-chips-row .mm-chip.is-active { background: var(--mm-ink); border-color: var(--mm-ink); color: #fff; }
.mm-chips-row .mm-chip.is-active .mm-chip__count { color: #fff; opacity: .7; }

.mm-listing__body { display: flex; align-items: flex-start; gap: 24px; }
.mm-listing__results { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

/* ---------- Filter panel (sidebar on desktop, bottom sheet on mobile) ---------- */
.mm-filter {
  flex: none; width: 272px; box-sizing: border-box;
  background: #fff; border: 1px solid var(--mm-border); border-radius: var(--mm-r-card);
}
.mm-filter form { margin: 0; display: flex; flex-direction: column; }
.mm-filter__head { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 8px; }
.mm-filter__title { font-family: var(--mm-font-display); font-size: var(--mm-fs-lg); font-weight: 800; color: var(--mm-ink); }
.mm-filter__close {
  display: flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border: 0; border-radius: var(--mm-r-btn); background: var(--mm-bg); color: var(--mm-ink);
}
.mm-filter__body { padding: 0 20px 12px; }
.mm-filter__group { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 14px 0; border: 0; border-top: 1px solid #EEF1F4; min-width: 0; }
.mm-filter__group legend { float: left; width: 100%; margin: 0 0 4px; padding: 0; font-size: var(--mm-fs-md); font-weight: 700; color: var(--mm-ink); }
.mm-filter__group legend + * { clear: both; }
.mm-filter__price { display: flex; align-items: center; gap: 8px; color: var(--mm-muted); }
.mm-filter__price .mm-input { height: 40px; min-width: 0; padding: 0 8px; font-size: var(--mm-fs-sm); }
.mm-filter .mm-check { font-size: var(--mm-fs-md); cursor: pointer; }
.mm-filter__more { display: none; }
.mm-filter__group.is-expanded .mm-filter__more { display: flex; }
.mm-filter__show-more { align-self: flex-start; font-size: var(--mm-fs-md); }
.mm-filter__foot { padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--mm-border); }
.mm-filter-backdrop { position: fixed; inset: 0; z-index: 1040; background: rgba(18, 23, 29, .45); }
.mm-filter-backdrop[hidden] { display: none; }

/* ---------- Toolbar: active chips, reset, sort ---------- */
.mm-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mm-toolbar .mm-chip.is-active { padding: 6px 8px 6px 12px; background: var(--mm-brand-soft); border-color: var(--mm-brand-soft); color: var(--mm-brand-dark); font-size: var(--mm-fs-sm); }
.mm-toolbar__reset { margin-left: 4px; font-size: var(--mm-fs-sm); font-weight: 600; }
.mm-toolbar__grow { flex-grow: 1; }
.mm-toolbar__label { margin: 0; font-size: var(--mm-fs-md); color: var(--mm-muted); }
.mm-toolbar__sort { width: auto; height: 40px; padding: 0 32px 0 10px; font-size: var(--mm-fs-md); }
.mm-toolbar .mm-count { margin-left: 2px; }

/* ---------- Empty state ---------- */
.mm-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.mm-empty p { margin: 0; max-width: 460px; }
.mm-empty__icon {
  display: flex; align-items: center; justify-content: center; width: 72px; height: 72px;
  border-radius: 50%; background: var(--mm-brand-soft); color: var(--mm-brand);
}
.mm-empty__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }

.mm-pager { margin-top: 8px; }
.mm-pager:empty { display: none; }

/* ---------- Category / brand / promo (board 05) ---------- */
.mm-breadcrumb ol { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: var(--mm-fs-sm); color: var(--mm-muted-2); }
.mm-breadcrumb .breadcrumb-item { display: flex; gap: 8px; padding: 0; }
/* not "li + li": the CategoryBreadcrumb component puts its JSON-LD script between the items */
.mm-breadcrumb .breadcrumb-item:not(:first-child)::before { content: "/"; padding: 0; color: var(--mm-muted-2); float: none; }
.mm-breadcrumb a { color: var(--mm-muted-2); }
.mm-breadcrumb a:hover { color: var(--mm-brand); }
.mm-breadcrumb .active { color: var(--mm-text); }
.mm-listing__head--inline { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 12px; }
.mm-listing__head--inline .mm-h1 { margin: 0; font-size: 36px; }
.mm-listing > .mm-breadcrumb + .mm-listing__head { margin-top: -8px; }

.mm-subcats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.mm-subcat {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: #fff; border: 1px solid var(--mm-border); border-radius: 14px;
  color: var(--mm-text); font-size: var(--mm-fs-md); font-weight: 600; line-height: 1.3;
}
.mm-subcat:hover { border-color: var(--mm-brand); color: var(--mm-brand); text-decoration: none; }
.mm-subcat__icon { flex: none; display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 10px; background: #F6F7F9; color: var(--mm-brand); }

.mm-filter__head { gap: 12px; }
.mm-filter__title { margin-right: auto; }
.mm-filter__reset { font-size: var(--mm-fs-sm); font-weight: 600; }
.mm-filter__query { height: 40px; font-size: var(--mm-fs-md); }
.mm-filter__tree .mm-check { padding-left: calc(var(--depth, 0) * 18px); }
.mm-filter__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mm-toggle-chip { margin: 0; cursor: pointer; }
.mm-toggle-chip span {
  display: inline-flex; align-items: center; height: 36px; padding: 0 12px;
  border: 1px solid var(--mm-border-strong, #D5DBE1); border-radius: 8px; background: #fff;
  font-size: var(--mm-fs-sm); color: var(--mm-text);
}
.mm-toggle-chip:hover span { border-color: var(--mm-brand); }
.mm-toggle-chip input:checked + span { border: 1.5px solid var(--mm-brand); background: var(--mm-brand-soft); color: var(--mm-brand-dark); font-weight: 600; }
.mm-toggle-chip input:focus-visible + span { outline: 2px solid var(--mm-brand); outline-offset: 2px; }

/* Two-handle price range (_FilterPrice + mm-filter.js) */
.mm-range { position: relative; height: 24px; }
.mm-range__track { position: absolute; top: 10px; left: 0; right: 0; height: 4px; border-radius: 2px; background: var(--mm-border); }
.mm-range__fill { position: absolute; top: 0; bottom: 0; left: 0; right: 0; border-radius: 2px; background: var(--mm-brand); }
.mm-range input[type=range] {
  position: absolute; inset: 0; width: 100%; height: 24px; margin: 0; padding: 0;
  background: none; pointer-events: none; -webkit-appearance: none; appearance: none;
}
.mm-range input[type=range]::-webkit-slider-runnable-track { background: none; height: 24px; }
.mm-range input[type=range]::-moz-range-track { background: none; }
.mm-range input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; pointer-events: auto; cursor: grab; margin-top: 2px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid var(--mm-brand); box-sizing: border-box;
}
.mm-range input[type=range]::-moz-range-thumb {
  pointer-events: auto; cursor: grab; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 2px solid var(--mm-brand); box-sizing: border-box;
}

.mm-chip--dark { background: var(--mm-ink); border-color: var(--mm-ink); color: #fff; }
.mm-chip--dark:hover { color: #fff; border-color: var(--mm-ink); }
.mm-chip--dark .mm-count { background: var(--mm-accent); color: var(--mm-ink); }

.mm-viewtoggle { display: flex; border: 1px solid var(--mm-border-strong, #D5DBE1); border-radius: 8px; overflow: hidden; }
.mm-viewtoggle button { display: flex; align-items: center; justify-content: center; width: 40px; height: 38px; border: 0; background: #fff; color: var(--mm-muted); }
.mm-viewtoggle button[aria-pressed="true"] { background: var(--mm-ink); color: #fff; }

.mm-listing__results .mm-grid-products { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.mm-listing__results .mm-grid-products.is-list { grid-template-columns: 1fr; }

/* ---------- Mobile (board 13) ---------- */
@media (max-width: 767.98px) {
  .mm-listing { gap: 16px; }
  .mm-listing__head .mm-h1 { font-size: 22px; }
  .mm-chips-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--mm-gutter)); padding: 0 var(--mm-gutter); }
  .mm-chips-row::-webkit-scrollbar { display: none; }
  .mm-chips-row .mm-chip { flex: none; padding: 8px 14px; font-size: var(--mm-fs-sm); }
  .mm-listing__body { display: block; }

  .mm-filter {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1050; width: auto; max-height: 88vh;
    display: none; flex-direction: column; border: 0; border-radius: var(--mm-r-xl) var(--mm-r-xl) 0 0;
    box-shadow: var(--mm-shadow-lg);
  }
  .mm-filter.is-open { display: flex; }
  .mm-filter form { flex: 1; min-height: 0; }
  .mm-filter__head { padding: 16px var(--mm-gutter); border-bottom: 1px solid var(--mm-border); }
  .mm-filter__body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 var(--mm-gutter) 12px; }
  .mm-filter__group:first-child { border-top: 0; }

  .mm-toolbar { flex-wrap: nowrap; }
  .mm-toolbar .mm-chip { flex: none; gap: 6px; }
  .mm-toolbar__sort { flex: none; margin-left: auto; }

  .mm-listing__head--inline .mm-h1 { font-size: 22px; }
  .mm-listing__head--inline { gap: 8px; }
  .mm-subcats { display: flex; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--mm-gutter)); padding: 0 var(--mm-gutter); gap: 8px; }
  .mm-subcats::-webkit-scrollbar { display: none; }
  .mm-subcat { flex: none; padding: 8px 12px 8px 8px; font-size: var(--mm-fs-sm); }
  .mm-subcat__icon { width: 36px; height: 36px; }
  .mm-toolbar { overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--mm-gutter)); padding: 0 var(--mm-gutter); }
  .mm-toolbar::-webkit-scrollbar { display: none; }
  .mm-toolbar__grow { display: none; }
  .mm-listing__results .mm-grid-products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Brand listing: attribute groups in one collapsible section per category (develop 593cf0d4). */
.mm-filter__sections-head { margin: 4px 0 0; font-size: var(--mm-fs-sm); font-weight: 600; color: var(--mm-muted); text-transform: uppercase; letter-spacing: .04em; }
.mm-filter__section { border-top: 1px solid var(--mm-border); }
.mm-filter__section > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 8px 0;
  font-weight: 700; color: var(--mm-text); cursor: pointer; list-style: none;
}
.mm-filter__section > summary::-webkit-details-marker { display: none; }
.mm-filter__section > summary::after { content: ""; width: 8px; height: 8px; margin-left: 4px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
.mm-filter__section[open] > summary::after { transform: rotate(-135deg); }
.mm-filter__section > summary > span:first-child { flex: 1; }
.mm-filter__section > .mm-filter__group { padding-left: 4px; }

/* Subcategory tile product count (develop 65c3b3ed); the phone chips stay name-only. */
/* Name and count stack in one column next to the icon, so the count never runs out of the tile. */
.mm-subcat__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mm-subcat__count { font-size: var(--mm-fs-xs); font-weight: 400; color: var(--mm-muted-2); white-space: nowrap; }
@media (max-width: 767.98px) { .mm-subcat__count { display: none; } }
