
/* Hide floating map controls while mobile nav dropdown is open */
body.mobile-nav-open .z-map-controls,
body.mobile-nav-open .map-overlay-btns,
body.mobile-nav-open .map-legend {
    display: none !important;
}
:root{
    --navy: #0F2342;
    --navy-mid: #1A3660;
    --navy-light: #234580;
    --emerald: #059669;
    --emerald-light: #10B981;
    --emerald-pale: #ECFDF5;
    --amber: #D97706;
    --surface: #F8FAFC;
    --surface-2: #F1F5F9;
    --border: #E2E8F0;
    --border-strong: #CBD5E1;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --green: #16A34A;
    --green-bg: #F0FDF4;
    --green-border: #BBF7D0;
}

    /* Replace the existing zillow-popup close button rule */
.zillow-popup .leaflet-popup-close-button {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 24px !important;
    height: 24px !important;
    top: 6px !important;
    right: 6px !important;
    background: rgba(0,0,0,0.55) !important;
    color: #fff !important;
    border-radius: 50% !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    z-index: 10;
    transition: background 0.15s;
}
.zillow-popup .leaflet-popup-close-button:hover {
    background: var(--emerald) !important;
}
/* ══ PAGINATION ══ */
.pagination-bar {
    flex-shrink: 0; display: flex; align-items: center;
    justify-content: center; gap: 4px;
    padding: 10px 12px; border-top: 1px solid var(--border); background: #fff;
}
.pg-btn {
    min-width: 34px; height: 34px; padding: 0 6px;
    border: 1.5px solid var(--border); border-radius: 7px;
    background: #fff; font-size: 0.82rem; font-weight: 600;
    color: var(--text-secondary); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.pg-btn:hover:not(:disabled) { border-color: var(--navy); color: var(--navy); }
.pg-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.pg-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.pg-dots { font-size: 0.82rem; color: var(--text-muted); padding: 0 4px; line-height: 34px; }
    /* School marker on map */
.school-map-marker i {
    font-size: 13px;
    color: #fff;
    line-height: 1;
}
.school-map-marker {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--green);
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: transform 0.15s;
    font-size: 11px; font-weight: 800; color: #fff;
}
.school-map-marker:hover { transform: scale(1.25); }

/* School popup on map */
.school-map-popup .leaflet-popup-content-wrapper {
    padding: 0; border-radius: 10px; overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.school-map-popup .leaflet-popup-content {
    margin: 0; width: 220px !important;
}
.school-map-popup .leaflet-popup-tip { background: #fff; }
.school-popup-card { padding: 12px 14px; background: #fff; }
.school-popup-name {
    font-size: 13px; font-weight: 700; color: var(--text-primary);
    margin-bottom: 6px; line-height: 1.3;
}
.school-popup-meta {
    display: flex; align-items: center;
    justify-content: space-between; gap: 8px;
}
.school-popup-dist {
    font-size: 11px; font-weight: 700; color: var(--green);
    background: var(--green-bg); padding: 2px 8px;
    border-radius: 20px; border: 1px solid var(--green-border);
}
.school-popup-walk { font-size: 10px; color: var(--text-muted); }
    /* MAP LEGEND */
.map-legend {
    position: absolute;
    bottom: 60px;
    right: 14px;
    left: auto;
    z-index: 900;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    min-width: 150px;
    pointer-events: none;
}

.legend-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 7px;
}

.legend-item:last-child { margin-bottom: 0; }

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.listing-dot{
    width:14px;
    height:14px;
    border-radius:50%;

    border:2px solid #fff;

    box-shadow:
        0 2px 8px rgba(0,0,0,0.35);

    cursor:pointer;

    transition:
        transform .18s ease,
        box-shadow .18s ease;
}

.listing-dot:hover{
    transform:scale(1.35);
}

/* active/highlighted */
.listing-dot.active{
    transform:scale(1.45);
    box-shadow:
        0 0 0 4px rgba(255,255,255,.9),
        0 4px 14px rgba(0,0,0,.45);
}

/* ─────────────────────────────
   POPUP CARD
───────────────────────────── */

.zillow-popup .leaflet-popup-content-wrapper{
    padding:0;
    overflow:hidden;
    border-radius:10px;
}

.zillow-popup .leaflet-popup-content{
    margin:0;
    width:200px !important;
}

.zillow-popup .leaflet-popup-tip{
    background:#fff;
}

.map-popup-card{
    width:200px;
    overflow:hidden;
    background:#fff;
}

.popup-img{
    width:100%;
    height:110px;
    object-fit:cover;
    display:block;
}

.popup-content{
    padding:8px;
}

.popup-price{
    font-size:16px;
    font-weight:700;
    color:var(--text-primary);
    margin-bottom:3px;
}

.popup-specs{
    font-size:11px;
    color:var(--text-secondary);
    margin-bottom:4px;
}

.popup-address{
    font-size:11px;
    color:var(--text-muted);
    line-height:1.3;
}
    /* ═══════════════════════════════════════
   ZILLOW MAP CONTROLS
═══════════════════════════════════════ */

.z-map-controls{
    position:absolute;
    top:18px;
    right:18px;
    z-index:1200;

    display:flex;
    align-items:flex-start;
    gap:12px;
}

/* BUTTON */

.z-map-btn{
    height:44px;
    padding:0 18px;

    border:1.5px solid var(--border-strong);
    border-radius:8px;

    background:#fff;
    color:var(--text-primary);

    font-size:15px;
    font-weight:600;

    cursor:pointer;

    display:flex;
    align-items:center;
    gap:10px;

    box-shadow:0 2px 8px rgba(0,0,0,0.12);

    transition:all .2s ease;
}

.z-map-btn:hover{
    background:var(--surface-2);
    border-color:var(--navy);
}

.z-map-btn i{
    font-size:12px;
}

/* GROUP */

.z-control-group{
    position:relative;
}

/* POPUP */

.z-popup{
    position:absolute;
    top:54px;
    left:0;

    width:360px;

    background:#fff;
    border-radius:12px;

    box-shadow:
        0 12px 30px rgba(0,0,0,.18);

    border:1.5px solid var(--border);

    overflow:hidden;

    display:none;
}

.z-popup.show{
    display:block;
}

/* HEADER */

.z-popup-header{
    height:58px;

    padding:0 18px;

    display:flex;
    align-items:center;
    justify-content:space-between;

    border-bottom:1px solid var(--border);

    font-size:24px;
    font-weight:700;
    color:var(--text-secondary);
}

.z-popup-header button{
    width:34px;
    height:34px;

    border:none;
    border-radius:50%;

    background:transparent;

    cursor:pointer;

    display:flex;
    align-items:center;
    justify-content:center;
}

.z-popup-header button:hover{
    background:var(--surface-2);
}

/* BODY */

.z-popup-body{
    padding:18px;
}

/* CHECKBOX ROW */

.z-checkbox-row{
    display:flex;
    align-items:center;
    gap:12px;

    margin-bottom:18px;

    font-size:16px;
    font-weight:600;
    color:var(--text-primary);
}

/* SCHOOL GRID */

.z-school-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:18px 22px;

    margin-bottom:26px;
}

.z-school-grid label{
    display:flex;
    align-items:center;
    gap:10px;

    font-size:15px;
    color:var(--text-secondary);
}

/* INPUTS */

.z-popup input[type="checkbox"]{
    width:18px;
    height:18px;

    accent-color:var(--navy);
}

/* SELECT */

.z-select-group{
    margin-bottom:22px;
}

.z-select-group label{
    display:block;

    margin-bottom:10px;

    font-size:15px;
    font-weight:600;
    color:var(--text-secondary);
}

.z-select-group select{
    width:100%;
    height:52px;

    border:1.5px solid var(--border-strong);
    border-radius:10px;

    padding:0 14px;

    font-size:16px;

    outline:none;
}

.z-select-group select:focus{
    border-color:var(--navy);
}
    /* ══════════════════════════════════════════════════════════
   LOADING OVERLAY
══════════════════════════════════════════════════════════ */
.listing-loading {
    position: absolute;
    inset: 0;
    background: rgba(248,250,252,0.75);
    backdrop-filter: blur(2px);
    z-index: 5000;

    display: flex;
    align-items: center;
    justify-content: center;

    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.listing-loading.show {
    opacity: 1;
    visibility: visible;
}

.loading-box {
    background: #fff;
    padding: 22px 28px;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.loading-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid var(--border);
    border-top-color: var(--emerald);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

    /* Add to your <style> block */
.leaflet-marker-icon {
    transition: opacity 0.2s;
}
*, *::before, *::after { box-sizing: border-box; }

/* ── PAGE SHELL ─────────────────────────────────────────── */
.listing-page{
  display:flex;
  flex-direction:column;
  width:100%;
  min-height: calc(100vh - 62px);  /* CHANGE height → min-height */
  height: calc(100vh - 62px);
  overflow:hidden;
  background:var(--surface);
}

/* ══════════════════════════════════════════════════════════
   TOP BAR
══════════════════════════════════════════════════════════ */
.top-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1.5px solid var(--border);
    z-index: 100;
    overflow-x: auto;
    scrollbar-width: none;
}
.top-bar::-webkit-scrollbar { display: none; }

/* ── Bootstrap filter bar brand overrides ── */
.top-bar .form-select,
.top-bar .input-group-text,
.top-bar .form-control {
    border-color: var(--border-strong);
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.top-bar .form-select:focus,
.top-bar .form-control:focus {
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(15,35,66,0.08);
}
.top-bar .form-select {
    width: auto;
    flex-shrink: 0;
    cursor: pointer;
}
.top-bar .form-select:hover {
    border-color: var(--navy);
    background-color: var(--surface-2);
}
.top-bar .input-group {
    flex-shrink: 0;
}
.btn-save-search {
    border-color: var(--emerald) !important;
    background: var(--emerald-pale) !important;
    color: var(--emerald) !important;
    font-weight: 700;
    font-size: 0.84rem;
}
.btn-save-search:hover {
    background: var(--emerald) !important;
    color: #fff !important;
}

/* ══════════════════════════════════════════════════════════
   SPLIT AREA
══════════════════════════════════════════════════════════ */
.split-area {
    flex: 1 1 auto;   /* ensure it grows to fill */
    display: flex;
    min-height: 0;
    overflow: hidden;
}

/* ── MAP PANEL ── */
.map-panel {
    width: 70%; height: 100%;
    position: relative; flex-shrink: 0;
    background: #e8edf2;
}
#listing-map { width: 100%; height: 100%; }

/* Map overlay buttons */
.map-overlay-btns {
    position: absolute; bottom: 16px; left: 50%;
    transform: translateX(-50%); z-index: 900;
    display: flex; gap: 8px;
}
.map-overlay-btn {
    display: flex; align-items: center; gap: 6px;
    height: 38px; padding: 0 16px; border-radius: 999px;
    border: 1.5px solid var(--border-strong); background: #fff;
    font-size: 0.8rem; font-weight: 600; color: var(--text-secondary);
    cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,0.14);
    white-space: nowrap; transition: all 0.2s;
}
.map-overlay-btn:hover { background: var(--surface-2); border-color: var(--navy); }
.map-overlay-btn.danger { border-color: var(--emerald); color: var(--emerald); background: var(--emerald-pale); }
.map-overlay-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Zoom hint */
.zoom-hint {
    position: absolute; top: 12px; left: 50%;
    transform: translateX(-50%);
    background: rgba(15,23,42,0.82); color: #fff;
    padding: 7px 16px; border-radius: 999px;
    font-size: 0.78rem; font-weight: 600;
    z-index: 900; pointer-events: none;
    transition: opacity 0.3s;
}
.zoom-hint.hidden { opacity: 0; }

/* ── RESULTS PANEL ── */
.results-panel {
    width: 42%; height: 100%;
    display: flex; flex-direction: column;
    background: #fff; border-left: 1.5px solid var(--border);
}

.results-header {
    flex-shrink: 0; padding: 14px 18px 10px;
    border-bottom: 1.5px solid var(--border);
}
.results-header h2 {
    font-size: 1.1rem; font-weight: 700;
    color: var(--text-primary); margin: 0 0 4px;
}
.result-meta {
    display: flex; align-items: center;
    justify-content: space-between;
    font-size: 0.82rem; color: var(--text-muted);
}
.sort-select {
    border: none; outline: none; background: transparent;
    font-size: 0.82rem; font-weight: 600;
    color: var(--navy); cursor: pointer; font-family: 'Inter', sans-serif;
}

.results-scroll {
    flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0;
    scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.results-scroll::-webkit-scrollbar { width: 4px; }
.results-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ══════════════════════════════════════════════════════════
   PROPERTY CARDS
══════════════════════════════════════════════════════════ */
.cards-list { display: flex; flex-direction: column; }

.prop-card {
    display: flex; flex-direction: row;
    align-items: stretch;
    border-bottom: 1px solid var(--border);
    background: #fff; cursor: pointer;
    transition: background 0.15s; text-decoration: none; color: inherit;
}
.prop-card:hover { background: var(--surface); }
.prop-card.highlighted { background: var(--emerald-pale); border-left: 3px solid var(--emerald); }

.card-img-col {
    width: 150px; min-width: 150px; height: 130px;
    height: auto;           
    align-self: stretch;
    position: relative; overflow: hidden;
    background: var(--surface-2); flex-shrink: 0;
}
.card-img-col img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.3s;
}
.prop-card:hover .card-img-col img { transform: scale(1.04); }

.card-badge {
    position: absolute; top: 7px; left: 7px;
    padding: 2px 7px; border-radius: 4px;
    font-size: 0.62rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em; color: #fff;
}
.card-badge.single   { background: rgba(15,35,66,0.82); color: #E2E8F0; }
.card-badge.multiple { background: var(--green); }

.card-time {
    position: absolute; bottom: 6px; left: 7px;
    padding: 2px 6px; border-radius: 3px;
    background: rgba(0,0,0,0.52); color: #fff;
    font-size: 0.6rem; font-weight: 600;
}

.card-save-btn {
    position: absolute; top: 7px; right: 7px;
    width: 28px; height: 28px; border: none; border-radius: 50%;
    background: #fff; display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    transition: transform 0.15s; z-index: 2;
}
.card-save-btn:hover { transform: scale(1.12); }
.card-save-btn i { color: var(--text-muted); font-size: 0.78rem; }
.card-save-btn.saved i { color: var(--emerald); }

.card-info {
    flex: 1; padding: 12px 14px;
    display: flex; flex-direction: column;
    justify-content: space-between; min-width: 0; gap: 3px;
}
.card-price-row { display: flex; align-items: baseline; gap: 6px; }
.card-price { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }
.card-price-sgd { font-size: 0.7rem; color: var(--text-muted); }
.card-specs { font-size: 0.75rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-specs .dot { color: var(--border-strong); margin: 0 4px; }
.card-type { font-size: 0.68rem; font-weight: 700; color: var(--emerald); text-transform: uppercase; letter-spacing: 0.07em; }
.card-address { font-size: 0.77rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-agent { font-size: 0.68rem; color: var(--text-muted); }
.card-district-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 0.68rem; color: var(--text-muted); }
.card-stars { color: #F59E0B; font-size: 0.65rem; letter-spacing: -1px; }

/* ══════════════════════════════════════════════════════════
   MAP ELEMENTS
══════════════════════════════════════════════════════════ */

/* Individual price tag (shown at high zoom) */
.price-tag {
    background: var(--navy); color: #fff;
    padding: 4px 9px; border-radius: 6px;
    font-size: 11px; font-weight: 700;
    white-space: nowrap; cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.28);
    transition: background 0.15s, transform 0.15s;
    transform: translateX(-50%);
}
.price-tag:hover, .price-tag.active {
    background: var(--emerald);
    transform: scale(1.1);
}

/* District bubble (shown at low zoom — like Zillow cluster) */
.district-bubble {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}
.district-bubble:hover { transform: scale(1.08); }

.bubble-circle {
    width: 64px; height: 64px; border-radius: 50%;
    background: rgba(15,35,66,0.9);
    border: 3px solid #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,0.32);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: #fff; position: relative;
}
.bubble-count {
    font-size: 1.05rem; font-weight: 800;
    line-height: 1; color: #fff;
}
.bubble-label {
    font-size: 0.55rem; font-weight: 700;
    color: rgba(255,255,255,0.72);
    text-transform: uppercase; letter-spacing: 0.05em;
    margin-top: 1px;
}
.bubble-district {
    font-size: 0.65rem; font-weight: 700;
    color: #fff; margin-top: 4px;
    background: #005037;
    padding: 2px 8px; border-radius: 999px;
    white-space: nowrap;
}

/* Active (selected) district bubble */
.district-bubble.active .bubble-circle {
    background: var(--emerald);
    border-color: #fff;
}

/* ── EMPTY STATE ── */
.empty-state { padding: 60px 20px; text-align: center; color: var(--text-muted); }
.empty-state i { display: block; margin-bottom: 14px; font-size: 2.2rem; }
.empty-state h3 { margin-bottom: 6px; font-size: 1rem; color: var(--text-secondary); }

/* ── MOBILE ── */
@media (max-width: 768px) {
    .listing-page { height: auto; overflow: visible; }
    .split-area { flex-direction: column; height: auto; overflow: visible; }
    .map-panel { width: 100%; height: 300px; }
    .results-panel { width: 100%; height: auto; }
    .results-scroll { overflow: visible; }
}

@media (min-width: 769px) and (max-width: 1100px) {
    .map-panel { width: 55%; }
    .results-panel { width: 45%; }
}
.quick-menu-section { padding: 40px 0 20px; background: #F8FAFC; }
.quick-menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.quick-menu-card {
    background: #fff; border-radius: 16px; padding: 32px;
    box-shadow: 0 4px 20px rgba(15,35,66,0.08);
    border: 1px solid #E2E8F0;
}
.quick-menu-card h3 { font-size: 1.6rem; font-weight: 800; color: #0F172A; margin-bottom: 10px; }
.quick-menu-card p { color: #475569; margin-bottom: 18px; font-size: 0.95rem; }
.btn-quick-menu {
    display: inline-block; background: #0F2342; color: #fff;
    padding: 10px 22px; border-radius: 8px; font-weight: 700;
    text-decoration: none; font-size: 0.9rem; transition: background 0.2s;
}
.btn-quick-menu:hover { background: #059669; color: #fff; }

.realtime-update-bar {
    background: #DBEAFE;
    padding: 12px 40px;
    margin: -36px -40px 28px -40px;   /* cancels card padding, sits flush at the top */
    border-radius: 16px 16px 0 0;      /* match .ml-value-card's corner radius */
    overflow: hidden;
    display: flex;
    align-items: center;
}
.realtime-label {
    color: #DC2626;
    font-weight: 800;
    font-size: 0.85rem;
    margin-right: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}
.realtime-marq {
    color: #1E293B;
    font-size: 0.9rem;
    flex: 1;
    min-width: 0;
}

@media (max-width: 575px) {
    .ml-value-card { padding: 24px 20px; }
    .realtime-update-bar {
        margin: -24px -20px 20px -20px;
        padding: 10px 20px;
        border-radius: 12px 12px 0 0;
    }
}
