/* ============================================================
   Addaliil — Midnight Market · home-search.css
   Home universal-search redesign (hs-*). UI shell — stub data.
   Token-driven; works in both light/dark (data-bs-theme).
   Reuses globals: mm-card, mm-btn, mm-obj* (components.css).
   ============================================================ */

.hs-wrap{max-width:720px;margin-inline:auto}

/* ---- accordion: collapsed summary bar ---- */
.hs-summary{display:flex;align-items:center;gap:10px;padding:11px 13px;margin-bottom:12px}
.hs-sum-ico{color:var(--brand-dark);font-size:1.05rem}
.hs-sum-text{flex:1;min-width:0;font-weight:600;font-size:.92rem;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ---- accordion: expanded panel ---- */
.hs-panel{padding:13px;margin-bottom:12px}
.hs-panel-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.hs-panel-title{font-size:1rem;font-weight:800;margin:0;color:var(--text)}

/* ---- mode toggle (text / category) ---- */
/* spec 036 D1 — the `.hs-modes` / `.hs-mode` toggle was REMOVED: search is one surface with filters, never
   two mutually exclusive modes. The rules are gone with it; do not reintroduce them. */

/* Caption above the always-present category cascade (it is a filter now, not an alternative mode). */
.hs-filters-cap{font-size:.74rem;color:var(--brand-dark);font-weight:700;margin:14px 0 8px;
  padding-top:12px;border-top:1px solid var(--border);display:flex;align-items:center;gap:6px}

/* ---- fields ---- */
.hs-row{display:flex;gap:8px}
.hs-grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.hs-label{display:block;font-size:.74rem;color:var(--muted);margin-bottom:.3rem;font-weight:600}
.hs-hint{font-size:.74rem;color:var(--muted);margin-top:8px}
.hs-search-wrap{position:relative;flex:1}
.hs-search-wrap .hs-sicon{position:absolute;inset-inline-start:11px;top:50%;transform:translateY(-50%);color:var(--muted)}
.hs-search-wrap input{padding-inline-start:34px}

/* ---- category attributes panel (auto after level 3) ---- */
.hs-attrs{border-top:1px solid var(--border);margin-top:12px;padding-top:10px}
.hs-attrs-cap{font-size:.74rem;color:var(--brand-dark);margin-bottom:8px}

/* ---- result-type chips (multi-select) ---- */
.hs-types{display:flex;flex-wrap:wrap;gap:7px;margin:0 2px 10px}
/* spec 037 — the chips moved INSIDE the panel, above the query box (type is the coarsest choice, so it is
   answered first). The rule below is what separates that band from the text/category fields; it mirrors the
   divider `.hs-filters-cap` draws above the cascade, so the panel reads as three ordered sections. */
.hs-panel .hs-types{margin:0 0 12px;padding-bottom:12px;border-bottom:1px solid var(--border)}
.hs-tchip{display:inline-flex;align-items:center;gap:7px;border:1.5px solid currentColor;border-radius:999px;padding:5px 11px;font-size:.82rem;font-weight:700;cursor:pointer;background:transparent}
.hs-tchip.off{opacity:.5;border-color:var(--border);color:var(--muted)}
.hs-tchip .hs-dot{width:9px;height:9px;border-radius:50%;flex:none}
.hs-tchip.off .hs-dot{filter:grayscale(1)}
.hs-c-shop{color:#10b981}
.hs-c-product{color:#3b82f6}
.hs-c-offer{color:#d98309}
.hs-c-deal{color:#8b5cf6}
.hs-c-question{color:#ec4899}

/* ---- results toolbar ---- */
.hs-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:0 2px 10px}
.hs-count{font-size:.95rem;font-weight:700}
.hs-mini-select{width:auto;height:30px;padding:2px 8px;padding-inline-end:1.9rem}  /* room for the dropdown caret (RTL-safe) */
.hs-seg{display:inline-flex;border:1px solid var(--border);border-radius:var(--radius-sm);overflow:hidden;margin-inline-start:auto}
.hs-seg-btn{border:0;background:transparent;padding:7px 11px;color:var(--muted);cursor:pointer;font-size:.95rem}
.hs-seg-btn.active{background:var(--brand-dark);color:var(--on-brand)}

/* ---- no-location banner (geo-if-present rule) ---- */
.hs-noloc{display:flex;align-items:center;gap:8px;background:var(--warn-soft);color:var(--warn);border-radius:var(--radius-sm);padding:9px 12px;font-size:.84rem;margin:0 2px 12px}

/* ---- map over results ---- */
.hs-map{position:relative;height:300px;border-radius:var(--radius-sm);overflow:hidden;border:1px solid var(--border);background:var(--surface2);margin-bottom:12px}
.hs-map .leaflet-container{width:100%;height:100%;background:var(--surface2)}
.hs-map .leaflet-tile-pane{filter:var(--map-filter)}
.hs-map-loading{display:flex;align-items:center;justify-content:center;gap:.5rem;height:100%;color:var(--muted);font-size:.85rem}
.hs-here{position:absolute;top:8px;inset-inline-start:50%;transform:translateX(-50%);z-index:500}
.hs-legend{position:absolute;inset-block-end:8px;inset-inline-start:8px;z-index:500;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-sm);padding:6px 9px;font-size:.7rem;color:var(--muted);display:flex;gap:9px;flex-wrap:wrap}
.hs-legend .hs-dot{width:9px;height:9px;border-radius:50%;display:inline-block;vertical-align:middle}

/* leaflet divIcon teardrop pins */
.hs-pin{display:flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:50% 50% 50% 0;transform:rotate(-45deg);border:2px solid #fff;box-shadow:var(--shadow-sm)}
.hs-pin i{transform:rotate(45deg);color:#fff;font-size:12px}
.hs-pin.shop{background:#10b981}
.hs-pin.product{background:#3b82f6}
.hs-pin.offer{background:#d98309}
.hs-pin.deal{background:#8b5cf6}
.hs-pin.question{background:#ec4899}

/* ============================================================
   result cards (spec 038)
   Five bands, in this order: media (photo + heart + QR) → body (title, price, category)
   → owner (shop/person + place) → actions (call · whatsapp · directions) → engagement.

   TEXT COLOUR RULE (owner, 2026-07-29): no washed-out type anywhere on a card. Every value a shopper
   reads — price, shop name, place, counts — is var(--text) or a saturated brand/accent colour at weight
   600+. var(--muted) is reserved for the description snippet alone, and icons carry colour instead of
   opacity. Nothing on this card uses opacity to de-emphasise text.
   ============================================================ */
.hs-results{display:grid;grid-template-columns:1fr;gap:14px}
.hs-rcard{position:relative;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);
  overflow:hidden;box-shadow:var(--shadow-sm);transition:border-color .16s,box-shadow .16s,transform .16s}
.hs-rcard:hover{border-color:var(--brand);box-shadow:var(--shadow);transform:translateY(-1px)}

/* the media band is the positioning context for the two corner controls (heart / QR) */
.hs-rmediawrap{position:relative}

/* top row: small thumbnail (the over-large portrait is gone) + body, side by side */
.hs-rpost{display:flex;gap:12px;padding:12px;align-items:flex-start;text-decoration:none;color:var(--text)}
.hs-rmedia{position:relative;flex:none;width:104px;height:104px;border-radius:var(--radius-sm);overflow:hidden;display:flex;align-items:center;justify-content:center;
  background:repeating-linear-gradient(45deg,var(--surface2) 0 10px,var(--surface) 10px 20px)}
.hs-rmedia img{width:100%;height:100%;object-fit:cover}
.hs-rmedia-ico{font-size:2rem;color:var(--ph-fg)}
.hs-rcard[data-type="shop"] .hs-rmedia-ico{color:#10b981}
.hs-rcard[data-type="product"] .hs-rmedia-ico{color:#3b82f6}
.hs-rcard[data-type="offer"] .hs-rmedia-ico{color:#d98309}
.hs-rcard[data-type="deal"] .hs-rmedia-ico{color:#8b5cf6}
.hs-rcard[data-type="question"] .hs-rmedia-ico{color:#ec4899}

/* type tag — moved to the BOTTOM-start of the media: the top corners now belong to the heart and the QR. */
.hs-rtag{position:absolute;inset-block-end:6px;inset-inline-start:6px;z-index:2;color:#fff;font-size:.6rem;font-weight:800;
  padding:.18rem .5rem;border-radius:6px;line-height:1.25;box-shadow:var(--shadow-sm)}
.hs-rcard[data-type="shop"] .hs-rtag{background:#10b981}
.hs-rcard[data-type="product"] .hs-rtag{background:#3b82f6}
.hs-rcard[data-type="offer"] .hs-rtag{background:#d98309}
.hs-rcard[data-type="deal"] .hs-rtag{background:#8b5cf6}
.hs-rcard[data-type="question"] .hs-rtag{background:#ec4899}

/* gallery count — bottom-end of the media, opposite the type tag */
.hs-rshots{position:absolute;inset-block-end:6px;inset-inline-end:6px;z-index:2;display:inline-flex;align-items:center;gap:.28rem;
  background:rgba(13,31,23,.72);color:#fff;font-size:.64rem;font-weight:800;padding:.18rem .48rem;border-radius:6px;line-height:1.25}

/* favourite + QR — the two top corners of the media, OUTSIDE the post link (never nest a control in an
   anchor). Logical inset properties put the heart at the reading-end and the QR at the reading-start, so the
   pair mirrors correctly under RTL without a separate rule. */
.hs-rfav,.hs-rqr{position:absolute;inset-block-start:10px;z-index:3;display:inline-flex;align-items:center;justify-content:center;
  border:1px solid var(--border);background:var(--surface);cursor:pointer;box-shadow:var(--shadow-sm);padding:0}
.hs-rfav{inset-inline-end:10px;width:34px;height:34px;border-radius:50%;color:var(--text);font-size:.85rem;
  transition:color .15s,border-color .15s,transform .15s}
.hs-rfav:hover{color:var(--accent);border-color:var(--accent);transform:scale(1.06)}
.hs-rfav.on{color:var(--accent);border-color:var(--accent)}

.hs-rqr{inset-inline-start:10px;width:56px;height:56px;border-radius:10px;overflow:hidden;
  transition:border-color .15s,transform .15s,box-shadow .15s}
.hs-rqr img{display:block;width:100%;height:100%}
.hs-rqr:hover{border-color:var(--brand);transform:scale(1.06);box-shadow:var(--shadow)}
/* Shops & questions keep the small 104px thumbnail, so the code shrinks to stay off the photo's subject. */
.hs-rcard[data-type="shop"] .hs-rqr,
.hs-rcard[data-type="question"] .hs-rqr{width:44px;height:44px;inset-block-start:8px;inset-inline-start:8px}

/* body: title → price → category chip → description */
.hs-rbody{flex:1;min-width:0}
/* Horizontal variant (shops & questions) only: there the body reaches the card's top corner, so a long title
   would run underneath the favourite button. Reserve its width. The vertical variants need nothing — both
   corner controls sit over the photo, above the body entirely. */
.hs-rcard[data-type="shop"] .hs-rbody,
.hs-rcard[data-type="question"] .hs-rbody{padding-inline-end:42px}
.hs-rtitle{display:block;font-weight:800;font-size:1rem;line-height:1.35;color:var(--text)}
.hs-rprice{font-size:1.15rem;font-weight:900;color:var(--brand-dark);margin:.35rem 0 0;letter-spacing:-.01em}
.hs-rprice .cur{font-size:.78rem;font-weight:800;color:var(--brand-dark)}
/* offers show no price on purpose (see SearchResultCardVm.ShowsPrice) — this replaces it, so the slot never
   reads as "free" or "price missing". */
.hs-roffer{display:inline-flex;align-items:center;gap:.35rem;margin:.35rem 0 0;font-size:.82rem;font-weight:800;color:#d98309}
.hs-rmeta-row{display:flex;flex-wrap:wrap;gap:.35rem;margin-top:.4rem}
.hs-rcat{display:inline-flex;align-items:center;gap:.32rem;font-size:.7rem;font-weight:800;
  color:var(--brand-dark);background:var(--brand-soft);border-radius:99px;padding:.2rem .6rem}
.hs-rdesc{margin:.4rem 0 0;font-size:.82rem;line-height:1.5;color:var(--muted);
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}

/* owner band — shop (or "private seller") + country + the coarse governorate/city/district chips */
.hs-rowner{display:flex;flex-wrap:wrap;align-items:center;gap:.4rem;padding:.1rem 12px .6rem;
  font-size:.78rem;font-weight:700;color:var(--text)}
.hs-rcard[data-type="product"] .hs-rowner,
.hs-rcard[data-type="offer"] .hs-rowner,
.hs-rcard[data-type="deal"] .hs-rowner{padding-inline:.9rem}
.hs-rshop{display:inline-flex;align-items:center;gap:.35rem;max-width:100%;min-width:0;
  color:var(--brand-dark);text-decoration:none;font-weight:800}
.hs-rshop span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
a.hs-rshop:hover{text-decoration:underline}
.hs-rshop.is-person{color:var(--text)}
.hs-rplace{display:inline-flex;align-items:center;gap:.3rem;background:var(--surface2);color:var(--text);
  border:1px solid var(--border);border-radius:99px;padding:.16rem .55rem;font-size:.72rem;font-weight:700}
.hs-rplace i{color:var(--brand-dark)}

/* actions row — real contact affordances, between the owner band and the engagement row */
.hs-ractions{display:flex;gap:.45rem;padding:0 12px .7rem;flex-wrap:wrap}
.hs-rcard[data-type="product"] .hs-ractions,
.hs-rcard[data-type="offer"] .hs-ractions,
.hs-rcard[data-type="deal"] .hs-ractions{padding-inline:.9rem}
.hs-ract{display:inline-flex;align-items:center;gap:.4rem;text-decoration:none;font-size:.78rem;font-weight:800;
  padding:.42rem .78rem;border-radius:10px;border:1px solid var(--border);background:var(--surface);color:var(--text);
  transition:background .15s,border-color .15s,color .15s}
.hs-ract i{font-size:.9rem}
.hs-ract.call{border-color:var(--brand);color:var(--brand-dark)}
.hs-ract.call:hover{background:var(--brand-dark);color:var(--on-brand);border-color:var(--brand-dark)}
.hs-ract.wa{border-color:#25d366;color:#128c48}
.hs-ract.wa:hover{background:#25d366;color:#fff;border-color:#25d366}
.hs-ract.dir{border-color:#3b82f6;color:#1d4ed8}
.hs-ract.dir:hover{background:#3b82f6;color:#fff;border-color:#3b82f6}
.hs-ract.reveal{border-color:var(--warn);color:var(--warn)}
.hs-ract.reveal:hover{background:var(--warn);color:#fff}

/* engagement row: followers · favourites · rating · comments — REAL counts, hydrated per page */
.hs-rengage{display:flex;align-items:center;gap:20px;padding:.55rem 12px .6rem;border-top:1px solid var(--border);
  background:var(--surface2)}
.hs-reng{display:inline-flex;align-items:center;gap:.35rem;font-size:.82rem;font-weight:800;color:var(--text)}
.hs-reng i{font-size:.95rem}
.hs-reng.follow i{color:var(--brand-dark)}
.hs-reng.like i{color:var(--accent)}
.hs-reng.rate i{color:#d97706}
.hs-reng.comment i{color:#3b82f6}
.hs-reng .num{color:var(--text)}

/* vertical variant — Products / Offers / Deals: photo ON TOP + info below (a smaller 16:9 photo, not the
   over-large portrait). Shops & Questions keep the horizontal thumbnail layout above. Same markup; layout
   only switches by data-type. */
.hs-rcard[data-type="product"] .hs-rpost,
.hs-rcard[data-type="offer"] .hs-rpost,
.hs-rcard[data-type="deal"] .hs-rpost{display:block;padding:0}
.hs-rcard[data-type="product"] .hs-rmedia,
.hs-rcard[data-type="offer"] .hs-rmedia,
.hs-rcard[data-type="deal"] .hs-rmedia{width:100%;height:auto;aspect-ratio:16/9;border-radius:0}
.hs-rcard[data-type="product"] .hs-rmedia-ico,
.hs-rcard[data-type="offer"] .hs-rmedia-ico,
.hs-rcard[data-type="deal"] .hs-rmedia-ico{font-size:2.8rem}
.hs-rcard[data-type="product"] .hs-rbody,
.hs-rcard[data-type="offer"] .hs-rbody,
.hs-rcard[data-type="deal"] .hs-rbody{padding:.75rem .9rem .3rem}
.hs-empty{display:flex;flex-direction:column;align-items:center;gap:.5rem;padding:26px;color:var(--muted);text-align:center}

/* ---- enlarged QR (built on demand by home-search.js — a 56px code is for a phone held close, this one is
        for scanning across a desk) ---- */
.hs-qrmodal{position:fixed;inset:0;z-index:1080;display:flex;align-items:center;justify-content:center;
  background:rgba(0,0,0,.62);padding:20px}
.hs-qrmodal[hidden]{display:none}
.hs-qrpanel{background:#fff;border-radius:var(--radius);padding:18px;max-width:min(360px,92vw);text-align:center;
  box-shadow:var(--shadow)}
.hs-qrpanel img{display:block;width:min(280px,72vw);height:auto;margin:0 auto}
.hs-qrcap{margin:.7rem 0 0;font-size:.85rem;font-weight:800;color:#0d1f17;word-break:break-word}
.hs-qrclose{margin-top:.8rem;border:1px solid #0d1f17;background:#0d1f17;color:#fff;font-weight:800;font-size:.8rem;
  border-radius:10px;padding:.45rem 1.1rem;cursor:pointer}

/* ---- stub badge ---- */
.hs-stub{display:inline-flex;align-items:center;gap:5px;font-size:.7rem;font-weight:700;color:var(--warn);background:var(--warn-soft);border-radius:999px;padding:3px 10px}

/* ---- infinite-scroll sentinel + spinner (home-search.js observes #hsMore; the spinner shows only while a
   batch is loading via the .loading class) ---- */
.hs-more{display:flex;align-items:center;justify-content:center;min-height:34px;padding:8px 0}
.hs-more-spin{display:none;width:22px;height:22px;border-radius:50%;border:2.5px solid var(--border);border-top-color:var(--brand);animation:hs-spin .7s linear infinite}
.hs-more.loading .hs-more-spin{display:inline-block}
@keyframes hs-spin{to{transform:rotate(360deg)}}

/* ---- category search-attribute filters (populated by home-search.js when a leaf category is chosen) ---- */
.hs-attrs-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
@media (max-width:520px){.hs-attrs-grid{grid-template-columns:1fr}}
.hs-attr-field{display:flex;flex-direction:column;gap:.25rem;min-width:0}
.hs-attr-field label{font-size:.72rem;color:var(--muted);font-weight:600}
/* spec 036 ت-٤ — a dependent field whose parent isn't chosen yet (Model before Make) has nothing to offer.
   Dimmed rather than hidden, so the poster can see the field exists and what unlocks it. */
.hs-attr-field.is-locked{opacity:.55}
.hs-attr-field.is-locked select{cursor:not-allowed}
.hs-attr-range{display:flex;align-items:center;gap:6px}
.hs-attr-range input{width:100%}

/* UX study ب-13 (2026-10-19): on a phone the 56px QR covered a large share of a small photo. It stays scannable at
   40px held close, and the click-to-enlarge view (home-search.js) is still there for scanning across a desk. */
@media (max-width:600px){
  .hs-rqr,
  .hs-rcard[data-type="shop"] .hs-rqr,
  .hs-rcard[data-type="question"] .hs-rqr{width:40px;height:40px;inset-block-start:8px;inset-inline-start:8px;border-radius:8px}
}
