/*
 * Storefront theme: a quick-commerce grocery shop for household goods.
 * Loaded only by the shop (templates/base.html), after main.css, so the colours here do not
 * reach the member or administrator screens.
 */
:root {
  --color-primary: #0b7a34;
  --color-primary-strong: #075a26;
  --color-primary-soft: #e8f6ed;
  --color-canvas: #f4f6f8;
  --color-border: #e8ebee;
  --color-border-strong: #cfd5da;
  --color-text: #1c2321;
  --color-muted: #666f6b;
  --focus-ring: 0 0 0 3px rgba(11, 122, 52, 0.35);

  --jm-accent: var(--color-primary);
  --jm-accent-dark: var(--color-primary-strong);
  --jm-accent-soft: var(--color-primary-soft);
  --jm-surface: var(--color-canvas);
  --jm-border: var(--color-border);
  --jm-border-light: #f0f2f4;

  --qc-accent: #ffd34d;
  --qc-offer: #1f63d6;
  --qc-radius: 12px;
  --qc-tabbar: 60px;
}

.qc-header svg, .qc-strip svg, .qc-tile__art svg, .qc-plp__rail svg, .qc-tabbar svg, .qc-cartbar svg,
.qc-trust svg, .qc-empty svg, .mobile-search__field svg { width: 22px; height: 22px; flex-shrink: 0; }

/* ---------------------------------------------------------------- header */
.qc-header { z-index: 1030; background: #fff; border-bottom: 1px solid var(--color-border); }
.qc-header__row { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.qc-brand { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 800; font-size: 1.125rem; color: var(--color-text); text-decoration: none; white-space: nowrap; }
.qc-brand img { border-radius: 10px; object-fit: contain; flex-shrink: 0; }
.qc-location { display: flex; align-items: center; gap: 6px; min-width: 0; min-height: 44px; padding: 4px 10px; border: 0; border-radius: var(--qc-radius); background: transparent; text-align: left; color: var(--color-text); }
.qc-location:hover { background: var(--color-canvas); }
.qc-location svg { color: var(--color-primary); }
.qc-location span { display: grid; min-width: 0; line-height: 1.25; }
.qc-location small { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-muted); }
.qc-location strong { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8125rem; }

.qc-search { position: relative; flex: 1; min-width: 200px; }
.qc-search > svg { position: absolute; top: 50%; left: 14px; transform: translateY(-50%); color: var(--color-muted); pointer-events: none; }
.qc-search input { width: 100%; height: 46px; padding: 0 14px 0 46px; border: 1px solid var(--color-border); border-radius: var(--qc-radius); background: var(--color-canvas); font-size: 0.9375rem; }
.qc-search input:focus { border-color: var(--color-primary); background: #fff; outline: none; box-shadow: var(--focus-ring); }
.qc-search .search-suggestions-dropdown { z-index: 1060; max-height: 70vh; overflow-y: auto; }

.qc-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.qc-action { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 56px; min-height: 44px; padding: 4px 6px; border: 0; border-radius: var(--qc-radius); background: transparent; color: var(--color-text); font-size: 0.6875rem; font-weight: 600; text-decoration: none; }
.qc-action:hover { background: var(--color-canvas); color: var(--color-primary); }
.qc-action__badge { position: absolute; top: 0; right: 4px; }
.qc-cartbtn { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 0; border-radius: var(--qc-radius); background: var(--color-primary); color: #fff; font-weight: 700; font-size: 0.875rem; white-space: nowrap; }
.qc-cartbtn:hover { background: var(--color-primary-strong); }
.qc-cartbtn__count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--qc-accent); color: #1c2321; font-size: 0.6875rem; }
.qc-cartbtn__count[hidden] { display: none; }

.qc-header__mobile-search { padding-bottom: 10px; }
.qc-searchbar { display: flex; align-items: center; gap: 10px; width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--color-border); border-radius: var(--qc-radius); background: var(--color-canvas); color: var(--color-muted); text-align: left; }

/* category strip under the header */
.qc-strip { border-bottom: 1px solid var(--color-border); background: #fff; }
.qc-strip__list { display: flex; gap: 4px; margin-bottom: 0; overflow-x: auto; scrollbar-width: none; list-style: none; }
.qc-strip__list::-webkit-scrollbar { display: none; }
.qc-strip__item { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 76px; max-width: 110px; min-height: 52px; padding: 7px 6px 6px; border-bottom: 3px solid transparent; color: var(--color-muted); font-size: 0.75rem; font-weight: 600; text-align: center; text-decoration: none; }
.qc-strip__item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qc-strip__item:hover, .qc-strip__item.is-active { border-bottom-color: var(--color-primary); color: var(--color-primary); }

/* ---------------------------------------------------------------- page sections */
.qc-section { margin: 18px 0; }
.qc-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.qc-section__head h2 { margin: 0; font-size: 1.1875rem; font-weight: 800; }
.qc-seeall { flex-shrink: 0; padding: 6px 0; color: var(--color-primary); font-size: 0.875rem; font-weight: 700; text-decoration: none; }

.qc-banner { position: relative; overflow: hidden; border-radius: 16px; background: var(--color-canvas); }
.qc-banner__media { display: block; width: 100%; aspect-ratio: 2 / 1; object-fit: contain; }
.qc-banner__title { position: absolute; left: 16px; bottom: 22px; max-width: 80%; margin: 0; padding: 6px 12px; border-radius: 8px; background: rgba(255, 255, 255, 0.92); font-size: 0.9375rem; font-weight: 700; }

/* category tiles */
.qc-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 8px; margin: 0 0 12px; padding: 0; list-style: none; }
.qc-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--color-text); font-size: 0.75rem; font-weight: 600; line-height: 1.25; text-align: center; text-decoration: none; }
.qc-tile__art { display: grid; place-items: center; width: 100%; aspect-ratio: 1; border-radius: 16px; background: #e8f6ed; color: #0b7a34; }
.qc-tile .qc-tile__art svg { width: 52%; height: 52%; max-width: 56px; max-height: 56px; }
.qc-tiles li:nth-child(6n+2) .qc-tile__art { background: #fff3d1; color: #8a5a00; }
.qc-tiles li:nth-child(6n+3) .qc-tile__art { background: #e6effd; color: #1f57b8; }
.qc-tiles li:nth-child(6n+4) .qc-tile__art { background: #fdeae7; color: #ac3b2b; }
.qc-tiles li:nth-child(6n+5) .qc-tile__art { background: #f0eafd; color: #5b3fae; }
.qc-tiles li:nth-child(6n+6) .qc-tile__art { background: #e1f4f4; color: #116b6e; }
.qc-tile:hover .qc-tile__art { box-shadow: inset 0 0 0 2px currentColor; }
.qc-tile__name { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- product card */
.qc-card { display: flex; flex-direction: column; height: 100%; min-width: 0; padding: 8px; border: 1px solid var(--color-border); border-radius: var(--qc-radius); background: #fff; }
.qc-card__media { position: relative; }
.qc-card__media > a { display: block; border-radius: 8px; background: #f8f9fa; }
.qc-card__media img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 8px; }
.qc-card.is-out .qc-card__media img { opacity: 0.45; filter: grayscale(1); }
.qc-card__off { position: absolute; top: 0; left: 0; padding: 3px 7px; border-radius: 8px 0 8px 0; background: var(--qc-offer); color: #fff; font-size: 0.6875rem; font-weight: 800; }
.qc-card__wishform { position: absolute; top: 0; right: 0; margin: 0; }
.qc-wish { display: grid; place-items: center; width: 40px; height: 40px; border: 0; background: transparent; color: #8b948f; }
.qc-wish svg { width: 18px; height: 18px; padding: 0; fill: #fff; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18)); }
.qc-wish.is-active { color: #d6336c; }
.qc-wish.is-active svg { fill: currentColor; }
.qc-card__body { display: flex; flex: 1; flex-direction: column; padding-top: 8px; }
.qc-card__name { display: -webkit-box; min-height: 2.6em; margin: 0; overflow: hidden; font-size: 0.8125rem; font-weight: 600; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.qc-card__name a { color: inherit; text-decoration: none; }
.qc-card__pack { min-height: 1.4em; margin: 2px 0 0; overflow: hidden; color: var(--color-muted); font-size: 0.75rem; text-overflow: ellipsis; white-space: nowrap; }
.qc-card__note { min-height: 1.35em; margin: 0 0 6px; font-size: 0.6875rem; font-weight: 700; }
.qc-card__stock.is-low { color: var(--color-warning-text); }
.qc-card__stock.is-out { color: var(--color-danger-text); }
.qc-card__rating { color: var(--color-muted); }
.qc-card__foot { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 6px; margin-top: auto; }
.qc-card__price { display: flex; flex-direction: column; margin: 0; line-height: 1.25; }
.qc-card__price strong { font-size: 0.9375rem; font-weight: 800; }
.qc-card__price s { color: var(--color-muted); font-size: 0.75rem; }
.qc-card__price .jm-free-delivery { margin: 0; }

/* ---------------------------------------------------------------- ADD and quantity stepper */
.qc-add { margin-left: auto; }
.qc-add__btn, .qc-add__stepper { height: 38px; min-width: 76px; border: 1px solid var(--color-primary); border-radius: 8px; font-weight: 800; font-size: 0.8125rem; }
.qc-add__btn { padding: 0 14px; background: var(--color-primary-soft); color: var(--color-primary); letter-spacing: 0.02em; }
.qc-add__btn:hover:not(:disabled) { background: var(--color-primary); color: #fff; }
.qc-add__btn:disabled { border-color: var(--color-border-strong); background: var(--color-canvas); color: var(--color-muted); cursor: not-allowed; }
.qc-add__stepper { display: flex; align-items: center; overflow: hidden; background: var(--color-primary); color: #fff; }
.qc-add__btn[hidden], .qc-add__stepper[hidden] { display: none; }
.qc-add__stepper button { width: 30px; height: 100%; padding: 0; border: 0; background: transparent; color: inherit; font-size: 1.125rem; line-height: 1; }
.qc-add__stepper button:hover { background: var(--color-primary-strong); }
.qc-add__stepper output { flex: 1; min-width: 18px; text-align: center; }
.qc-add[aria-busy="true"] { opacity: 0.6; pointer-events: none; }
.qc-add--lg .qc-add__btn, .qc-add--lg .qc-add__stepper { height: 48px; min-width: 130px; font-size: 1rem; }
.qc-add--lg .qc-add__stepper button { width: 44px; }

/* ---------------------------------------------------------------- rails and grids */
.qc-rail { position: relative; }
.qc-rail__track { display: grid; grid-auto-flow: column; grid-auto-columns: 44%; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; }
.qc-rail__track::-webkit-scrollbar { display: none; }
.qc-rail__item { min-width: 0; scroll-snap-align: start; }
.qc-rail__arrow { position: absolute; top: 40%; z-index: 2; display: none; place-items: center; width: 40px; height: 40px; border: 1px solid var(--color-border); border-radius: 50%; background: #fff; box-shadow: var(--shadow); }
.qc-rail__arrow svg { width: 18px; height: 18px; }
.qc-rail__arrow--prev { left: -12px; }
.qc-rail__arrow--prev svg { transform: rotate(180deg); }
.qc-rail__arrow--next { right: -12px; }
.qc-rail__arrow:disabled { visibility: hidden; }
.qc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.qc-grid > * { min-width: 0; }
.qc-empty { grid-column: 1 / -1; padding: 48px 16px; text-align: center; color: var(--color-muted); }
.qc-empty svg { width: 56px; height: 56px; margin-bottom: 12px; color: var(--color-primary); }

.qc-trust { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.qc-trust li { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--qc-radius); background: var(--color-canvas); }
.qc-trust svg { width: 30px; height: 30px; color: var(--color-primary); }
.qc-trust span { display: grid; font-size: 0.8125rem; color: var(--color-muted); }
.qc-trust strong { color: var(--color-text); font-size: 0.875rem; }

/* ---------------------------------------------------------------- listing page */
.qc-plp { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 10px; align-items: start; padding-left: 0; }
.qc-plp__rail { position: sticky; top: 118px; display: flex; flex-direction: column; max-height: calc(100vh - 118px - var(--qc-tabbar)); overflow-y: auto; border-right: 1px solid var(--color-border); scrollbar-width: none; }
.qc-plp__rail a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-left: 4px solid transparent; color: var(--color-muted); font-size: 0.6875rem; font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none; overflow-wrap: anywhere; }
.qc-plp__rail .qc-tile__art { width: 44px; border-radius: 12px; background: var(--color-canvas); color: var(--color-muted); }
.qc-plp__rail a[aria-current="page"] { border-left-color: var(--color-primary); background: var(--color-primary-soft); color: var(--color-primary-strong); }
.qc-plp__rail a[aria-current="page"] .qc-tile__art { background: #fff; color: var(--color-primary); }
.qc-plp__main { min-width: 0; padding: 12px 0 24px; }
.qc-plp__toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.qc-plp__title { margin: 0; font-size: 1.0625rem; font-weight: 800; }
.qc-plp__count { margin: 0; color: var(--color-muted); font-size: 0.75rem; }
.qc-chips { display: flex; gap: 8px; margin: 0 0 12px; padding: 0; overflow-x: auto; list-style: none; scrollbar-width: none; }
.qc-chips a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--color-border-strong); border-radius: 999px; color: var(--color-text); font-size: 0.8125rem; font-weight: 600; white-space: nowrap; text-decoration: none; }
.qc-chips a[aria-current="page"] { border-color: var(--color-primary); background: var(--color-primary-soft); color: var(--color-primary-strong); }

/* ---------------------------------------------------------------- product page */
.qc-pdp-pack { margin: -4px 0 8px; color: var(--color-muted); font-weight: 600; }
.qc-buy { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.qc-buy__add .qc-add { margin: 0; }
.qc-buy__now { flex: 1; min-width: 130px; margin: 0; }
.qc-buy__now .btn { min-height: 48px; }
.qc-gallery__rating { position: absolute; top: 12px; left: 12px; z-index: 2; padding: 4px 10px; border-radius: 999px; background: #fff; box-shadow: var(--shadow-sm); font-size: 0.8125rem; font-weight: 700; pointer-events: none; }
.jm-pdp-gallery { position: relative; }
.qc-pdp-bar { position: fixed; right: 0; bottom: calc(var(--qc-tabbar) + env(safe-area-inset-bottom)); left: 0; z-index: 1025; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--color-border); background: #fff; transform: translateY(140%); visibility: hidden; transition: transform 0.2s, visibility 0.2s; }
.qc-pdp-bar.is-visible { transform: none; visibility: visible; }
.qc-pdp-bar__text { display: grid; min-width: 0; line-height: 1.3; }
.qc-pdp-bar__name { overflow: hidden; font-size: 0.8125rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.qc-pdp-bar small { color: var(--color-muted); }
.qc-pdp-bar .qc-add { margin: 0; }

/* ---------------------------------------------------------------- floating cart, tab bar */
.qc-cartbar { position: fixed; right: 12px; bottom: calc(var(--qc-tabbar) + 10px + env(safe-area-inset-bottom)); left: 12px; z-index: 1026; }
.qc-cartbar[hidden] { display: none; }
.qc-cartbar__button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 14px; border: 0; border-radius: 14px; background: var(--color-primary); box-shadow: var(--shadow-lg); color: #fff; text-align: left; }
.qc-cartbar__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: rgba(255, 255, 255, 0.18); }
.qc-cartbar__summary { display: grid; line-height: 1.25; }
.qc-cartbar__summary small { opacity: 0.9; }
.qc-cartbar__cta { display: flex; align-items: center; gap: 2px; margin-left: auto; font-weight: 800; white-space: nowrap; }
.qc-cartbar__cta svg { width: 18px; height: 18px; }

.qc-tabbar { position: fixed; right: 0; bottom: 0; left: 0; z-index: 1030; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--qc-tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--color-border); background: #fff; }
.qc-tabbar a, .qc-tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; border: 0; background: transparent; color: var(--color-muted); font-size: 0.6875rem; font-weight: 600; text-decoration: none; }
.qc-tabbar [aria-current="page"] { color: var(--color-primary); }
.qc-tabbar .qc-action__badge { right: 18%; }

/* ---------------------------------------------------------------- dialogs and notices */
.qc-drawer.offcanvas-bottom { max-height: 80vh; border-radius: 18px 18px 0 0; }
.qc-options { margin: 0; padding: 0; list-style: none; }
.qc-options__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--color-border); }
.qc-options__row:last-child { border-bottom: 0; }
.qc-options__name { display: block; font-weight: 700; }
.qc-options__row .qc-card__price { flex-direction: row; align-items: baseline; gap: 8px; }
.qc-options__off { color: var(--qc-offer); font-size: 0.75rem; font-style: normal; font-weight: 800; }
.qc-toast { position: fixed; bottom: calc(var(--qc-tabbar) + 86px); left: 50%; z-index: 1080; width: max-content; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: var(--qc-radius); background: #1c2321; box-shadow: var(--shadow-lg); color: #fff; font-size: 0.875rem; transform: translateX(-50%); }
.qc-toast[hidden] { display: none; }

.mobile-search__field .mobile-search__icon { color: var(--color-muted); }

/* WhatsApp in its own green, small enough not to cover products. */
body.jm-body .jm-wa-float { width: 46px; height: 46px; background: #1faf54; box-shadow: var(--shadow-lg); }
body.jm-body .jm-wa-float__pulse { display: none; }

@media (max-width: 991.98px) {
  .qc-actions .qc-cartbtn__text { display: none; }
  .qc-cartbtn { padding: 0 12px; }
  .qc-location { margin-left: auto; }
  .qc-actions { margin-left: 0; }
  /* The floating buttons sit above the tab bar, and above the cart bar when it shows. */
  body.jm-body .jm-wa-float { bottom: calc(var(--qc-tabbar) + 14px + env(safe-area-inset-bottom)); }
  body.jm-body.qc-has-cart .jm-wa-float { bottom: calc(var(--qc-tabbar) + 82px + env(safe-area-inset-bottom)); }
  body.jm-body.qc-has-cart { padding-bottom: calc(var(--qc-tabbar) + 76px + env(safe-area-inset-bottom)); }
  body.qc-pdp-bar-open .qc-cartbar { display: none; }
}

@media (max-width: 359.98px) {
  .qc-plp { grid-template-columns: 64px minmax(0, 1fr); gap: 6px; }
  .qc-plp .qc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .qc-plp .qc-card { padding: 5px; }
  .qc-plp .qc-add__stepper button { width: 28px; }
}

@media (max-width: 479.98px) {
  .qc-brand span { display: none; }
  .qc-location strong { max-width: 46vw; }
  .qc-location { margin-left: 0; margin-right: auto; }
  .qc-card__foot .qc-add { width: 100%; }
  .qc-card__foot .qc-add__btn, .qc-card__foot .qc-add__stepper { width: 100%; }
  .qc-modal .modal-dialog { align-items: flex-end; min-height: 100%; margin: 0; max-width: none; }
  .qc-modal .modal-content { border-radius: 18px 18px 0 0; }
}

@media (min-width: 576px) {
  .qc-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .qc-trust { grid-template-columns: repeat(3, 1fr); }
  .qc-rail__track { grid-auto-columns: 190px; }
  .qc-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
  /* Wider screens suit 1600 x 600 banners; other shapes are fitted, never cropped. */
  .qc-banner__media { aspect-ratio: 8 / 3; }
  .qc-banner__title { font-size: 1.25rem; }
}

@media (min-width: 992px) {
  .qc-header__row { min-height: 76px; gap: 20px; }
  .qc-tiles { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 18px 14px; }
  .qc-tile { font-size: 0.8125rem; }
  .qc-rail__arrow { display: grid; }
  .qc-plp { grid-template-columns: 230px minmax(0, 1fr); gap: 20px; padding-left: 12px; }
  .qc-plp__rail { top: 77px; max-height: calc(100vh - 77px); padding-top: 8px; }
  .qc-plp__rail a { flex-direction: row; gap: 12px; padding: 10px; border-radius: 0 10px 10px 0; font-size: 0.875rem; text-align: left; }
  .qc-plp__title { font-size: 1.375rem; }
  .qc-pdp-bar { bottom: 0; justify-content: center; gap: 32px; }
  .qc-cartbar { right: 24px; bottom: 24px; left: auto; width: 360px; }
  .qc-toast { bottom: 100px; }
  body.jm-body.qc-has-cart .jm-wa-float { bottom: 100px; }
}

@media (prefers-reduced-motion: reduce) {
  .qc-pdp-bar { transition: none; }
}
