/* House Finder — Stylesheet */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --page-gutter: 1rem;
    --homepage-map-top-offset: 10.5rem;
    --homepage-map-bottom-gap: 1rem;
    --homepage-map-ratio: 0.44;
    --homepage-map-width: calc((100vw - (3 * var(--page-gutter))) * var(--homepage-map-ratio));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Navbar */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

.navbar-links {
    display: flex;
    gap: 1.5rem;
}

.navbar-links-main {
    margin-left: auto;
    margin-right: auto;
}

.navbar-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.navbar-links a:hover,
.navbar-links a.active {
    color: var(--primary);
}

/* Navbar Settings Button */
.navbar-settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.4rem;
    border-radius: 50%;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.navbar-settings-btn:hover {
    color: var(--primary);
    background: var(--bg);
}

/* Settings Overlay */
.settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    justify-content: flex-end;
    align-items: stretch;
}

.settings-overlay.active {
    display: flex;
}

.settings-panel {
    width: 100%;
    max-width: 420px;
    background: var(--card-bg);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.15);
    animation: settings-slide-in 0.25s ease;
}

@keyframes settings-slide-in {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.settings-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
}

.settings-close-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    transition: color 0.2s, background 0.2s;
}

.settings-close-btn:hover {
    color: var(--danger);
    background: var(--bg);
}

.settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

.settings-section {
    margin-bottom: 1.5rem;
}

.settings-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.75rem;
}

.scrape-info-loading {
    color: var(--text-muted);
    font-style: italic;
}

.scrape-info-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
}

.scrape-info-card .scrape-time {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.35rem;
}

.scrape-info-card .scrape-status {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.scrape-info-card .scrape-status.status-success {
    background: #dcfce7;
    color: var(--success);
}

.scrape-info-card .scrape-status.status-error {
    background: #fee2e2;
    color: var(--danger);
}

.scrape-info-card .scrape-stats {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.scrape-history-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.scrape-history-item:last-child {
    border-bottom: none;
}

.scrape-history-item .history-time {
    flex: 1;
    color: var(--text);
}

.scrape-history-item .history-stats {
    color: var(--text-muted);
    white-space: nowrap;
}

.scrape-no-data {
    color: var(--text-muted);
    font-style: italic;
}

@media (max-width: 600px) {
    .settings-panel {
        max-width: 100%;
    }
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0 1.5rem;
}

.page-header h1 {
    font-size: 1.75rem;
}

/* Badges */
.badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-new {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: var(--success);
}

.badge-delisted {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: #94a3b8;
}

.source-badge {
    display: inline-block;
    background: var(--border);
    color: var(--text-muted);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-active { background: #dcfce7; color: #166534; }
.status-removed { background: #fee2e2; color: #991b1b; }
.status-sold { background: #fef3c7; color: #92400e; }
.status-delisted { background: #e2e8f0; color: #475569; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Filters */
.filters-bar {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.filters-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.filter-group input,
.filter-group select {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    width: 130px;
}

.filter-group-checkbox {
    justify-content: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text);
    font-weight: normal;
    cursor: pointer;
    white-space: nowrap;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

/* Listings Grid */
.listings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Homepage Split Layout */
.homepage-main {
    width: 100%;
    max-width: 100%;
    padding: 0;
    margin: 0;
}

.homepage-filters {
    border-radius: 0;
    margin-bottom: 0;
    padding: 0.75rem var(--page-gutter);
    position: sticky;
    top: 58px;
    z-index: 90;
}

.homepage-main ~ .footer {
    display: none;
}

.homepage-split {
    display: block;
    padding-top: 1rem;
}

.homepage-listings {
    width: auto;
    max-width: none;
    margin-left: var(--page-gutter);
    margin-right: calc(var(--homepage-map-width) + (2 * var(--page-gutter)));
    padding-bottom: 2rem;
}

.homepage-listings .listings-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.homepage-map {
    width: var(--homepage-map-width);
    position: fixed;
    right: var(--page-gutter);
    top: var(--homepage-map-top-offset);
    bottom: var(--homepage-map-bottom-gap);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: var(--card-bg);
}

.listing-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
    position: relative;
    border: 2px solid transparent;
}

.listing-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.listing-card.listing-card-highlight {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary), var(--shadow-md);
}

.listing-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.listing-image {
    position: relative;
    height: 200px;
    background: var(--border);
    overflow: hidden;
}

.listing-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 3rem;
    color: var(--text-muted);
}

.listing-info {
    padding: 1rem;
}

.listing-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.listing-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.listing-details {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.listing-address {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.listing-notes {
    font-size: 0.8rem;
    color: var(--secondary);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.listing-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.listing-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Favorite Button */
.btn-favorite {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
}

.btn-favorite:hover {
    background: white;
}

.btn-favorite.active {
    color: var(--warning);
}

.btn-favorite-lg {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-favorite-lg.active {
    background: #fef3c7;
    border-color: var(--warning);
    color: #92400e;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
}

.page-info {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Detail Page */
.detail-page {
    margin: 1.5rem 0;
}

.back-btn {
    margin-bottom: 1rem;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.detail-header h1 {
    font-size: 1.5rem;
    flex: 1;
}

.detail-actions {
    display: flex;
    gap: 0.5rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
}

.detail-section {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.detail-section h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* Photo Gallery */
.photo-gallery {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.photo-main img {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
    background: #000;
}

.photo-thumbnails {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem;
    overflow-x: auto;
}

.photo-thumbnails img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.photo-thumbnails img:hover,
.photo-thumbnails img.active {
    opacity: 1;
}

.no-image-large {
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border);
    border-radius: var(--radius);
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Info Card */
.info-card {
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.info-card h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.info-card h3 {
    font-size: 0.95rem;
    margin: 1rem 0 0.5rem;
}

.info-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
}

.info-list dt {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.info-list dd {
    font-size: 0.9rem;
}

.price-large {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

/* Notes */
#notes-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 0.5rem;
}

/* Duplicate List */
.duplicate-list {
    list-style: none;
}

.duplicate-list li {
    margin-bottom: 0.5rem;
}

.duplicate-list a {
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.duplicate-list a:hover {
    text-decoration: underline;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
}

.empty-state h2 {
    margin-bottom: 0.5rem;
    color: var(--text);
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    margin-top: 2rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* === Desktop-only / mobile-only helpers === */
.mobile-filter-btn,
.mobile-filter-header,
.mobile-sheet-handle,
.mobile-sheet-header,
.mobile-preview {
    display: none;
}
.desktop-only {
    display: inline-flex;
}

/* Dedup Modal */
.dedup-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 3100;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
}

.dedup-modal-overlay.active {
    display: flex;
}

.dedup-modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 420px;
    animation: dedup-modal-in 0.2s ease;
}

@keyframes dedup-modal-in {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.dedup-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.dedup-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.dedup-modal-body {
    padding: 1.25rem;
}

.dedup-modal-body p {
    margin-bottom: 0.75rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.dedup-password-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
}

.dedup-password-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.dedup-error {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #fef2f2;
    color: var(--danger);
    border-radius: 4px;
    font-size: 0.85rem;
}

.dedup-result {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #f0fdf4;
    border-radius: 4px;
    font-size: 0.85rem;
}

.dedup-result ul {
    margin: 0.5rem 0 0.5rem 1.25rem;
    padding: 0;
}

.dedup-result li {
    margin-bottom: 0.25rem;
}

.dedup-result a {
    color: var(--primary);
    text-decoration: none;
}

.dedup-result a:hover {
    text-decoration: underline;
}

.dedup-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 1200px) {
    .listings-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .homepage-listings .listings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1850px) {
    .homepage-listings .listings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .desktop-only { display: none !important; }

    /* ── Compact navbar ── */
    .navbar {
        padding: 0.4rem 0;
    }
    .navbar .container {
        flex-direction: row;
        gap: 0.5rem;
    }
    .navbar-brand {
        font-size: 1rem;
    }
    .navbar-links {
        gap: 0.75rem;
        font-size: 0.85rem;
    }
    .navbar-links-main {
        margin: 0;
    }

    /* ── Floating filter button ── */
    .mobile-filter-btn {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        position: fixed;
        top: 46px;
        right: 0.75rem;
        z-index: 900;
        background: var(--card-bg);
        border: 1px solid var(--border);
        border-radius: 999px;
        padding: 0.4rem 0.85rem;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        font-size: 0.8rem;
        font-weight: 600;
        cursor: pointer;
        color: var(--text);
    }
    .mobile-filter-btn:active {
        background: var(--border);
    }
    .mobile-filter-btn svg {
        flex-shrink: 0;
    }

    /* ── Filter bar → fullscreen overlay ── */
    .homepage-filters {
        position: fixed;
        inset: 0;
        z-index: 2000;
        background: var(--bg);
        padding: 0;
        margin: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        pointer-events: none;
    }
    .homepage-filters.mobile-active {
        transform: translateY(0);
        pointer-events: auto;
    }

    .mobile-filter-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid var(--border);
        background: var(--card-bg);
        flex-shrink: 0;
    }
    .mobile-filter-title {
        font-weight: 700;
        font-size: 1.1rem;
    }
    .mobile-filter-close {
        background: none;
        border: none;
        font-size: 1.6rem;
        cursor: pointer;
        padding: 0.25rem 0.5rem;
        color: var(--text);
        line-height: 1;
    }
    .mobile-filter-apply {
        font-size: 0.85rem;
        padding: 0.4rem 1rem;
    }

    .homepage-filters .filters-form {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }
    .homepage-filters .filter-group {
        width: 100%;
    }
    .homepage-filters .filter-group label {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
        display: block;
    }
    .homepage-filters .filter-group input[type="number"],
    .homepage-filters .filter-group select {
        width: 100%;
        padding: 0.6rem 0.75rem;
        font-size: 1rem;
        border: 1px solid var(--border);
        border-radius: var(--radius);
    }

    /* ── Fullscreen map ── */
    .homepage-split {
        padding-top: 0;
    }

    .homepage-map {
        position: fixed;
        inset: 0;
        top: 40px;
        width: 100%;
        height: auto;
        border: none;
        border-radius: 0;
        box-shadow: none;
        z-index: 1;
    }

    /* ── Listings → Bottom sheet ── */
    .homepage-listings {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        margin: 0;
        padding: 0;
        height: 56px;
        z-index: 800;
        background: var(--card-bg);
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.12);
        overflow: hidden;
        transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .homepage-listings.mobile-expanded {
        height: 85vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-sheet-handle {
        display: flex;
        justify-content: center;
        padding: 8px 0 4px;
        width: 100%;
        cursor: pointer;
    }
    .handle-pill {
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: #ccc;
    }

    .mobile-sheet-header {
        display: flex;
        justify-content: center;
        padding: 0 1rem 6px;
        font-size: 0.8rem;
        cursor: pointer;
    }

    .homepage-listings .listings-grid {
        grid-template-columns: 1fr;
        padding: 0 0.5rem 2rem;
    }

    .homepage-listings .pagination {
        padding: 1rem;
    }

    .listing-card {
        max-width: none;
    }

    /* ── Mobile preview card (on marker tap) ── */
    .mobile-preview {
        display: none;
        position: fixed;
        bottom: 64px;
        left: 0.5rem;
        right: 0.5rem;
        z-index: 799;
        background: var(--card-bg);
        border-radius: var(--radius);
        box-shadow: 0 4px 16px rgba(0,0,0,0.18);
        overflow: hidden;
        animation: slideUpPreview 0.25s ease;
    }
    .mobile-preview.visible {
        display: block;
    }

    @keyframes slideUpPreview {
        from { transform: translateY(20px); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }

    .mobile-preview-link {
        display: flex;
        text-decoration: none;
        color: inherit;
    }
    .mobile-preview-img {
        width: 90px;
        height: 80px;
        flex-shrink: 0;
        background: var(--border);
        overflow: hidden;
    }
    .mobile-preview-img img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    .mobile-preview-img .no-image {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
        font-size: 1.5rem;
    }
    .mobile-preview-info {
        padding: 0.5rem 0.75rem;
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    .mobile-preview-price {
        font-weight: 700;
        font-size: 0.95rem;
        color: var(--primary);
    }
    .mobile-preview-title {
        font-size: 0.8rem;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .mobile-preview-details {
        font-size: 0.75rem;
        color: var(--text-muted);
    }
    .mobile-preview-close {
        position: absolute;
        top: 4px;
        right: 6px;
        background: rgba(0,0,0,0.5);
        color: #fff;
        border: none;
        border-radius: 50%;
        width: 22px;
        height: 22px;
        font-size: 14px;
        line-height: 1;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* ── Leaflet mobile tweaks ── */
    .leaflet-control-zoom {
        margin-right: 10px !important;
        margin-top: 50px !important;
    }

    /* Hide popups on mobile (we use preview card) */
    .leaflet-popup {
        display: none !important;
    }

    /* ── Other responsive tweaks ── */
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-header {
        flex-direction: column;
    }

    .filter-group input,
    .filter-group select {
        width: 100%;
    }

}
