/* =====================================================================
   THẺ DỰ ÁN CẠNH BẢN ĐỒ (trang chủ) - ảnh + trạng thái, tên, khu vực, giá,
   m²/PN và nút Xem dự án / Gọi / Zalo / Lưu. Tiền tố "msc-" riêng, không đụng style.css.
   Máy tính/máy tính bảng ngang (>900px): cột danh sách bên trái bản đồ, tự cuộn.
   Điện thoại (<=900px): dải thẻ vuốt ngang ngay dưới bản đồ.
   ===================================================================== */
@media (min-width: 901px) {
    .map-widget-body { grid-template-columns: 340px 1fr; }
    .map-widget-body.has-spotlight { grid-template-columns: 340px 1fr 240px; }
}
@media (min-width: 901px) and (max-width: 1200px) {
    .map-widget-body { grid-template-columns: 300px 1fr; }
    .map-widget-body.has-spotlight { grid-template-columns: 300px 1fr; }
    .map-widget-body.has-spotlight .sq-panel { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}

.msc-list { max-height: 560px; overflow-y: auto; padding: 10px !important; background: #f4f6f9 !important; overscroll-behavior: contain; }
.msc-list > * { margin-bottom: 10px; }
.msc-list .map-side-list-header { background: #fff; border-radius: 10px; padding: 9px 12px; border: 1px solid #e3e7ed; position: sticky; top: -10px; z-index: 2; }

.msc-card { position: relative; display: grid !important; grid-template-columns: 96px 1fr; gap: 10px; align-items: start !important;
    background: #fff !important; border: 1.5px solid #e3e7ed; border-radius: 12px !important; padding: 8px !important;
    cursor: pointer; transition: border-color .15s, box-shadow .15s; color: #14233b; }
.msc-card:hover { box-shadow: 0 6px 18px rgba(15,23,42,.08); background: #fff !important; }
.msc-card.is-active, .msc-card.tour-sync-highlight { border-color: #c9a227; box-shadow: 0 0 0 3px rgba(201,162,39,.18) !important; background: #fffdf6 !important; }

.msc-img { position: relative; display: block; border-radius: 9px; overflow: hidden; aspect-ratio: 1 / 1; background: linear-gradient(135deg, #1e3a5f, #12233d); }
.msc-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; color: transparent; font-size: 0; }
.msc-st { white-space: nowrap; position: absolute; left: 5px; top: 5px; background: rgba(18,35,61,.88); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 6px; line-height: 1.4; }
.msc-st-dang_mo_ban { background: rgba(21,128,61,.92); }
.msc-st-sap_mo_ban { background: rgba(202,138,4,.95); }
.msc-st-da_ban_giao { background: rgba(37,99,235,.92); }
.msc-st-ngung_ban { background: rgba(75,85,99,.92); }
.msc-ad { position: absolute; left: 5px; bottom: 5px; background: linear-gradient(135deg, #e0b93a, #a9782c); color: #1a1306; font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 6px; }

.msc-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.msc-name { font-weight: 800; font-size: 14.5px; color: #14233b !important; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msc-name:hover { color: #a9782c !important; }
.msc-loc { font-size: 12px; color: #5d6b7e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msc-price { font-size: 14px; font-weight: 800; color: #c2410c; }
.msc-price small { font-weight: 600; color: #5d6b7e; font-size: 11.5px; }
.msc-price.na { color: #5d6b7e; font-weight: 600; font-size: 12.5px; }
.msc-meta { display: flex; gap: 10px; font-size: 12px; color: #14233b; flex-wrap: wrap; }

.msc-act { display: flex; gap: 6px; padding-top: 5px; align-items: center; }
.msc-main { flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 10px; border-radius: 8px;
    background: #12233d; color: #fff !important; font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.msc-main:hover { background: #1e3a5f; }
.msc-ic { flex: 0 0 auto; display: inline-grid; place-items: center; min-width: 36px; height: 34px; min-height: 0 !important; padding: 0 8px; border-radius: 8px;
    border: 1px solid #e3e7ed; background: #fff; color: #14233b !important; text-decoration: none; font-size: 12.5px; font-weight: 700; cursor: pointer; line-height: 1; }
.msc-call { color: #15803d !important; border-color: #bbe5c8; }
.msc-call:hover { background: #f0fdf4; }
.msc-zalo { color: #0068ff !important; border-color: #c7dcff; }
.msc-zalo:hover { background: #eff6ff; }
.msc-fav { position: absolute; left: 70px; top: 70px; width: 30px; height: 30px; min-height: 0 !important; padding: 0; border-radius: 50%; border: 0;
    background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25); font-size: 14px; line-height: 1; cursor: pointer; display: grid; place-items: center; z-index: 2; }
.msc-fav:hover { transform: scale(1.08); }
.sq-dot { min-height: 0 !important; } /* chấm chuyển trang bị quy tắc chung button{min-height:44px} kéo thành vệt dài */

.msc-all { display: block; text-align: center; font-weight: 700; font-size: 13px; color: #a9782c; text-decoration: none; padding: 10px; background: #fff; border-radius: 10px; border: 1px dashed #d8c27a; }

/* Máy tính bảng ngang: cột hẹp hơn -> ảnh nhỏ hơn */
@media (min-width: 901px) and (max-width: 1200px) {
    .msc-card { grid-template-columns: 78px 1fr; }
    .msc-ic { min-width: 32px; padding: 0 6px; }
    .msc-fav { left: 56px; top: 56px; width: 28px; height: 28px; font-size: 13px; }
    .msc-st { font-size: 9px; padding: 2px 4px; }
}

/* Điện thoại / máy tính bảng dọc: dải thẻ vuốt ngang dưới bản đồ */
@media (max-width: 900px) {
    .quick-links-panel.msc-list { display: flex; flex-direction: row; gap: 10px; overflow-x: auto; overflow-y: hidden; max-height: none;
        scroll-snap-type: x mandatory; padding: 4px 2px 10px !important; background: transparent !important; border: 0; box-shadow: none; order: 2; }
    .msc-list > * { margin-bottom: 0; }
    .msc-list .map-side-list-header { display: none; }
    .msc-card { flex: 0 0 min(320px, 86vw); scroll-snap-align: start; grid-template-columns: 92px 1fr; }
    .msc-fav { left: 66px; top: 66px; }
    .msc-all { flex: 0 0 160px; display: flex; align-items: center; justify-content: center; scroll-snap-align: start; }
    .map-widget-body > .map-widget-frame { order: 1; }
    .map-widget-body > .sq-panel { order: 3; }
}

/* =====================================================================
   THANH TÌM KIẾM + BỘ LỌC THỐNG NHẤT trên bản đồ (tiền tố "mf-")
   ===================================================================== */
.mf-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: #fff; border: 1px solid #e3e7ed; border-radius: 14px; padding: 8px; box-shadow: 0 4px 14px rgba(15,23,42,.05); position: relative; z-index: 1001; margin: 10px 0 0; }
.mf-search { position: relative; flex: 1 1 260px; display: flex; align-items: center; gap: 8px; background: #f4f6f9; border-radius: 10px; padding: 0 12px; color: #5d6b7e; min-height: 42px; }
.mf-search input { flex: 1; border: 0 !important; background: transparent !important; box-shadow: none !important; font-size: 15px; color: #14233b; padding: 10px 0; outline: none; min-width: 0; min-height: 0; }
.mf-search .search-suggest-box { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 1002; }
.mf-seg { display: inline-flex; background: #f4f6f9; border-radius: 10px; padding: 3px; }
.mf-seg button { border: 0; background: transparent; padding: 9px 16px; border-radius: 8px; font-weight: 700; font-size: 14px; color: #5d6b7e; cursor: pointer; min-height: 36px; box-shadow: none; }
.mf-seg button.on { background: #12233d; color: #fff; box-shadow: 0 2px 6px rgba(18,35,61,.25); }
.mf-bar select, .mf-more { appearance: none; -webkit-appearance: none; border: 1px solid #e3e7ed; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235d6b7e' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
    padding: 10px 30px 10px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; color: #14233b; cursor: pointer; min-height: 42px; max-width: 240px; width: auto; margin: 0; }
.mf-bar select.is-set, .mf-more.is-set { border-color: #12233d; background-color: #eef3fa; }
.mf-more { background-image: none; padding-right: 12px; display: inline-flex; align-items: center; gap: 6px; }
.mf-badge[hidden] { display: none; }
.mf-badge { background: #12233d; color: #fff; border-radius: 99px; font-size: 11px; min-width: 18px; height: 18px; display: inline-grid; place-items: center; padding: 0 5px; }
.mf-more-wrap { position: relative; }
.mf-more-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 280px; background: #fff; border: 1px solid #e3e7ed; border-radius: 12px; padding: 12px; box-shadow: 0 16px 40px rgba(15,23,42,.14); display: grid; gap: 10px; z-index: 1003; }
.mf-more-panel[hidden] { display: none; }
.mf-more-panel label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 700; color: #5d6b7e; }
.mf-more-panel select { max-width: none; width: 100%; }
.mf-note { font-size: 12px; color: #5d6b7e; margin: 0; line-height: 1.45; font-weight: 400; }

.mf-summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 2px 8px; min-height: 44px; }
.mf-summary strong { font-size: 15px; color: #14233b; }
.mf-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.mf-chip { display: inline-flex; align-items: center; gap: 6px; background: #eef3fa; border: 1px solid #d5e0ef; color: #1e3a5f; font-size: 12.5px; font-weight: 600; border-radius: 99px; padding: 5px 6px 5px 11px; }
.mf-chip button { border: 0; background: rgba(18,35,61,.1); width: 20px; height: 20px; min-width: 0; min-height: 0; padding: 0; margin: 0; border-radius: 50%; cursor: pointer; font-size: 14px; line-height: 20px; color: #12233d; box-shadow: none; }
.mf-clear[hidden] { display: none; }
.mf-clear { min-height: 0; box-shadow: none; border: 0; background: none; color: #b42318; font-weight: 700; font-size: 13px; cursor: pointer; padding: 6px 4px; }

.msc-empty { text-align: center; color: #5d6b7e; padding: 26px 14px; font-size: 13.5px; border: 1px dashed #e3e7ed; border-radius: 12px; background: #fff; }
.msc-empty b { display: block; color: #14233b; font-size: 15px; margin-bottom: 6px; }
.msc-empty button { margin-top: 10px; border: 1px solid #12233d; background: #fff; color: #12233d; font-weight: 700; padding: 8px 14px; border-radius: 9px; cursor: pointer; min-height: 0; }
button.msc-all { width: 100%; cursor: pointer; min-height: 0; }

@media (max-width: 767px) {
    .mf-bar { gap: 6px; padding: 6px; }
    .mf-search { flex: 1 1 100%; }
    .mf-seg { flex: 0 0 auto; }
    .mf-bar select, .mf-more { flex: 1 1 28%; max-width: none; font-size: 13px; padding-left: 10px; padding-right: 22px; background-position: right 8px center; min-width: 0; }
    .mf-bar #mfArea { flex: 1 1 45%; }
    .mf-bar #mfPrice { flex: 1 1 26%; } .mf-bar #mfBed { flex: 1 1 34%; }
    .mf-more { padding-right: 10px; }
    .mf-more-wrap { position: static; flex: 1 1 28%; }
    .mf-more-wrap .mf-more { width: 100%; justify-content: center; }
    .mf-more-panel { position: fixed; left: 10px; right: 10px; top: auto; bottom: 74px; width: auto; }
    .msc-empty { flex: 0 0 86vw; }
    button.msc-all { width: auto; }
}

/* =====================================================================
   TRỢ LÝ AI (video cô gái) NỔI Ở GÓC DƯỚI-PHẢI MÀN HÌNH - không nằm trong bản đồ nữa
   ===================================================================== */
.ai-float { position: fixed; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 1040; transition: opacity .25s; }
.ai-float.is-hidden, body.chat-open .ai-float { opacity: 0; pointer-events: none; visibility: hidden; }
.ai-float .map-ai-agent.ai-float-btn { position: relative; z-index: 1; right: auto; bottom: auto; left: auto; top: auto; transition: none; min-height: 0; touch-action: none; }
.ai-float .map-ai-agent-img { height: 150px; }
.ai-float-close { position: absolute; top: -10px; right: -6px; z-index: 3; width: 22px; height: 22px; min-height: 0 !important; padding: 0; border-radius: 50%;
    border: 1px solid #e3e7ed; background: #fff; color: #5d6b7e; font-size: 14px; line-height: 20px; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.ai-float-close:hover { color: #b42318; }
@media (max-width: 900px) {
    /* nằm trên thanh điều hướng dưới cùng của điện thoại */
    .ai-float { right: 8px; bottom: calc(72px + env(safe-area-inset-bottom)); }
    .ai-float .map-ai-agent-img { height: 104px; }
    .ai-float .map-ai-agent-bubble { font-size: 11px; padding: 4px 8px; }
}
