/* Map search kiểu Airbnb — houseinhanoi.vn (15/11/2026). Điện thoại: map toàn màn hình + bảng kết quả kéo lên.
   Desktop (>= 900px): danh sách bên trái, map bên phải. */

:root {
	--hm-ink: #222;
	--hm-muted: #6a6a6a;
	--hm-line: #e4e4e4;
	--hm-soft: #f5f5f3;
	--hm-bg: #fff;
	--hm-accent: #c2a372;
	--hm-brand: #4d332c;      /* chip / lựa chọn đang bật, badge đếm, cụm marker, marker đang chọn */
	--hm-btn: #bb9b62;        /* nút hành động (Show N properties, Map, Retry…) */
	--hm-btn-hover: #a8884f;
	--hm-accent-ink: #7a5f2f;
	--hm-shadow: 0 6px 24px rgba(0, 0, 0, .16);
	--hm-radius: 14px;
	--hm-top-h: 116px;
	--hm-peek: 96px;
	--hm-font: Poppins, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "PingFang SC", "Malgun Gothic", sans-serif;
}

/* Trang giữ header / footer của site; app nằm ngay dưới header, cao = phần màn hình còn lại (JS tính). */
.hm-scope { font-family: var(--hm-font); color: var(--hm-ink); -webkit-font-smoothing: antialiased; line-height: 1.4; }
.hm-scope *, .hm-scope *::before, .hm-scope *::after { box-sizing: border-box; }
:where(.hm-scope) button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; text-transform: none; letter-spacing: normal; }
.hm-scope [hidden] { display: none !important; }
.hm-scope svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.hm-scope :focus-visible { outline: 2px solid var(--hm-ink); outline-offset: 2px; }
/* Chặn CSS chung của theme (tiêu đề, ô nhập, select) */
#hm-app h1, #hm-app h2, #hm-app h3, #hm-modal h2, #hm-modal h3 { font-family: var(--hm-font); color: var(--hm-ink); letter-spacing: normal; text-transform: none; margin: 0; padding: 0; }
#hm-app input, #hm-modal input, #hm-modal select { box-shadow: none; margin: 0; min-height: 0; line-height: normal; }
#hm-app a, #hm-app a:hover { color: inherit; text-decoration: none; }
/* Trang map: chỉ giữ header, không có footer (map + danh sách lấp hết phần còn lại, trang không cuộn). */
body.hm-body .wpestate_elementor_footer_custom, body.hm-body .backtop, body.hm-body .prop-compare { display: none !important; }
body.hm-body { overflow: hidden; overscroll-behavior: none; }

.hm-app { position: relative; height: calc(100vh - 140px); overflow: hidden; isolation: isolate; background: var(--hm-bg); }

/* ---------- Thanh trên ---------- */
.hm-top { position: absolute; top: 0; left: 0; right: 0; z-index: 30; background: var(--hm-bg); padding: 10px 12px 8px; border-bottom: 1px solid var(--hm-line); }
.hm-top__row { display: flex; align-items: center; gap: 8px; }
.hm-logo { display: none; flex: none; text-decoration: none; color: var(--hm-ink); font-weight: 600; }
.hm-logo img { display: block; height: 36px; width: auto; }
.hm-search { margin: 0; flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 16px; border-radius: 999px; background: var(--hm-bg); box-shadow: 0 2px 10px rgba(0, 0, 0, .12); border: 1px solid var(--hm-line); }
.hm-search svg { color: var(--hm-ink); width: 18px; height: 18px; }
.hm-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; color: var(--hm-ink); padding: 0; }
.hm-search input::placeholder { color: var(--hm-muted); }
.hm-search input::-webkit-search-cancel-button { cursor: pointer; }
.hm-filter-btn { position: relative; flex: none; display: inline-flex; align-items: center; gap: 6px; height: 46px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--hm-line); background: var(--hm-bg); font-size: 14px; font-weight: 500; }
.hm-filter-btn__label { display: none; }
/* Nhắc nút Filters sau khi tải (JS thêm .is-nudge mỗi lần tải trang) */
.hm-filter-btn { transition: border-color .3s, background-color .3s; }
/* Viền dày vẽ bằng box-shadow inset → kích thước nút không đổi (không giật bố cục). */
#hm-app .hm-filter-btn.is-nudge { border-color: var(--hm-btn); background: #f7f0e3; box-shadow: inset 0 0 0 1px var(--hm-btn); animation: hm-nudge 1.3s ease-out 3; }
@keyframes hm-nudge {
	0% { box-shadow: inset 0 0 0 1px #bb9b62, 0 0 0 0 rgba(187, 155, 98, .85); transform: scale(1); }
	15% { transform: scale(1.08); }
	30% { transform: scale(1); }
	70% { box-shadow: inset 0 0 0 1px #bb9b62, 0 0 0 14px rgba(187, 155, 98, 0); }
	100% { box-shadow: inset 0 0 0 1px #bb9b62, 0 0 0 0 rgba(187, 155, 98, 0); transform: scale(1); }
}
.hm-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--hm-brand); color: #fff; font-size: 11px; font-weight: 600; line-height: 20px; text-align: center; }

.hm-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 10px -12px 0; padding: 0 12px 2px; }
.hm-chips::-webkit-scrollbar { display: none; }
.hm-chip { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--hm-line); background: var(--hm-bg); font-size: 14px; white-space: nowrap; transition: background .15s, border-color .15s; }
.hm-chip:hover { border-color: var(--hm-brand); }
.hm-chip.is-on { background: var(--hm-brand); border-color: var(--hm-brand); color: #fff; }
.hm-chip-sep { flex: none; width: 1px; margin: 6px 2px; background: var(--hm-line); }

/* ---------- Map ---------- */
.hm-map-wrap { position: absolute; left: 0; right: 0; bottom: 0; top: var(--hm-top-h); z-index: 1; background: #eef0ea; }
.hm-map { position: absolute; inset: 0; }
.hm-map-msg { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 5; max-width: calc(100% - 24px); padding: 10px 16px; border-radius: 999px; background: var(--hm-bg); box-shadow: var(--hm-shadow); font-size: 13px; text-align: center; }
.hm-map-msg button { margin-left: 6px; border: 0; background: none; font-weight: 600; text-decoration: underline; padding: 0; }
.maplibregl-ctrl-attrib { font-size: 10px; }

/* Marker giá */
.hm-pin { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border: 0; border-radius: 999px; background: var(--hm-bg); color: var(--hm-ink); box-shadow: 0 0 0 1px rgba(0, 0, 0, .08), 0 2px 6px rgba(0, 0, 0, .22); font: 600 13px/1 var(--hm-font); white-space: nowrap; transition: transform .12s ease, background .12s, color .12s; }
.hm-pin:hover, .hm-pin.is-hover { transform: scale(1.08); z-index: 3; }
.hm-pin.is-active { background: var(--hm-brand); color: #fff; z-index: 4; transform: scale(1.08); }
.hm-pin.is-seen:not(.is-active) { background: #f1f1f1; }
.hm-pin__t { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.hm-pin.is-project .hm-pin__t { max-width: 170px; } /* tên dự án dài hơn giá */
.hm-pin__n { margin-left: 6px; padding: 2px 6px; border-radius: 999px; background: var(--hm-brand); color: #fff; font-size: 11px; line-height: 1; }
.hm-pin.is-active .hm-pin__n { background: #fff; color: var(--hm-brand); }
.hm-cluster { display: grid; place-items: center; width: 38px; height: 38px; border: 3px solid rgba(255, 255, 255, .9); border-radius: 50%; background: var(--hm-brand); color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); font: 600 13px/1 var(--hm-font); transition: transform .12s; }
.hm-cluster:hover { transform: scale(1.1); }
.hm-cluster.is-m { width: 46px; height: 46px; font-size: 14px; }
.hm-cluster.is-l { width: 56px; height: 56px; font-size: 15px; }

/* ---------- Kết quả (bảng kéo trên điện thoại) ---------- */
.hm-results { position: absolute; left: 0; right: 0; bottom: 0; top: var(--hm-top-h); z-index: 20; display: flex; flex-direction: column; background: var(--hm-bg); border-radius: 18px 18px 0 0; box-shadow: 0 -4px 20px rgba(0, 0, 0, .14); transform: translate3d(0, var(--hm-sheet-y, 70%), 0); will-change: transform; touch-action: none; }
.hm-results.is-anim { transition: transform .32s cubic-bezier(.2, .8, .2, 1); }
.hm-sheet__grab { flex: none; display: flex; justify-content: center; padding: 10px 0 4px; cursor: grab; }
.hm-sheet__grab span { width: 40px; height: 5px; border-radius: 3px; background: #cfcfcf; }
.hm-results__head { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 2px 16px 14px; }
.hm-count { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.35; text-align: center; }
.hm-link { border: 0; background: none; padding: 2px 0; font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.hm-results__scroll { flex: 1; min-height: 0; overflow: hidden; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.hm-results[data-snap="full"] .hm-results__scroll { overflow-y: auto; touch-action: pan-y; }
.hm-sentinel { height: 1px; }

.hm-grid { display: grid; grid-template-columns: 1fr; gap: 26px; }
@media (min-width: 560px) and (max-width: 899px) { .hm-grid { grid-template-columns: 1fr 1fr; gap: 22px 16px; } }

/* Thẻ tin */
.hm-card { position: relative; display: block; color: inherit; text-decoration: none; border-radius: var(--hm-radius); }
.hm-card__img { position: relative; aspect-ratio: 525 / 328; border-radius: var(--hm-radius); overflow: hidden; background: var(--hm-soft); }
.hm-card__img img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.hm-card:hover .hm-card__img img { transform: scale(1.03); }
.hm-tag { position: absolute; top: 10px; left: 10px; padding: 4px 9px; border-radius: 999px; background: rgba(255, 255, 255, .95); color: var(--hm-ink); font-size: 12px; font-weight: 600; box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.hm-tag.is-off { background: rgba(34, 34, 34, .85); color: #fff; }
.hm-tag.is-feat { color: var(--hm-accent-ink); }
.hm-card__body { padding: 10px 2px 0; }
.hm-card__title { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hm-card__meta { margin-top: 3px; font-size: 13.5px; color: var(--hm-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-card__price { margin-top: 5px; font-size: 15px; }
.hm-card__hot { margin-top: 3px; font-size: 13px; font-weight: 600; color: var(--hm-brand); }
.hm-card__price b { font-weight: 600; }
.hm-card__price span { color: var(--hm-muted); }
.hm-card.is-hover .hm-card__img { box-shadow: 0 0 0 2px var(--hm-ink); }

.hm-skel .hm-card__img, .hm-skel .hm-line { background: linear-gradient(90deg, #f0f0f0 25%, #e6e6e6 37%, #f0f0f0 63%); background-size: 400% 100%; animation: hm-sh 1.3s ease infinite; }
.hm-skel .hm-line { height: 13px; border-radius: 6px; margin-top: 9px; }
@keyframes hm-sh { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.hm-empty { padding: 28px 8px; text-align: center; color: var(--hm-muted); font-size: 14px; }
.hm-empty strong { display: block; margin-bottom: 12px; color: var(--hm-ink); font-size: 16px; }
.hm-more { display: block; margin: 24px auto 0; }

/* Nút Map / List nổi */
.hm-toggle { position: absolute; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 26; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--hm-btn); color: #fff !important; font-size: 14px; font-weight: 600; box-shadow: 0 4px 16px rgba(0, 0, 0, .3); }
.hm-toggle:hover { background: var(--hm-btn-hover); }
.hm-toggle svg { width: 18px; height: 18px; }

/* Thẻ xem nhanh khi bấm marker */
.hm-preview { position: absolute; left: 12px; right: 12px; bottom: calc(var(--hm-peek) + 12px); z-index: 22; }
.hm-preview .hm-pcard { position: relative; display: flex; overflow: hidden; border-radius: var(--hm-radius); background: var(--hm-bg); box-shadow: var(--hm-shadow); color: inherit; text-decoration: none; animation: hm-up .22s ease; }
@keyframes hm-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.hm-pcard__img { flex: none; width: 38%; min-height: 118px; background: var(--hm-soft); }
.hm-pcard__img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hm-pcard__body { flex: 1; min-width: 0; padding: 12px 40px 12px 12px; }
.hm-pcard .hm-card__title { font-size: 14px; }
.hm-pcard .hm-card__meta { font-size: 13px; }
.hm-pcard .hm-card__price { font-size: 14px; }
.hm-icon-btn { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: var(--hm-bg); }
.hm-icon-btn svg { width: 16px; height: 16px; }
.hm-icon-btn:hover { background: var(--hm-soft); }
.hm-pcard__close { position: absolute; top: 6px; right: 6px; z-index: 2; }

/* ---------- Bộ lọc ---------- */
.hm-modal { position: fixed; inset: 0; z-index: 100001; } /* trên header sticky + admin bar */
.hm-modal__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); animation: hm-fade .2s ease; }
@keyframes hm-fade { from { opacity: 0; } }
.hm-modal__panel { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--hm-bg); animation: hm-up .25s ease; padding-top: env(safe-area-inset-top); }
.hm-modal__head { flex: none; display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; height: 56px; padding: 0 12px; border-bottom: 1px solid var(--hm-line); }
.hm-modal__head h2 { margin: 0; text-align: center; font-size: 16px; font-weight: 600; }
.hm-modal__body { flex: 1; overflow-y: auto; padding: 4px 20px 24px; overscroll-behavior: contain; }
.hm-modal__foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--hm-line); }
.hm-primary { height: 48px; padding: 0 24px; border: 0; border-radius: 10px; background: var(--hm-btn); color: #fff !important; font-size: 15px; font-weight: 600; transition: background .15s; }
.hm-primary:hover:not(:disabled) { background: var(--hm-btn-hover); }
.hm-primary:disabled { opacity: .5; cursor: default; }
.hm-sec { padding: 26px 0; border-bottom: 1px solid var(--hm-line); }
.hm-sec:last-child { border-bottom: 0; }
/* #hm-modal: thắng quy tắc reset margin ở đầu file (trước đây tiêu đề dính sát nút bên dưới) */
#hm-modal .hm-sec h3 { margin: 0 0 18px; font-size: 17px; font-weight: 600; line-height: 1.3; }
.hm-opts { display: flex; flex-wrap: wrap; gap: 10px 8px; }
.hm-seg { display: flex; border: 1px solid var(--hm-line); border-radius: 12px; overflow: hidden; }
.hm-seg button { flex: 1; height: 44px; border: 0; border-right: 1px solid var(--hm-line); background: var(--hm-bg); font-size: 14px; }
.hm-seg button:last-child { border-right: 0; }
.hm-seg--sub { margin-top: 10px; }
.hm-por { padding: 20px 0 8px; text-align: center; font-size: 14px; color: var(--hm-muted); }
.hm-por .hm-link { color: var(--hm-ink); }
.hm-seg button.is-on { background: var(--hm-brand); color: #fff; }
.hm-range { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.hm-range label { flex: 1; display: block; padding: 8px 12px; border: 1px solid #b0b0b0; border-radius: 10px; font-size: 12px; color: var(--hm-muted); }
.hm-range input { display: block; width: 100%; border: 0; outline: 0; padding: 2px 0 0; font: inherit; font-size: 16px; color: var(--hm-ink); background: transparent; }
.hm-range span { color: var(--hm-muted); }
.hm-field { display: block; margin-bottom: 18px; }
.hm-field:last-child { margin-bottom: 0; }
.hm-field > span { display: block; margin-bottom: 8px; font-size: 13px; color: var(--hm-muted); }
.hm-select { width: 100%; height: 48px; padding: 0 12px; border: 1px solid #b0b0b0; border-radius: 10px; background: var(--hm-bg); font: inherit; font-size: 16px; color: var(--hm-ink); }
.hm-switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 15px; cursor: pointer; }
.hm-switch input { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 48px; height: 30px; margin: 0; border-radius: 999px; background: #b0b0b0; cursor: pointer; transition: background .15s; }
.hm-switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; }
.hm-switch input:checked { background: var(--hm-brand); }
.hm-switch input:checked::after { transform: translateX(18px); }

/* ---------- Desktop ---------- */
@media (min-width: 900px) {
	:root { --hm-top-h: 0px; }
	.hm-app { display: grid; grid-template-rows: auto minmax(0, 1fr); border-top: 1px solid var(--hm-line); }
	.hm-top { position: relative; padding: 12px 24px; }
	.hm-top__row { gap: 16px; }
	.hm-search { max-width: 560px; }
	.hm-filter-btn__label { display: inline; }
	.hm-chips { margin: 12px -24px 0; padding: 0 24px 2px; }
	.hm-main { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 42%); grid-template-rows: minmax(0, 1fr); min-height: 0; overflow: hidden; }
	.hm-results { position: relative; top: auto; min-height: 0; height: 100%; transform: none !important; border-radius: 0; box-shadow: none; touch-action: auto; z-index: 2; }
	.hm-sheet__grab { display: none; }
	.hm-results__head { align-items: flex-start; padding: 20px 24px 14px; }
	.hm-count { text-align: left; font-size: 16px; }
	.hm-results__scroll, .hm-results[data-snap] .hm-results__scroll { overflow-y: auto; padding: 0 24px 40px; touch-action: auto; }
	.hm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 20px; }
	.hm-map-wrap { position: relative; inset: auto; min-height: 0; height: 100%; }
	.hm-toggle { display: none !important; }
	.hm-preview { left: 50%; right: auto; bottom: 24px; width: 380px; transform: translateX(-50%); }
	.hm-modal__panel { inset: auto; top: 50%; left: 50%; width: min(620px, calc(100vw - 48px)); max-height: min(820px, calc(100vh - 64px)); transform: translate(-50%, -50%); border-radius: 16px; padding-top: 0; box-shadow: var(--hm-shadow); animation: hm-fade .2s ease; }
}
@media (min-width: 1500px) {
	.hm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
	.hm-app *, .hm-app *::before, .hm-app *::after { animation: none !important; transition: none !important; }
}
