/* =============================================
   Kristal DDF Listings — Styles
   ============================================= */

.ddf-listings-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    font-family: inherit;
}

/* ── Mode toggle ─────────────────────────── */
.ddf-mode-toggle {
    display: flex;
    margin-bottom: 14px;
}
.ddf-mode-btn {
    flex: 1;
    padding: 11px 20px;
    font-family: 'Raleway', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    border: 1px solid #c6ac71;
    background: #fff;
    color: #c6ac71;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.ddf-mode-btn:first-child { border-radius: 4px 0 0 4px; }
.ddf-mode-btn:last-child  { border-left: none; border-radius: 0 4px 4px 0; }
.ddf-mode-btn.active      { background: #c6ac71; color: #fff; }
.ddf-mode-btn:hover:not(.active) { background: #faf7f0; }

/* ── Search card ─────────────────────────── */
.ddf-search-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0 0 14px;
    margin-bottom: 18px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    overflow: hidden;
}

/* City tabs */
.ddf-city-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 20px;
    gap: 0;
}

.ddf-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 11px 18px 9px;
    font-size: 14px;
    font-weight: 500;
    color: #777;
    cursor: pointer;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}
.ddf-tab:hover { color: #232b2b; }
.ddf-tab.active {
    color: #232b2b;
    border-bottom-color: #232b2b;
    font-weight: 600;
}

/* Neighbourhood panels */
.ddf-hood-panel {
    display: none;
    padding: 12px 18px 0;
}
.ddf-hood-panel.active { display: block; }

.ddf-hood-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px 14px;
}

.ddf-hood-label {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    color: #333;
    font-size: 13px;
    line-height: 1.3;
}
.ddf-hood-label:hover { color: #232b2b; }

.ddf-hood-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    accent-color: #232b2b;
    cursor: pointer;
}

/* Select / Deselect */
.ddf-area-actions {
    padding: 8px 18px 0;
    font-size: 12px;
    color: #888;
}
.ddf-area-actions a {
    color: #232b2b;
    text-decoration: none;
}
.ddf-area-actions a:hover { text-decoration: underline; }

/* Bottom filter row */
.ddf-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 12px 18px 0;
    border-top: 1px solid #eee;
    margin-top: 12px;
}

.ddf-filters-row input[type="number"],
.ddf-filters-row input[type="text"],
.ddf-filters-row select {
    padding: 7px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: #333;
    min-width: 120px;
    flex: 1;
}

.ddf-filters-row input[type="number"]:focus,
.ddf-filters-row input[type="text"]:focus,
.ddf-filters-row select:focus {
    outline: none;
    border-color: #232b2b;
}

.ddf-btn {
    padding: 7px 20px;
    background: #232b2b;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}
.ddf-btn:hover { background: #c9a84c; }

.ddf-btn--secondary {
    background: #eee;
    color: #333;
}
.ddf-btn--secondary:hover { background: #ddd; }

/* ── Toolbar ─────────────────────────────── */
.ddf-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
    padding: 10px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.ddf-toolbar__left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ddf-toolbar__count {
    font-size: 14px;
    color: #555;
}

.ddf-sort select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    color: #333;
    cursor: pointer;
}
.ddf-sort select:focus { outline: none; border-color: #c9a84c; }

.ddf-view-toggle {
    display: flex;
    gap: 4px;
}

.ddf-view-btn {
    padding: 7px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #888;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
}
.ddf-view-btn:hover { border-color: #232b2b; color: #232b2b; }
.ddf-view-btn.active {
    background: #232b2b;
    border-color: #232b2b;
    color: #fff;
}

/* ── Map-search layout (Zillow/HouseSigma-style) ───────── */
.ddf-mapsearch {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    gap: 20px;
    margin-top: 14px;
    align-items: start;
}
.ddf-mapsearch__left {
    min-width: 0;
}
.ddf-mapsearch__right {
    position: sticky;
    top: 80px;
    height: calc(100vh - 110px);
    min-height: 480px;
    min-width: 0;
}
.ddf-mapsearch__right #ddf-map {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    margin: 0;
}
/* "Search this area" floating button */
.ddf-mapsearch__redo {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500; /* above Leaflet panes */
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    background: #fff;
    color: #111827;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 20px -6px rgba(0,0,0,.25);
    transition: transform .12s ease;
}
.ddf-mapsearch__redo:hover { transform: translateX(-50%) translateY(-1px); }
.ddf-mapsearch__redo[hidden] { display: none; }
.ddf-mapsearch__redo svg { width: 14px; height: 14px; }

/* Pin-cap hint pill (server tells us we hit MAP_PIN_LIMIT) */
.ddf-mapsearch__cap-hint {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    padding: 6px 12px;
    background: rgba(35, 43, 43, .9);
    color: #fff;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
}

/* Mobile-only Show-Map toggle row — rendered between filter bar (if any) and
   the .ddf-mapsearch grid. Hidden on desktop so the persistent map column
   covers it; visible on ≤900px where the map column collapses. */
.ddf-mobile-bar { display: none; }
.hf-mapview-btn--mobile {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border: 1px solid #232b2b;
    background: #fff;
    color: #232b2b;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.hf-mapview-btn--mobile[aria-pressed="true"] {
    background: #232b2b;
    color: #fff;
}

@media (max-width: 900px) {
    .ddf-mapsearch { grid-template-columns: 1fr; }
    .ddf-mapsearch__right {
        position: static;
        height: 420px;
        min-height: 0;
        display: none;
    }
    .ddf-mapsearch__right.show { display: block; }
    .ddf-mobile-bar {
        display: flex;
        justify-content: center;
        padding: 8px 0 12px;
    }
}

/* ── Loading ─────────────────────────────── */
.ddf-loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

/* ── List view (default) ─────────────────── */
.ddf-grid { display: block; }

.ddf-item {
    display: flex;
    gap: 24px;
    padding: 24px 0;
    border-bottom: 1px solid #eee;
    transition: background 0.15s;
}
.ddf-item:first-child { border-top: 1px solid #eee; }
.ddf-item:hover { background: #fafafa; }

.ddf-item__photo {
    flex: 0 0 280px;
    height: 190px;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0ee;
    position: relative;
    display: block;
    text-decoration: none;
}

.ddf-item__address a {
    color: inherit;
    text-decoration: none;
}
.ddf-item__address a:hover { color: #c9a84c; }
.ddf-item__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}
.ddf-item:hover .ddf-item__photo img { transform: scale(1.03); }

.ddf-item__no-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #bbb;
    font-size: 13px;
}

.ddf-item__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.ddf-item__price {
    font-size: 22px;
    font-weight: 700;
    color: #232b2b;
}

.ddf-item__address {
    font-size: 16px;
    font-weight: 600;
    color: #222;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ddf-item__meta {
    font-size: 13px;
    color: #777;
}

.ddf-item__specs {
    font-size: 14px;
    color: #444;
    font-weight: 500;
}

.ddf-item__remarks {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin-top: 4px;
}

.ddf-item__remarks .ddf-truncated { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ddf-item__remarks.expanded .ddf-truncated { display: block; -webkit-line-clamp: unset; overflow: visible; }

.ddf-read-more {
    background: none;
    border: none;
    color: #c9a84c;
    cursor: pointer;
    font-size: 13px;
    padding: 0;
    text-decoration: underline;
}

.ddf-item__brokerage {
    font-size: 12px;
    color: #999;
    margin-top: auto;
    padding-top: 8px;
}

.ddf-listings-wrap.view-grid .ddf-item__brokerage { display: none; }

/* ── Grid view ───────────────────────────── */
.ddf-listings-wrap.view-grid .ddf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}
.ddf-listings-wrap.view-grid .ddf-item {
    flex-direction: column;
    gap: 0;
    padding: 0;
    border: none;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    background: #fff;
}
.ddf-listings-wrap.view-grid .ddf-item:first-child { border-top: none; }
.ddf-listings-wrap.view-grid .ddf-item:hover { background: #fff; box-shadow: 0 6px 24px rgba(0,0,0,0.13); }
.ddf-listings-wrap.view-grid .ddf-item__photo { flex: none; width: 100%; height: 200px; border-radius: 0; }
.ddf-listings-wrap.view-grid .ddf-item__body { padding: 14px 16px 16px; gap: 4px; }
.ddf-listings-wrap.view-grid .ddf-item__price { font-size: 18px; }
.ddf-listings-wrap.view-grid .ddf-item__address { font-size: 14px; }
.ddf-listings-wrap.view-grid .ddf-item__remarks { display: none; }

/* ── Pagination ──────────────────────────── */
.ddf-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 32px 0 16px;
    flex-wrap: wrap;
}

.ddf-page-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ddf-page-btn:hover { border-color: #232b2b; color: #232b2b; }
.ddf-page-btn.active { background: #232b2b; border-color: #232b2b; color: #fff; cursor: default; }
.ddf-page-btn:disabled { opacity: 0.4; cursor: default; }
.ddf-page-btn.ellipsis { border: none; cursor: default; }
.ddf-page-btn.ellipsis:hover { color: #333; border: none; }

/* ── Open House badge ────────────────────── */
.ddf-oh-ribbon {
    position: absolute;
    top: 14px;
    left: -32px;
    width: 130px;
    background: #232b2b;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    text-align: center;
    padding: 5px 0;
    transform: rotate(-45deg);
    transform-origin: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
    pointer-events: none;
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 700px) {
    .ddf-city-tabs { gap: 0; padding: 0 12px; }
    .ddf-tab { padding: 12px 14px 10px; font-size: 14px; }
    .ddf-hood-panel { padding: 14px 12px 0; }
    .ddf-hood-grid { grid-template-columns: repeat(2, 1fr); }
    .ddf-filters-row { padding: 14px 12px 0; }
    .ddf-filters-row input,
    .ddf-filters-row select,
    .ddf-btn { width: 100%; flex: none; }
    .ddf-item { flex-direction: column; }
    .ddf-item__photo { flex: none; width: 100%; height: 200px; }
    .ddf-toolbar { flex-direction: column; align-items: flex-start; }
}


/* ── Featured Open House ─────────────── */
.ddf-item--featured {
    border-top: 3px solid var(--gold);
}
.ddf-featured-label {
    display: inline-block;
    background: var(--gold);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 3px;
    margin-bottom: 6px;
}

/* ── REALTOR.ca badge ─────────────────── */
.ddf-realtor-badge {
    text-align: center;
    padding: 24px 0 8px;
}
/* Visually disable the click on the REALTOR.ca anchor while keeping the
   markup intact (img wrapped in <a>) for source-level attribution. */
.ddf-realtor-badge a {
    pointer-events: none;
    cursor: default;
}

/* ── Price-chip markers (Google AdvancedMarkerElement content) ───── */
/* Google's AdvancedMarkerElement positions the bottom-center of the content
   at the lat/lng. translateY(50%) shifts the wrapper down so the visible chip
   ends up centered on the location instead of sitting above it. */
.ddf-pricechip {
    transform: translateY(50%);
    will-change: transform;
}
.ddf-pricechip__inner {
    display: inline-block;
    padding: 4px 9px;
    background: #fff;
    color: #111827;
    border: 1.5px solid #232b2b;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
    cursor: pointer;
    transition: background .12s ease, color .12s ease, transform .12s ease;
}
.ddf-pricechip:hover .ddf-pricechip__inner,
.ddf-pricechip.is-active .ddf-pricechip__inner {
    background: #232b2b;
    color: #fff;
    transform: scale(1.06);
    z-index: 1000;
}

/* Zoom-out mode: collapse price chips to small red dots when the map is
   zoomed out far enough that prices would overlap. Toggled by JS on
   .ddf-mapsearch__right when map.getZoom() < ZOOM_PRICE_THRESHOLD. */
.ddf-mapsearch__right.is-zoom-dots .ddf-pricechip__inner {
    width: 12px;
    height: 12px;
    padding: 0;
    border-radius: 50%;
    background: #e4574c;
    border: 2px solid #fff;
    color: transparent;
    font-size: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,.45);
}
.ddf-mapsearch__right.is-zoom-dots .ddf-pricechip:hover .ddf-pricechip__inner,
.ddf-mapsearch__right.is-zoom-dots .ddf-pricechip.is-active .ddf-pricechip__inner {
    background: #c8392e;
    transform: scale(1.4);
}

/* Active result card highlight (from marker hover/click) */
.ddf-item.is-active {
    background: #fafafa;
    box-shadow: 0 0 0 2px #232b2b inset;
    border-radius: 6px;
}

/* Google MarkerClusterer renders its own SVG cluster bubble — no extra
   class hooks the same way. Default look (blue with count) is acceptable;
   a custom Renderer can be added later if branding consistency matters. */

/* ── Map marker mini-card (InfoWindow content) ─────────────────── */
/* Google's InfoWindow wrapper has its own .gm-style-iw padding; strip it
   so the photo can reach the popup edges, Zillow-style. */
.gm-style-iw.gm-style-iw-c {
    padding: 0 !important;
    max-width: 280px !important;
}
.gm-style-iw .gm-style-iw-d {
    padding: 0 !important;
    overflow: hidden !important;
    max-height: none !important;
}
.gm-style-iw .gm-style-iw-chr {
    /* close-button row */
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 2;
}

.ddf-mini {
    display: block;
    width: 260px;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    transition: transform .12s ease;
}
.ddf-mini:hover { transform: translateY(-1px); }
.ddf-mini__photo {
    width: 100%;
    height: 150px;
    background-size: cover;
    background-position: center;
    background-color: #f3f4f6;
}
.ddf-mini__photo--empty::before {
    content: '🏠';
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 36px;
    opacity: .35;
}
.ddf-mini__body {
    padding: 10px 12px 12px;
}
.ddf-mini__price {
    font-size: 17px;
    font-weight: 800;
    color: #111827;
    line-height: 1.2;
}
.ddf-mini__specs {
    margin-top: 3px;
    font-size: 12px;
    color: #4b5563;
}
.ddf-mini__address {
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.3;
}
.ddf-mini__cta {
    margin-top: 8px;
    font-size: 11.5px;
    font-weight: 700;
    color: #232b2b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ddf-mini:hover .ddf-mini__cta { color: #000; }
