/* hm-marketplace SEARCH HUB ([hm_properties]). Scoped under .hmsearch (inside .hmul, which sets
   --primary/--primary-dark + the Cairo font). Reuses the .hmul card/grid/modal stack; adds the
   filter bar, chips, toolbar, skeletons, empty state and the mobile filter drawer. Logical props
   (inset-inline/margin-inline/padding-inline) keep AR-RTL + EN-LTR correct from one ruleset. */

.hmsearch{--hms-line:#e6ddc4;--hms-ink:#1f2430;--hms-mut:#6b7280;--hms-soft:rgba(183,143,1,.08);max-width:1200px}

/* ---- filter form shell ---- */
.hmsearch-form{background:#fff;border:1px solid var(--hms-line);border-radius:18px;padding:14px 16px 16px;box-shadow:0 2px 14px rgba(31,36,48,.05);position:sticky;top:8px;z-index:20}
@supports not (position:sticky){.hmsearch-form{position:static}}

/* purpose segmented toggle */
.hmsearch-purpose{display:inline-flex;background:#f4efe1;border:1px solid var(--hms-line);border-radius:999px;padding:4px;gap:2px;margin-bottom:12px;max-width:100%;overflow:auto}
.hmsearch-seg{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:8px 20px;border-radius:999px;font-weight:800;font-size:.9rem;color:var(--hms-mut);cursor:pointer;white-space:nowrap;transition:.18s;user-select:none}
.hmsearch-seg input{position:absolute;opacity:0;width:0;height:0;pointer-events:none}
.hmsearch-seg.is-active{background:var(--primary);color:var(--on-primary,#1b1b1b);box-shadow:0 1px 5px rgba(143,115,1,.35)}
.hmsearch-seg:not(.is-active):hover{color:var(--primary-dark)}

/* primary field row */
.hmsearch-bar{display:flex;flex-wrap:wrap;gap:10px 12px;align-items:end}
.hmsearch-field{display:flex;flex-direction:column;gap:5px;flex:1 1 150px;min-width:0}
.hmsearch-field>span{font-size:.72rem;font-weight:800;letter-spacing:.02em;text-transform:uppercase;color:var(--hms-mut)}
.hmsearch-field.hmsearch-price{flex:1 1 220px}
.hmsearch-field.hmsearch-sort{flex:1 1 170px}
.hmsearch-price-row{display:flex;gap:8px}
.hmsearch-price-row input{flex:1;min-width:0}

/* controls (reset the theme's input chrome inside the hub) */
/* Scoped to .hmsearch-form (the legacy fallback filter form) — NOT bare .hmsearch — so this input styling
   does NOT bleed onto the home bar's inputs/selects (which live in .hmhome-form inside .hmsearch). */
.hmsearch-form select,.hmsearch-form input[type=number],.hmsearch-form input[type=text]{font:inherit;font-size:.92rem;width:100%;padding:10px 12px;border:1.5px solid var(--hms-line);border-radius:11px;background:#fff;color:var(--hms-ink);appearance:none;-webkit-appearance:none;line-height:1.2;height:42px;transition:border-color .15s,box-shadow .15s}
.hmsearch-form select{background-image:url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238f7301' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center;padding-inline-end:32px}
/* RTL: move only the chevron to the physical left — the base padding-inline-end:32px already
   resolves to the left side in RTL, keeping label clearance correct. */
.hmsearch[dir=rtl] select{background-position:left 12px center}
.hmsearch-form select:focus,.hmsearch-form input:focus{outline:0;border-color:var(--primary);box-shadow:0 0 0 3px var(--hms-soft)}
.hmsearch-form input[type=number]::-webkit-outer-spin-button,.hmsearch-form input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}

/* more-filters drawer */
.hmsearch-more-filters{margin-top:12px;border-top:1px dashed var(--hms-line);padding-top:10px}
.hmsearch-more-filters>summary{list-style:none;cursor:pointer;font-weight:800;font-size:.85rem;color:var(--primary-dark);display:inline-flex;align-items:center;gap:6px;padding:4px 0}
.hmsearch-more-filters>summary::-webkit-details-marker{display:none}
.hmsearch-more-filters>summary::before{content:"+";font-size:1.05rem;line-height:1}
.hmsearch-more-filters[open]>summary::before{content:"–"}
.hmsearch-drawer{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px 12px;padding-top:10px}
/* furnishing/period only relevant for rent; installments/delivery only for sale — JS toggles [data-purpose] */
.hmsearch-form:not([data-purpose=rent]) .hmsearch-rentonly{display:none}
.hmsearch-form:not([data-purpose=sale]) .hmsearch-saleonly{display:none}

.hmsearch-apply{margin-top:12px}
.hmsearch-apply .hmul-btn{width:100%}

/* ---- applied-filter chips ---- */
.hmsearch-chips{display:flex;flex-wrap:wrap;gap:8px;margin:14px 2px 2px;min-height:0}
.hmsearch-chips:empty{display:none}
.hmsearch-chip{display:inline-flex;align-items:center;gap:6px;background:var(--hms-soft);border:1px solid var(--primary);color:var(--primary-dark);font-weight:700;font-size:.82rem;border-radius:999px;padding:5px 12px;cursor:pointer;transition:.15s}
.hmsearch-chip:hover{background:var(--primary);color:var(--on-primary,#1b1b1b)}
.hmsearch-chip span{font-size:1.05em;line-height:1;opacity:.8}
.hmsearch-chip.hmsearch-clear{background:transparent;border-style:dashed;color:var(--hms-mut);border-color:var(--hms-line)}
.hmsearch-chip.hmsearch-clear:hover{color:#b91c1c;border-color:#b91c1c;background:#fff}

/* ---- results toolbar ---- */
.hmsearch-toolbar{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;margin:18px 2px 6px}
.hmsearch-count{font-weight:800;font-size:1.05rem;color:var(--hms-ink)}
.hmsearch-save-wrap{display:inline-flex}
.hmsearch-save{font-size:.88rem;padding:9px 16px;gap:7px}
.hmsearch-save .hmul-ico{width:16px;height:16px}
.hmsearch-save.is-saved{background:rgba(22,163,74,.10);border-color:#16a34a;color:#15803d}
/* Keep the green "Saved" identity on hover/focus — the .hmul de-pink hover (0,3,1) would otherwise flip it to gold. */
.hmul .hmsearch-save.is-saved:hover,.hmul .hmsearch-save.is-saved:focus{background:rgba(22,163,74,.16);border-color:#15803d;color:#15803d}
/* Keyboard focus: the theme zeroes a:focus outlines — the chips and ghost/empty-state links are <a>, so restore a
   visible focus ring on them (the <button> controls keep the UA ring; this is anchor-specific). */
.hmsearch-chip:focus-visible,.hmsearch a.hmul-btn:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
/* toolbar right group: sort + save */
.hmsearch-tools{display:inline-flex;align-items:center;gap:12px;flex-wrap:wrap}
.hmsearch-sort{display:inline-flex;align-items:center;gap:7px;margin:0}
.hmsearch-sort-lbl{font-size:.82rem;font-weight:800;color:var(--hms-mut)}
.hmsearch-sort-sel{appearance:none;-webkit-appearance:none;border:1.5px solid var(--hms-line);border-radius:10px;background:#fff;padding-block:8px;padding-inline:12px 30px;font:inherit;font-weight:700;font-size:.85rem;color:var(--hms-ink);cursor:pointer;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center;background-size:14px}
[dir=rtl] .hmsearch-sort-sel{background-position:left 10px center}
.hmsearch-sort-sel:focus{outline:0;border-color:var(--primary)}
.hmsearch-sort-go{font-size:.82rem;padding:8px 14px}

/* ---- grid ---- */
.hmsearch-grid{padding:14px 0 8px}
.hmsearch-grid:empty{padding:0}
@media(max-width:640px){.hmul-grid.hmsearch-grid{grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:12px}}

/* ============================================================================
 * Hub TWO-COLUMN layout: a VERTICAL filter rail + the results main column. The rail holds the SSOT search
 * bar, which reflows into a single stacked (vertical) column on its own via its container query (the rail
 * is narrow). The rail sits on the inline-END side — physical LEFT in RTL (where the theme contact form
 * used to be), mirrored to physical RIGHT in LTR. The hero spans full width above. Collapses to 1-col on
 * narrow viewports (rail on top). The results grid (auto-fill minmax) re-fits itself to the narrower column.
 * ========================================================================== */
.hmsearch-cols{display:grid;grid-template-columns:1fr var(--hms-rail,340px);gap:24px;align-items:start}
/* Sticky sidebar: the rail stays in view while the results scroll. top clears the 73px fixed site header
   (+ a small gap); align-self:start keeps the rail its own height (not stretched) so sticky can travel
   within the tall results row. Disabled in the stacked 1-col layout below. */
.hmsearch-railcol{grid-column:2;grid-row:1;min-width:0;position:sticky;top:var(--hms-stick,85px);align-self:start}   /* inline-end (physical-left in RTL) */
.hmsearch-maincol{grid-column:1;grid-row:1;min-width:0}    /* inline-start (results); grid-row:1 keeps both side-by-side (DOM is rail-first, so sparse auto-flow would otherwise drop main to row 2) */
.hmsearch-railcol .hmhome-onhub{max-width:none;margin:0}   /* fill the rail; the bar's container query stacks it vertically */
.hmsearch-maincol .hmsearch-grid{padding-top:6px}
/* mid-band: slim the rail so the results column never collapses to a single card squeezed beside a near-
   equal-width rail just above the 1-col fold (was a lopsided 861-880px band with a 340px rail). */
@media(min-width:901px) and (max-width:1100px){.hmsearch-cols{--hms-rail:300px}}
@media(max-width:900px){
	.hmsearch-cols{grid-template-columns:1fr;gap:14px}
	/* reset grid-row:auto so the two stack (rail row 1, results row 2) instead of overlapping in one cell */
	.hmsearch-railcol,.hmsearch-maincol{grid-column:1;grid-row:auto}
	.hmsearch-railcol{position:static}   /* stacked on top: don't stick (it would cover the results) */
}
/* a11y: the filter rail is DOM-first (so keyboard/SR users would otherwise tab through the whole bar before
   reaching listings). This skip link — visually hidden until focused — jumps straight to the results. */
.hmsearch-skip{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0;padding:0;margin:-1px}
.hmsearch-skip:focus{position:absolute;width:auto;height:auto;clip:auto;clip-path:none;margin:0;inset-inline-start:0;top:0;z-index:50;background:var(--primary,var(--primary,#B78F01));color:var(--on-primary,#1b1b1b);font-weight:800;padding:10px 16px;border-radius:0 0 10px 0;text-decoration:none;white-space:normal;box-shadow:0 4px 14px rgba(31,36,48,.25)}

/* /properties/ renders its OWN filter rail, so the theme's contact-form sidebar column is redundant HERE:
 * hide that column and let the column holding the hub span full width. Two guards keep this surgical:
 *   1. body.hmmkt-hub — added server-side ONLY on the /properties/ page (HM_MKT_Search::body_class, the
 *      exact mirror of body.hmmkt-dash). The structural :has() rules therefore NEVER evaluate on another
 *      template, even if the SSOT bar is ever embedded on a different page.
 *   2. The hide targets the contact form POSITIVELY — the column immediately ADJACENT to the hub column on
 *      either side — NOT "every non-hub column", so a 3rd / spacer column would survive.
 * Reversible: deleting the contact-form widget in Elementor later just makes the hide a no-op; the widen
 * keeps the now-only hub column full width, which is the desired end state. */
body.hmmkt-hub .elementor-container > .elementor-column:has(.hmsearch) + .elementor-column,
body.hmmkt-hub .elementor-container > .elementor-column:has(+ .elementor-column .hmsearch){display:none!important}
body.hmmkt-hub .elementor-container > .elementor-column:has(.hmsearch){width:100%!important;max-width:100%!important;flex:0 0 100%!important}

/* featured badge (on the reused card) */
.hmul-card-feat{position:absolute;inset-inline-start:10px;bottom:10px;z-index:2;display:inline-flex;align-items:center;gap:4px;background:linear-gradient(135deg,var(--primary),var(--primary-dark));color:var(--on-primary,#1b1b1b);font-size:.7rem;font-weight:800;border-radius:999px;padding:3px 9px;box-shadow:0 2px 6px rgba(143,115,1,.4)}
.hmul-card-feat svg{margin-block-start:-1px}
/* if a featured card also has purpose chips, lift the chips so they don't stack on the badge */
.hmul-card:has(.hmul-card-feat) .hmul-card-chips{inset-inline-start:auto;inset-inline-end:10px;bottom:10px}

/* ---- skeleton loading ---- */
.hmsearch-skeleton{display:grid;grid-template-columns:repeat(auto-fill,minmax(270px,1fr));gap:18px;padding:14px 0 8px}
.hmsearch-skel{height:300px;border-radius:16px;border:1px solid #ece6d6;background:linear-gradient(100deg,#f4f1ea 30%,#faf8f2 50%,#f4f1ea 70%);background-size:200% 100%;animation:hms-shim 1.2s ease-in-out infinite}
@keyframes hms-shim{0%{background-position:200% 0}100%{background-position:-200% 0}}
@media(prefers-reduced-motion:reduce){.hmsearch-skel{animation:none}}
.hmsearch.is-loading .hmsearch-grid{opacity:.45;pointer-events:none;transition:opacity .15s}

/* ---- empty state ---- */
.hmsearch-empty{text-align:center;padding:48px 20px;background:#fbf9f3;border:1px dashed var(--hms-line);border-radius:18px;margin:8px 0}
.hmsearch-empty-emoji{font-size:2.6rem;margin-bottom:8px}
.hmsearch-empty h3{margin:0 0 6px;font-size:1.2rem;color:var(--hms-ink)}
.hmsearch-empty p{color:var(--hms-mut);margin:0 0 16px}
.hmsearch-empty-actions{display:flex;gap:10px;justify-content:center;flex-wrap:wrap}

/* ---- load more ---- */
.hmsearch-more{display:flex;justify-content:center;padding:14px 0 6px}
.hmsearch-more .hmul-btn{min-width:200px}
.hmsearch-more .hmul-btn[disabled]{opacity:.6;cursor:default}

/* ---- mobile drawer (FALLBACK-ONLY) ----
   These .hmsearch-form / .hmsearch-mobile-trigger rules style the no-JS fallback filter form, which renders
   ONLY when HM_MKT_HomeBar is absent (the sc_hub else-branch). On the live hub the SSOT bar renders instead
   and reflows via its own container query, so this drawer never appears — kept solely as a safety net. */
/* !important: the theme styles bare <button> with display:inline-block, which would otherwise unhide
   these desktop-hidden controls. */
.hmsearch-mobile-trigger{display:none!important}
@media(max-width:768px){
  .hmsearch-form{position:fixed;inset:0;z-index:1000;border-radius:0;border:0;box-shadow:none;overflow:auto;padding:18px 16px 90px;transform:translateY(100%);transition:transform .28s ease;visibility:hidden}
  .hmsearch.is-drawer-open .hmsearch-form{transform:translateY(0);visibility:visible}
  .hmsearch.is-drawer-open{position:static}
  .hmsearch-form::before{content:attr(data-drawer-title);display:block;font-weight:800;font-size:1.15rem;margin-bottom:14px;color:var(--hms-ink)}
  .hmsearch-bar{flex-direction:column;align-items:stretch}
  .hmsearch-field{flex:1 1 auto}
  .hmsearch-drawer{grid-template-columns:1fr 1fr}
  .hmsearch-apply{position:sticky;bottom:0;background:#fff;padding:12px 0 4px;margin-top:18px}
  .hmsearch-apply,.hmsearch-form .hmsearch-apply{display:block!important}
  /* literal gold + !important: --primary-dark doesn't resolve in the .hmsearch scope and the theme
     paints bare buttons transparent/pink — both were silently winning here */
  .hmsearch-mobile-trigger{display:inline-flex!important;align-items:center;justify-content:center;gap:8px;position:fixed;inset-inline:16px;bottom:16px;z-index:900;background:var(--primary-dark,#8f7301)!important;color:#fff!important;border:0;border-radius:14px;padding:14px;font-weight:800;font-size:1rem;box-shadow:0 6px 20px rgba(31,36,48,.28);cursor:pointer;width:auto}
  .hmsearch.is-drawer-open .hmsearch-mobile-trigger{display:none}
  .hmsearch-form-close{display:inline-flex!important}
}
.hmsearch-form-close{display:none!important;position:absolute;inset-inline-end:14px;top:14px;width:36px;height:36px;border-radius:50%;border:1px solid var(--hms-line);background:#fff;font-size:1.2rem;line-height:1;align-items:center;justify-content:center;cursor:pointer;color:var(--hms-ink)!important}

/* ---- toast (save-search feedback) ---- */
.hmsearch-toast{position:fixed;inset-inline:0;bottom:24px;margin-inline:auto;width:max-content;max-width:90vw;z-index:2000;background:#1f2430;color:#fff;font-weight:700;font-size:.92rem;padding:12px 20px;border-radius:12px;box-shadow:0 8px 30px rgba(0,0,0,.25);opacity:0;transform:translateY(12px);transition:opacity .25s,transform .25s;pointer-events:none}
.hmsearch-toast.show{opacity:1;transform:translateY(0)}
.hmsearch-toast.ok{background:#15803d}
.hmsearch-toast.err{background:#b91c1c}
