/* =============================================================
   Property Search Map – pspm.css
   Matches the Westwoods Commercial design screenshot exactly
   ============================================================= */

/* ---------- CSS variables ---------- */
.pspm {
    --navy:   #071D2C;
    --gold:   #C8A15A;
    --green:  #579447;
    --blue:   #18729C;
    --ink:    #16243b;
    --mute:   #667078;
    --line:   #dde2ea;
    --bg:     #f3f5f8;
    --white:  #ffffff;
    --radius: 3px;
    --shadow: 0 2px 14px rgba(7,29,44,.10);

    max-width: 1320px;
    margin: 0 auto;
    padding: 0 20px 40px;
    color: var(--ink);
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}
.pspm *, .pspm *::before, .pspm *::after { box-sizing: border-box; }
.pspm a { text-decoration: none; color: inherit; }

/* =============================================================
   1. SEARCH + FILTER FORM
   ============================================================= */

.pspm-form {
    background: var(--white);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    overflow: visible;   /* allow dropdown to overflow */
    margin-bottom: 0;
}

/* ── OnTheMarket-style search row ── */
.pspm-searchrow {
    position: relative;          /* anchor for dropdown */
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--line);
    background: var(--white);
    border-radius: var(--radius) var(--radius) 0 0;
    transition: box-shadow .15s, border-color .15s;
}
.pspm-searchrow.is-focused {
    border-color: #3a6df0;
    box-shadow: 0 0 0 3px rgba(58,109,240,.12);
    z-index: 10;
}

/* Left location icon */
.pspm-sr-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0 10px 0 16px;
    color: #3a6df0;
    pointer-events: none;
}

/* Chips + input wrapper */
.pspm-sr-body {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 10px 6px;
    min-width: 0;
    cursor: text;
}

/* Selected location chip (OnTheMarket tag) */
.pspm-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #eef2ff;
    color: #3a3a5c;
    border: 1px solid #c7d2fe;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    padding: 3px 8px 3px 10px;
    white-space: nowrap;
    flex-shrink: 0;
}
.pspm-chip-x {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: #6366f1;
    line-height: 1;
    padding: 1px 0 0;
    background: none;
    border: none;
    font-size: 15px;
}
.pspm-chip-x:hover { color: #c0392b; }

/* Actual text input inside the row */
.pspm-sr-body input[type="text"] {
    flex: 1;
    min-width: 140px;
    border: 0;
    outline: none;
    font-family: inherit;
    font-size: 15px;
    color: var(--ink);
    background: transparent;
    padding: 4px 4px;
    line-height: 1.4;
}
.pspm-sr-body input::placeholder { color: #aab0bb; }

/* Inline × clear button */
.pspm-sr-clear {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #e8eaed;
    color: #555;
    cursor: pointer;
    margin-right: 6px;
    transition: background .12s;
}
.pspm-sr-clear:hover { background: #d0d3d8; }

/* Gold search button */
.pspm-submit {
    flex-shrink: 0;
    width: 52px;
    height: 100%;
    min-height: 52px;
    border: 0;
    border-left: 1px solid var(--line);
    background: var(--gold);
    color: var(--white);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background .15s;
    border-radius: 0 var(--radius) 0 0;
}
.pspm-submit:hover { background: #b58f4a; }

/* ── Autocomplete dropdown (defined fully in section 9 below) ── */

/* --- Filter dropdowns row --- */
.pspm-filters {
    display: grid;
    grid-template-columns: repeat(6, 1fr) auto;
    gap: 0;
    align-items: stretch;
}
.pspm-filters select {
    width: 100%;
    padding: 12px 10px;
    border: 0;
    border-right: 1px solid var(--line);
    border-top: 0;
    background: var(--white);
    font-family: inherit;
    font-size: 12px;
    color: var(--ink);
    cursor: pointer;
    appearance: auto;
    outline: none;
    transition: background .12s;
}
.pspm-filters select:last-of-type { border-right: 0; }
.pspm-filters select:hover,
.pspm-filters select:focus { background: #f7f9fc; }

/* Clear button */
.pspm-clear {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 16px;
    border: 0;
    border-left: 1px solid var(--line);
    background: transparent;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--mute);
    cursor: pointer;
    white-space: nowrap;
    transition: color .15s, background .15s;
}
.pspm-clear:hover { color: #c0392b; background: #fff5f5; }
.pspm-clear svg   { flex-shrink: 0; }

/* =============================================================
   2. RESULTS BAR  (count + LIST/MAP toggle)
   ============================================================= */

.pspm-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0 12px;
}

#pspm-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.pspm-toggle {
    display: flex;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.pspm-toggle button {
    padding: 9px 24px;
    border: 0;
    border-right: 1px solid var(--line);
    background: var(--white);
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
    color: var(--ink);
    transition: background .15s, color .15s;
}
.pspm-toggle button:last-child { border-right: 0; }
.pspm-toggle button.on {
    background: var(--navy);
    color: var(--white);
    border-color: var(--navy);
}
.pspm-toggle button:not(.on):hover { background: var(--bg); }

/* =============================================================
   3. SPLIT LAYOUT  (list left | map right)
   ============================================================= */

.pspm-split {
    display: grid;
    grid-template-columns: 360px 1fr;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--white);
    min-height: 580px;
}

/* --- Scrollable card list --- */
.pspm-list {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 580px;
    overflow-y: auto;
    background: var(--bg);
    border-right: 1px solid var(--line);
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
    transition: opacity .2s;
}
.pspm-list::-webkit-scrollbar { width: 6px; }
.pspm-list::-webkit-scrollbar-track { background: transparent; }
.pspm-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.pspm-list.is-loading { opacity: .45; pointer-events: none; }

.pspm-empty {
    padding: 28px 20px;
    color: var(--mute);
    font-size: 13px;
    background: var(--white);
    text-align: center;
}

/* =============================================================
   4. PROPERTY CARDS
   ============================================================= */

.pspm-card {
    display: grid;
    grid-template-columns: 130px 1fr;
    background: var(--white);
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    transition: box-shadow .18s, border-color .18s;
    cursor: pointer;
}
.pspm-card:last-child { border-bottom: 0; }
.pspm-card:hover,
.pspm-card.is-hover {
    box-shadow: 0 4px 18px rgba(7,29,44,.13);
    z-index: 1;
    position: relative;
}

/* Active state – marker clicked on map OR card clicked */
.pspm-card.is-active {
    position: relative;
    z-index: 2;
    box-shadow: 0 0 0 3px #b58f4a, 0 6px 24px rgba(7,29,44,.18);
    border-left: 3px solid #b58f4a;
    background: #fdf8f0;
}
.pspm-card.is-active .pspm-card-img img { transform: scale(1.04); }

/* Thumbnail */
.pspm-card-img {
    position: relative;
    min-height: 118px;
    overflow: hidden;
    background: linear-gradient(135deg, #0e2333 0%, #3d5f72 100%);
}
.pspm-card-img img {
    width: 100%;
    height: 100%;
    min-height: 118px;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}
.pspm-card:hover .pspm-card-img img { transform: scale(1.04); }
.pspm-noimg { background: linear-gradient(135deg, #102b3b, #426477); }

/* Status badge */
.pspm-tag {
    position: absolute;
    top: 8px;
    left: 0;
    background: var(--green);
    color: var(--white);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    padding: 4px 9px;
    border-radius: 0 2px 2px 0;
    line-height: 1;
}
.pspm-tag.soon { background: var(--blue); }
.pspm-tag.sold { background: var(--mute); }

/* Card body */
.pspm-card-body {
    padding: 12px 12px 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}
.pspm-card h3 {
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 2px;
    color: #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pspm-addr {
    font-size: 11px;
    color: var(--mute);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pspm-location {
    font-size: 11px;
    color: var(--mute);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}
.pspm-price {
    font-size: 12px;
    font-weight: 700;
    margin-top: 7px;
    color: #000;
}
.pspm-price span {
    font-weight: 600;
    color: var(--ink);
}
.pspm-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}
.pspm-type {
    font-size: 11px;
    color: var(--mute);
    display: flex;
    align-items: center;
    gap: 5px;
}
/* industrial icon – small building SVG prefix */
.pspm-type::before {
    content: '';
    display: inline-block;
    width: 13px;
    height: 11px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 14'%3E%3Crect x='0' y='6' width='7' height='8' fill='%23667078'/%3E%3Crect x='4' y='0' width='8' height='14' fill='%23667078'/%3E%3Crect x='2' y='9' width='3' height='5' fill='%23f3f5f8'/%3E%3Crect x='7' y='3' width='3' height='3' fill='%23f3f5f8'/%3E%3C/svg%3E") no-repeat center / contain;
    flex-shrink: 0;
}
.pspm-go {
    width: 30px;
    height: 30px;
    background: var(--gold);
    display: grid;
    place-items: center;
    color: var(--white);
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--radius);
    flex-shrink: 0;
    transition: background .15s;
}
.pspm-card:hover .pspm-go { background: #b58f4a; }

/* =============================================================
   5. MAP
   ============================================================= */

.pspm-map {
    min-height: 580px;
    background: #e8ecf1;
    position: relative;
}

/* Gold teardrop pin */
.pspm-pin-wrap {
    background: none !important;
    border: 0 !important;
    overflow: visible !important;
    /* Leaflet positions the icon by its anchor; no extra padding so the
       tip of the teardrop lands exactly on the coordinate */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
}
.pspm-pin {
    display: block;
    position: relative;          /* needed for ::after */
    width: 28px;
    height: 28px;
    background: var(--gold);
    border: 2.5px solid rgba(255,255,255,.9);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 3px 8px rgba(0,0,0,.28);
    transition: background .15s, transform .15s, box-shadow .15s;
    cursor: pointer;
    flex-shrink: 0;
}
.pspm-pin::after {
    content: '';
    position: absolute;
    inset: 7px;
    background: rgba(255,255,255,.55);
    border-radius: 50%;
}
.pspm-pin.active {
    background: var(--navy);
    transform: rotate(-45deg) scale(1.35);
    box-shadow: 0 5px 16px rgba(7,29,44,.5);
}

/* Brand "W" centre marker */
.pspm-brand-wrap {
    background: none !important;
    border: 0 !important;
}
.pspm-brand {
    width: 48px;
    height: 48px;
    background: var(--navy);
    border: 3px solid var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,.35);
    color: var(--gold);
    font-family: 'Georgia', serif;
    font-size: 22px;
    font-weight: 700;
    font-style: italic;
    line-height: 1;
    user-select: none;
}

/* Leaflet popup – centred above the pin, tip aligned to pin */
.pspm .leaflet-popup,
.leaflet-popup {
    pointer-events: auto;
}
.leaflet-popup-content-wrapper {
    border-radius: 4px;
    box-shadow: 0 4px 18px rgba(0,0,0,.18);
    padding: 0;
    text-align: center;
}
.leaflet-popup-content {
    margin: 0;
    padding: 8px 14px;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.3;
    /* min-width: 90px; */
    text-align: center;
}
.leaflet-popup-content a {
    color: var(--navy);
    font-weight: 600;
}
.leaflet-popup-tip-container {
    width: 20px;
    height: 10px;
    margin: 0 auto;
}
.leaflet-popup-close-button {
    top: 4px;
    right: 6px;
}

/* Leaflet tooltip – sits directly centred under the marker */
.leaflet-tooltip {
    font-family: inherit;
    font-size: 11px;
    padding: 4px 9px;
    border-radius: 3px;
    border: 1px solid var(--line);
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
    white-space: nowrap;
    text-align: center;
}
.leaflet-tooltip-top::before,
.leaflet-tooltip-bottom::before,
.leaflet-tooltip-left::before,
.leaflet-tooltip-right::before {
    display: none;
}

/* =============================================================
   6. LIST-ONLY MODE  (grid of cards, no map)
   ============================================================= */

.pspm-split.pspm-listmode {
    grid-template-columns: 1fr;
    min-height: auto;
}
.pspm-split.pspm-listmode .pspm-map { display: none; }
.pspm-split.pspm-listmode .pspm-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    max-height: none;
    border-right: 0;
    gap: 1px;
    background: var(--line);
}
.pspm-split.pspm-listmode .pspm-card {
    grid-template-columns: 1fr;
    border-bottom: 0;
    background: var(--white);
}
.pspm-split.pspm-listmode .pspm-card-img,
.pspm-split.pspm-listmode .pspm-card-img img { min-height: 170px; height: 170px; }

/* =============================================================
   7. LOADING OVERLAY
   ============================================================= */

.pspm-spinner {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.55);
    z-index: 20;
    align-items: center;
    justify-content: center;
}
.pspm-spinner.show { display: flex; }
.pspm-spinner::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid var(--line);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: pspm-spin .7s linear infinite;
}
@keyframes pspm-spin { to { transform: rotate(360deg); } }

/* =============================================================
   8. RESPONSIVE
   ============================================================= */

@media (max-width: 1100px) {
    .pspm-filters { grid-template-columns: repeat(3, 1fr) auto; }
    .pspm-split { grid-template-columns: 320px 1fr; }
}

@media (max-width: 900px) {
    .pspm-split {
        grid-template-columns: 1fr;
        grid-template-rows: 400px 1fr;
    }
    .pspm-map { min-height: 340px; order: -1; }
    .pspm-list { max-height: 480px; border-right: 0; border-top: 1px solid var(--line); }
    .pspm-split.pspm-listmode .pspm-list { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
    .pspm-filters { grid-template-columns: 1fr 1fr; }
    .pspm-filters .pspm-clear { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); justify-content: center; padding: 10px; }
    .pspm-card { grid-template-columns: 110px 1fr; }
    .pspm-split.pspm-listmode .pspm-list { grid-template-columns: 1fr; }
    .pspm-toggle button { padding: 9px 14px; }
}

/* =============================================================
   9. LOCATION AUTOCOMPLETE  –  Google Maps style
   ============================================================= */

/* Allow dropdown to overflow the form box */
.pspm-form        { overflow: visible; }
.pspm-searchrow   { overflow: visible; position: relative; }

.pspm-ac-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99999;
    list-style: none;
    margin: 0;
    padding: 8px 0 4px;
    background: #fff;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,.16), 0 6px 24px rgba(0,0,0,.12);
    border: 1px solid #d8dce2;
    border-top: none;
    display: none;
    overflow: hidden;
}

/* Each suggestion row */
.pspm-ac-list li {
    display: flex;
    align-items: center;
    min-height: 44px;
    cursor: pointer;
    border: none;
    background: transparent;
    transition: background .08s;
}
.pspm-ac-list li:hover,
.pspm-ac-list li.ac-active { background: #f5f5f5; }

/* Left icon circle */
.pspm-ac-icon {
    width: 44px;
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pspm-ac-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #70757a;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Text column */
.pspm-ac-text {
    flex: 1;
    min-width: 0;
    padding: 10px 16px 10px 0;
    border-bottom: 1px solid #ebebeb;
}
.pspm-ac-list li:last-child .pspm-ac-text { border-bottom: none; }

.pspm-ac-main {
    font-size: 14px;
    font-weight: 400;
    color: #202124;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pspm-ac-main mark {
    background: none;
    font-weight: 700;
    color: #202124;
}
.pspm-ac-sub {
    font-size: 12px;
    color: #70757a;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Icon colour per type */
.pspm-ac-list li[data-type="city"]     .pspm-ac-icon svg { stroke: #1a73e8; }
.pspm-ac-list li[data-type="area"]     .pspm-ac-icon svg { stroke: #34a853; }
.pspm-ac-list li[data-type="address"]  .pspm-ac-icon svg { stroke: #70757a; }
.pspm-ac-list li[data-type="uk-place"] .pspm-ac-icon svg { stroke: #ea4335; }

/* Section label inside dropdown */
.pspm-ac-section {
    padding: 6px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    color: #70757a;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-top: 1px solid #ebebeb;
    margin-top: 4px;
}
.pspm-ac-section:first-child { border-top: none; margin-top: 0; }

/* ===== OnTheMarket-style dropdown overrides ===== */
.pspm-ac-list {
    border-radius: 14px;
    margin-top: 6px;
    padding: 8px 0;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    border: 1px solid #d8dce2;
}
.pspm-ac-chiprow {
    padding: 4px 16px 10px 56px;
}
.pspm-ac-chip {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: #1f2937;
    padding: 2px 12px;
    border: 1px solid #e0484a;
    border-radius: 999px;
    line-height: 1.6;
}
.pspm-ac-list li {
    min-height: 52px;
    padding-left: 8px;
}
.pspm-ac-list li.ac-active,
.pspm-ac-list li:hover {
    background: #f4f6f9;
}
.pspm-ac-icon {
    width: 40px;
    min-width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f3f4f6;
    margin-right: 6px;
}
.pspm-ac-icon svg {
    width: 18px;
    height: 18px;
    stroke: #1f2937;
    fill: none;
    stroke-width: 1.8;
}
.pspm-ac-text {
    border-bottom: 0;
    padding: 12px 16px 12px 0;
}
.pspm-ac-main {
    font-size: 15px;
    font-weight: 500;
    color: #111827;
}
.pspm-ac-main mark {
    font-weight: 800;
    color: #111827;
}
.pspm-ac-sub {
    font-size: 12px;
    color: #6b7280;
}

@media only screen and (max-width: 767px) {
    .pspm{
        max-width: 100%;
        margin: 0 auto;
        padding: 0; 
    }
   
}