:root {
    --brand: #0d6efd;
    --muted: #6b7280;
    --maxw: 1420px;
}

* {
    box-sizing: border-box
}

html,
body {
    min-height: 100%;
    margin: 0;
    padding: 0;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
    background: #f5f7fb;
    overflow-x: hidden
}

.page-wrap {
    max-width: var(--maxw);
    margin: 18px auto;
    padding: 14px
}

/* header placeholder */
header.placeholder {
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8891a6;
    margin-bottom: 8px
}

/* HERO */
.hero {
    height: 300px;
    border-radius: 16px;
    background: url('https://images.unsplash.com/photo-1600607688969-a5bfcd646154?auto=format&fit=crop&w=1500&q=80') center/cover no-repeat;
    position: relative;
    overflow: hidden;
    margin-bottom: 14px
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, .55), rgba(0, 0, 0, .16))
}

.hero-inner {
    position: absolute;
    inset: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    color: #fff
}

.hero-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0
}

.hero-sub {
    opacity: .95;
    margin-top: 6px
}

.hero-badges {
    position: absolute;
    left: 20px;
    bottom: 18px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 120px;
}

.hero-badge {
    background: rgba(255, 255, 255, 0.12);
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 700;
    display: inline-flex;
    gap: 8px;
    align-items: center;
    backdrop-filter: blur(6px);
    font-size: .9rem
}

.hero-badge i {
    color: #ffd54a
}

/* Tools / Toolbar */
.tools {
    position: sticky;
    top: 12px;
    z-index: 30;
    margin-bottom: 10px;
    padding: 6px 0;
    background: transparent
}

.tools-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px
}

.left-tools {
    display: flex;
    align-items: center;
    gap: 8px
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 0;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(12, 18, 30, .04);
    cursor: pointer;
    margin-right: 10px;
}

.icon-btn.active {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 10px 26px rgba(13, 110, 253, .12)
}

.search-box {
    flex: 1;
    margin: 0 12px;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 12px;
    padding: 6px 10px;
    border: 1px solid #e9eef7
}

.search-input {
    border: 0;
    outline: 0;
    padding: 6px;
    font-size: 0.95rem;
    width: 100%
}

.search-suggest {
    position: relative
}

.suggest-list {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 12px 36px rgba(2, 6, 23, .12);
    z-index: 1200;
    max-height: 300px;
    overflow: auto;
    border: 1px solid #eef2ff
}

.suggest-item {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9
}

.suggest-item:last-child {
    border-bottom: 0
}

.suggest-item:hover {
    background: #f8fafc
}

/* Filters area */
#filtersBox {
    display: none;
    background: #fff;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #e9eef7;
    margin-bottom: 12px;
    box-shadow: 0 10px 30px rgba(12, 18, 30, .04)
}

.filter-row .form-control {
    height: 42px
}

/* Map */
#mapWrapper {
    display: none;
    margin-bottom: 14px
}

#leafletMap {
    height: 420px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 12px 36px rgba(12, 18, 30, .06)
}

/* Properties grid */
.properties {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

/* 4 cols desktop, 3 tablet, 2 mobile */
.properties .card {
    flex: 0 0 calc(25% - 10px);
    max-width: calc(25% - 10px);
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(12, 18, 30, .04);
    display: flex;
    flex-direction: column;
    transition: all .18s;
}

.card:hover {
    transform: translateY(-6px)
}

.media {
    position: relative;
    height: 180px;
    overflow: hidden
}

.media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .28s
}

.card:hover .media img {
    transform: scale(1.03)
}

.fav {
    position: absolute;
    right: 10px;
    top: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, .95);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 6
}

.fav.saved {
    background: var(--brand);
    color: #fff
}

.tag-pill {
    position: absolute;
    left: 10px;
    top: 10px;
    padding: 6px 8px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    display: inline-flex;
    gap: 6px;
    align-items: center
}

.tag-small {
    font-size: .68rem;
    padding: 5px 8px
}

.tag-featured {
    background: #ffc107;
    color: #222
}

.tag-verified {
    background: #198754;
    color: #fff
}

.tag-deal {
    background: linear-gradient(90deg, #ff6b35, #ff3b2f);
    color: #fff
}

.thumbs {
    display: flex;
    gap: 6px;
    padding: 8px;
    background: linear-gradient(90deg, #f8fbff, #eef6ff)
}

.thumb {
    flex: 1;
    height: 36px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px
}

.title {
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.price {
    color: var(--brand);
    font-weight: 800
}

.meta {
    display: flex;
    gap: 8px;
    color: var(--muted);
    font-size: .9rem;
    flex-wrap: wrap
}

.loc {
    font-size: .88rem;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 8px
}

.footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px
}

.compare-wrap {
    display: flex;
    align-items: center;
    gap: 6px
}

.action-icons {
    display: flex;
    gap: 8px;
    align-items: center
}

.circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid rgba(13, 110, 253, .06);
    cursor: pointer
}

/* list view styling */
.list-view .card {
    flex: 0 0 100%;
    max-width: 100%;
    flex-direction: row;
    height: auto
}

.list-view .media {
    width: 360px;
    height: 220px;
    flex: 0 0 360px
}

.list-view .thumbs {
    flex-direction: column;
    width: 96px
}

/* responsive columns */
@media(max-width:1100px) {
    .card {
        flex: 0 0 calc(33.333% - 10px);
        max-width: calc(33.333% - 10px)
    }
}

@media(max-width:768px) {
    .card {
        flex: 0 0 calc(50% - 10px);
        max-width: calc(50% - 10px)
    }

    .hero {
        height: 240px
    }
}

@media(max-width:520px) {
    .tools-row {
        flex-direction: column;
        gap: 8px
    }

    .search-box {
        order: 2;
        width: 100%;
        margin: 6px 0
    }

    .left-tools {
        order: 1
    }

    .view-actions {
        order: 3;
        justify-content: flex-end
    }

    .card {
        flex: 0 0 calc(50% - 8px);
        max-width: calc(50% - 8px)
    }

    .media {
        height: 140px
    }

    .title {
        white-space: normal
    }

    /* allow wrap on mobile */
    .icon-btn {
        width: 40px;
        height: 40px;
    }
}