/* Zilideon Place - Store tab, Browse layout.
 * Sidebar (categories + refine), results toolbar, chips, grid and a mobile bottom-sheet drawer.
 * Scoped to .zl-store-browse so nothing else on the Place page is affected. */

.zl-store-browse { --zls-green: #0b7a2b; --zls-ink: #172033; --zls-muted: #5b6678; --zls-line: #e4e8ee; --zls-bg: #f7f9fb; display: block; width: 100%; }

/* ── Search (this store only) ───────────────────────────── */
.zl-store-browse .zl-store-top { display: flex; align-items: center; gap: 10px; margin: 12px 0 18px; }
.zl-store-browse .zl-store-search { position: relative; flex: 1 1 auto; min-width: 0; display: flex; align-items: center; background: #fff; border: 1px solid var(--zls-line); border-radius: 12px; padding: 0 6px 0 14px; height: 48px; box-sizing: border-box; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.zl-store-browse .zl-store-search:focus-within { border-color: var(--zls-green); box-shadow: 0 0 0 3px rgba(11, 122, 43, .14); }
.zl-store-browse .zl-store-search .dashicons { color: var(--zls-muted); font-size: 18px; width: 18px; height: 18px; flex: 0 0 auto; }
.zl-store-browse .zl-store-search input[type="search"] { flex: 1 1 auto; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; padding: 0 10px; font: inherit; font-size: 16px; color: var(--zls-ink); box-shadow: none; -webkit-appearance: none; appearance: none; }
.zl-store-browse .zl-store-search input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.zl-store-browse .zl-store-search-clear { display: none; flex: 0 0 auto; width: 30px; height: 30px; margin: 0 6px 0 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--zls-muted); font-size: 22px; line-height: 1; cursor: pointer; align-items: center; justify-content: center; }
.zl-store-browse .zl-store-search-clear:hover, .zl-store-browse .zl-store-search-clear:focus-visible { background: #eef0f3; color: var(--zls-ink); outline: 0; }
.zl-store-browse .zl-store-search input[type="search"]:not(:placeholder-shown) ~ .zl-store-search-clear { display: inline-flex; }
.zl-store-browse .zl-store-search-btn { flex: 0 0 auto; height: 38px; padding: 0 18px; border: 0; border-radius: 9px; background: var(--zls-green); color: #fff; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.zl-store-browse .zl-place-store-filter-toggle { display: none; }

/* Suggestions */
.zl-store-browse .zl-store-suggest { position: absolute; z-index: 60; left: -1px; right: -1px; top: calc(100% + 6px); max-height: min(420px, 70vh); overflow-y: auto; background: #fff; border: 1px solid var(--zls-line); border-radius: 12px; box-shadow: 0 14px 34px rgba(16, 24, 40, .16); padding: 6px; }
.zl-store-browse .zl-store-suggest[hidden] { display: none; }
.zl-store-sg-head { padding: 10px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--zls-muted); }
.zl-store-sg-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--zls-ink); text-decoration: none; cursor: pointer; }
.zl-store-sg-row:hover, .zl-store-sg-row.is-active { background: #e8f3ec; }
.zl-store-sg-thumb { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 8px; background: var(--zls-bg); overflow: hidden; }
.zl-store-sg-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.zl-store-sg-body { display: flex; flex-direction: column; min-width: 0; }
.zl-store-sg-title { font-size: 14px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.zl-store-sg-price, .zl-store-sg-meta { font-size: 12px; font-style: normal; color: var(--zls-muted); font-weight: 600; }
.zl-store-sg-cat { justify-content: space-between; }
.zl-store-sg-all { border-top: 1px solid var(--zls-line); border-radius: 0 0 9px 9px; margin-top: 4px; color: var(--zls-green); font-weight: 700; }
.zl-store-sg-empty { padding: 14px 10px; font-size: 14px; color: var(--zls-muted); }

/* ── Layout ─────────────────────────────────────────────── */
.zl-store-browse .zl-store-layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 28px; align-items: start; }
.zl-store-browse .zl-store-sidebar { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; padding-right: 4px; }
.zl-store-browse .zl-store-main { min-width: 0; }
.zl-store-browse .zl-store-drawer-head, .zl-store-browse .zl-store-drawer-foot { display: none; }
.zl-store-browse .zl-store-side-block { margin: 0 0 20px; }
.zl-store-browse .zl-store-side-title { margin: 0 0 10px; font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--zls-ink); }

/* Categories */
.zl-store-browse .zl-store-cats { display: flex; flex-direction: column; gap: 2px; }
.zl-store-browse .zl-store-cat { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 9px; color: var(--zls-ink); text-decoration: none; font-size: 14px; line-height: 1.25; }
.zl-store-browse .zl-store-cat span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.zl-store-browse .zl-store-cat.is-child { margin-left: 14px; font-size: 13px; }
.zl-store-browse .zl-store-cat:hover, .zl-store-browse .zl-store-cat.is-active, .zl-store-browse .zl-store-cat.is-context { background: #e8f3ec; color: var(--zls-green); }
.zl-store-browse .zl-store-cat.is-active, .zl-store-browse .zl-store-cat.is-context { font-weight: 700; }

/* Refine panel */
.zl-store-browse .zl-store-filter-form { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--zls-line); }
.zl-store-browse .zl-store-panel { display: flex; flex-direction: column; gap: 10px; }
.zl-store-browse .zl-store-select { width: 100%; height: 44px; padding: 0 34px 0 12px; border: 1px solid var(--zls-line); border-radius: 10px; background-color: #fff; font: inherit; font-size: 14px; color: var(--zls-ink); box-sizing: border-box; }
.zl-store-browse .zl-store-field-label, .zl-store-browse .zl-store-swatch-label { display: block; margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--zls-muted); }
.zl-store-browse .zl-store-price-row { display: flex; align-items: center; gap: 6px; }
.zl-store-browse .zl-store-price-row input { flex: 1 1 0; min-width: 0; height: 42px; padding: 0 10px; border: 1px solid var(--zls-line); border-radius: 10px; font: inherit; font-size: 14px; box-sizing: border-box; }
.zl-store-browse .zl-store-currency { font-size: 13px; color: var(--zls-muted); }
.zl-store-browse .zl-store-check { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 14px; color: var(--zls-ink); cursor: pointer; }
.zl-store-browse .zl-store-check input { width: 18px; height: 18px; accent-color: var(--zls-green); }

/* Colour swatches */
.zl-store-browse .zl-store-swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.zl-store-browse .zl-store-swatch-label { flex: 0 0 100%; margin: 0; }
.zl-store-browse .zl-store-swatch { position: relative; cursor: pointer; }
.zl-store-browse .zl-store-swatch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.zl-store-browse .zl-store-swatch i { display: block; width: 28px; height: 28px; border-radius: 50%; background: var(--zl-swatch, #d1d5db); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--zls-line); }
.zl-store-browse .zl-store-swatch input:checked + i { box-shadow: 0 0 0 2px var(--zls-green); }
.zl-store-browse .zl-store-swatch input:focus-visible + i { outline: 2px solid var(--zls-green); outline-offset: 2px; }
.zl-store-browse .zl-store-swatch--any span { display: inline-block; padding: 5px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--zls-line); font-size: 13px; }
.zl-store-browse .zl-store-swatch--any input:checked + span { background: var(--zls-ink); border-color: var(--zls-ink); color: #fff; }

/* ── Results toolbar / chips ───────────────────────────── */
.zl-store-browse .zl-store-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; }
.zl-store-browse .zl-store-heading { min-width: 0; }
.zl-store-browse .zl-store-title { margin: 0; font-size: 24px; line-height: 1.15; color: var(--zls-ink); }
.zl-store-browse .zl-store-count { display: block; margin-top: 4px; font-size: 13px; color: var(--zls-muted); }
.zl-store-browse .zl-store-sort { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--zls-muted); }
.zl-store-browse .zl-store-sort .zl-store-select { width: auto; min-width: 170px; height: 40px; }
.zl-store-browse .zl-store-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.zl-store-browse .zl-store-chips:empty { display: none; }
.zl-store-browse .zl-store-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: #e8f3ec; color: var(--zls-green); font-size: 13px; font-weight: 600; text-decoration: none; }
.zl-store-browse .zl-store-chip:hover { background: #d7ecdf; }
.zl-store-browse .zl-store-chip-clear { align-self: center; font-size: 13px; font-weight: 600; color: var(--zls-muted); text-decoration: underline; }
.zl-store-browse .zl-store-fuzzy { margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; background: #fff8e6; color: #7a5b00; font-size: 14px; }
.zl-store-browse .zl-store-fuzzy[hidden], .zl-store-browse .zl-storefront-no-results[hidden] { display: none; }
.zl-store-browse .zl-storefront-no-results { padding: 28px 16px; text-align: center; color: var(--zls-muted); }

/* Grid: same canonical card as the Browse feed */
.zl-store-browse .zl-storefront-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; transition: opacity .15s; }
.zl-store-browse .zl-storefront-grid.is-loading { opacity: .55; }
.zl-store-browse .zl-storefront-grid > * { min-width: 0; }

/* ── Tablet / phone: sidebar becomes a bottom-sheet drawer ─────────── */
@media (max-width: 768px) {
  .zl-store-browse .zl-store-layout { display: block; }
  .zl-store-browse .zl-store-top { position: sticky; top: 0; z-index: 30; margin: 0 0 12px; padding: 8px 0; background: #fff; }
  .zl-store-browse .zl-store-search { height: 46px; }
  .zl-store-browse .zl-store-search-btn { display: none; }
  .zl-store-browse .zl-place-store-filter-toggle { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; height: 46px; padding: 0 14px; border: 1px solid var(--zls-line); border-radius: 12px; background: #fff; font: inherit; font-size: 14px; font-weight: 600; color: var(--zls-ink); cursor: pointer; }
  .zl-store-browse .zl-store-title { font-size: 20px; }
  .zl-store-browse .zl-store-sort span { display: none; }
  .zl-store-browse .zl-store-sort .zl-store-select { min-width: 0; max-width: 170px; }

  /* Above the fixed bottom nav (z-index 10100) and sized to the visible screen, so no field is
     hidden on short phones. A strip of dimmed page stays above it as a tap-to-close area. */
  .zl-store-browse .zl-store-sidebar { display: none; position: fixed; z-index: 10200; inset: auto 0 0; top: auto; max-height: calc(100vh - 56px); max-height: calc(100dvh - 56px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 0 16px; background: #fff; border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, .18); }
  .zl-store-browse .zl-store-sidebar.zl-store-drawer-open { display: block; }
  .zl-store-browse .zl-store-drawer-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 2; margin: 0 -16px 12px; padding: 14px 16px 10px; background: #fff; border-bottom: 1px solid #eef0f3; border-radius: 18px 18px 0 0; }
  .zl-store-browse .zl-store-drawer-title { font-size: 17px; font-weight: 700; color: var(--zls-ink); }
  .zl-store-browse .zl-store-drawer-close { width: 44px; height: 44px; margin: -6px -8px -6px 0; border: 0; border-radius: 50%; background: #f1f3f6; color: var(--zls-ink); font-size: 26px; line-height: 1; cursor: pointer; }
  .zl-store-browse .zl-store-filter-form > .zl-store-side-title { display: none; }
  .zl-store-browse .zl-store-drawer-foot { display: block; position: sticky; bottom: 0; z-index: 2; margin: 12px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: #fff; border-top: 1px solid #eef0f3; }
  .zl-store-browse .zl-store-drawer-apply { width: 100%; min-height: 48px; border: 0; border-radius: 12px; background: var(--zls-green); color: #fff; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
  .zl-store-browse .zl-storefront-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
.zl-store-backdrop { position: fixed; inset: 0; z-index: 10150; background: rgba(15, 23, 42, .45); }
body.zl-store-lock { overflow: hidden; }

@media (max-width: 360px) { .zl-store-browse .zl-storefront-grid { gap: 8px; } }

/* The store browse layout owns its own columns (search bar on top, sidebar and results below).
   Never let the legacy two-column "search active" grid from frontend.css apply to it. */
.zl-sp-storefront-section.zl-store-browse.zl-storefront-search-active { display: block; }
