:root {
    --color-primary: #fff;
    --color-secondary: #222222ff;
    --color-comp: #2851cbff;
    --font-primary: sans-serif;
    --color-headerhover: #7f7f7fff;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    outline: none;
    border: none;
    text-decoration: none;
    text-transform: capitalize;
    transition: all .2s linear;
    font-family: 'Poppins', sans-serif;
}

html {
    overflow-x: hidden;
    scroll-behavior: smooth;
    scroll-padding-top: 7rem;
    font-size: 62.5%;
}

.listing-controls {
    padding: 2rem 5%;
    background: var(--color-primary);
    border-bottom: 1px solid #eee;
    border-radius: 1rem;
    margin-top: 9rem;
}

/* Header & Toggle */
.controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.controls-header h2 {
    font-size: 1.8rem;
    color: var(--color-secondary);
    font-weight: 600;
}

.view-toggle {
    display: flex;
    gap: 1rem;
}

.toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    background: #f5f5f5;
    border-radius: 2rem;
    border: 1px solid #ddd;
    font-size: 1.4rem;
    color: #333;
    cursor: pointer;
}

.toggle-btn.active {
    background: var(--color-comp);
    color: #fff;
    border-color: var(--color-comp);
}

/* Filters Card */
.filters-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    background: #fff;
    padding: 2rem;
    border-radius: 1.2rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.filter-item label {
    font-weight: 600;
    font-size: 1.4rem;
    color: #333;
}

.filter-item select {
    border: 1px solid #ddd;
    padding: 0.8rem 1rem;
    border-radius: 0.6rem;
    font-size: 1.4rem;
    background: #fafafa;
}

/* Price Slider */
.price-slider input[type="range"] {
    width: 100%;
    cursor: pointer;
}

.price-slider p {
    font-size: 1.3rem;
    color: #444;
    margin-top: 0.5rem;
}

.bed-options {
    display: flex;
    gap: 0.8rem;
}

.bed-btn {
    padding: 0.7rem 1.2rem;
    border: 1px solid #ccc;
    background: #fafafa;
    border-radius: 0.6rem;
    cursor: pointer;
    font-size: 1.3rem;
}

.bed-btn.active {
    background: var(--color-comp);
    color: #fff;
    border-color: var(--color-comp);
}

/* Base Section */
.listing-grid-section {
    padding: 3rem 5%;
    background: #fafafa;
    transition: all 0.3s ease;
}

/* Default (Grid View) */
.listing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 3rem;
    transition: all 0.3s ease;
}

/* LIST VIEW MODE */
.listing-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Listing Card */
.listing-card {
    background: #fff;
    border-radius: 1.2rem;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

/* LIST VIEW CARD LAYOUT */
.listing-grid.list-view .listing-card {
    flex-direction: row;
    align-items: stretch;
    height: 220px;
}

/* Image Section */
.card-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    flex-shrink: 0;
}

.listing-grid.list-view .card-image {
    width: 40%;
    height: 100%;
}

/* Image Carousel */
.carousel img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    transition: opacity 0.4s ease;
}

.carousel img.active {
    display: block;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 2.8rem;
    height: 2.8rem;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.carousel-btn.prev {
    left: 10px;
}

.carousel-btn.next {
    right: 10px;
}

.card-image:hover .carousel-btn {
    display: flex;
}

/* Wishlist Button */
.wishlist {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #fff;
    border-radius: 50%;
    padding: 0.8rem;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: background 0.3s, color 0.3s;
}

.wishlist:hover {
    background: var(--color-comp);
    color: #fff;
}

/* Card Content */
.card-content {
    padding: 1.6rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
}

/* LIST VIEW: adjust padding and spacing */
.listing-grid.list-view .card-content {
    padding: 1.5rem 2rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.6rem;
    color: #222;
    font-weight: 600;
}

.property-type {
    background: #f0f0f0;
    color: #555;
    font-size: 1.1rem;
    padding: 0.3rem 0.8rem;
    border-radius: 1rem;
    text-transform: uppercase;
}

.card-price {
    margin: 1rem 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-comp);
}

.card-price span {
    font-size: 1.3rem;
    font-weight: 400;
    color: #777;
}

.card-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-size: 1.3rem;
    color: #555;
}

.card-metrics i {
    color: var(--color-comp);
    margin-right: 0.5rem;
}

/* LIST VIEW METRICS: slightly smaller */
.listing-grid.list-view .card-metrics {
    gap: 1rem;
    font-size: 1.2rem;
}

/* Hover effects */
.listing-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.no-results {
    text-align: center;
    margin-top: 8rem;
}

.no-results img {
    width: 180px;
    opacity: 0.8;
}

.no-results h3 {
    font-size: 2rem;
    margin: 1rem auto;
}

@media (max-width: 768px) {
    html {
        font-size: 55%;
    }

    .controls-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .filters-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 460px) {
    html {
        font-size: 45%;
    }
}

@media (max-width: 360px) {
    html {
        font-size: 35%;
    }
}