/* --- Properties Page Specific Styles --- */

/* Page Header */
.page-header {
    height: 35vh; 
    min-height: 300px;
    background-image: url('https://images.unsplash.com/photo-1613490908574-1706b6fbcaf2?q=80&w=2000&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
}

.page-title {
    position: relative;
    z-index: 2;
    text-align: center;
    color: #ffffff;
    margin-top: 60px;
}

.page-title h1 {
    font-family: 'Oswald', sans-serif;
    font-size: 50px;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.page-title h1 span { color: #f59e0b; }
.page-title p { font-size: 18px; color: #cbd5e1; }

/* Listing Section Layout (Full Width) */
.listing-section {
    padding: 60px 0 100px 0;
    background-color: #f4f7f6;
}

.listing-container-full {
    max-width: 1800px; /* Increased to allow full width for 4 columns */
    margin: 0 auto;
    padding: 0 40px;
    display: grid;
    grid-template-columns: 320px 1fr; /* 320px sidebar, rest is content */
    gap: 40px;
    align-items: start;
}

/* --- Sidebar Filters --- */
.filter-sidebar {
    background: #ffffff;
    padding: 30px 25px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
    border: 1px solid #e2e8f0;
    position: sticky;
    top: 100px; 
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f5f9;
}

.filter-header h3 {
    font-family: 'Oswald', sans-serif;
    font-size: 20px;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 1px;
}

.filter-header h3 i { color: #f59e0b; }
.close-filter { display: none; font-size: 24px; cursor: pointer; color: #0f172a; }

.filter-group { margin-bottom: 25px; }

.filter-group label {
    display: block;
    font-family: 'Oswald', sans-serif;
    font-size: 14px;
    color: #475569;
    margin-bottom: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.filter-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    color: #475569;
    outline: none;
    background: #ffffff;
    cursor: pointer;
}

/* Checkboxes */
.checkbox-group { display: flex; flex-direction: column; gap: 12px; }
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    color: #475569;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    margin-bottom: 0;
}
.checkbox-group input[type="checkbox"] {
    width: 18px; 
    height: 18px;
    accent-color: #f59e0b;
    cursor: pointer;
}

/* Price Slider */
.price-slider {
    width: 100%;
    accent-color: #f59e0b;
    cursor: pointer;
    margin-top: 5px;
}
#priceValue { color: #f59e0b; font-weight: 600; }

.apply-filter-btn {
    width: 100%;
    font-family: 'Oswald', sans-serif;
    background: #0f172a; 
    color: #ffffff;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.3s, transform 0.3s;
    margin-top: 10px;
}
.apply-filter-btn:hover { 
    background: #f59e0b; 
    transform: translateY(-2px);
}

/* --- Right Side: Results Info Bar --- */
.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: #ffffff;
    padding: 18px 25px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.02);
    border: 1px solid #e2e8f0;
}

.results-info p { color: #64748b; font-size: 15px; margin: 0; }
.results-info p strong { color: #0f172a; }

.sort-by { display: flex; align-items: center; gap: 12px; }
.sort-by label { font-size: 14px; color: #475569; font-weight: 500; }
.sort-by select {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    color: #0f172a;
    outline: none;
    background: #fff;
    cursor: pointer;
}

/* --- Properties Grid for this page (4 Columns) --- */
.properties-page-grid {
    grid-template-columns: repeat(4, 1fr); /* Changed to 4 columns */
    gap: 25px; /* Slightly reduced gap to fit 4 cards nicely */
}

/* Make card images slightly shorter on 4-column layout so they don't look too stretched */
.properties-page-grid .card-image-wrapper {
    height: 200px;
}

/* Reduce card padding slightly to fit 4 columns */
.properties-page-grid .card-content {
    padding: 18px;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 50px;
}

.page-link {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #0f172a;
    font-family: 'Oswald', sans-serif;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.page-link.active, .page-link:hover {
    background: #f59e0b;
    color: #ffffff;
    border-color: #f59e0b;
}

/* --- Mobile Filter Button (Hidden on PC) --- */
.mobile-filter-btn {
    display: none;
    width: 100%;
    font-family: 'Oswald', sans-serif;
    background: #f59e0b;
    color: #fff;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    letter-spacing: 1px;
    margin-bottom: 25px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(245, 158, 11, 0.2);
}

/* --- Responsiveness for Properties Page --- */
/* Desktop and laptops keep 4 columns. On tablet widths the sidebar becomes a slide-in filter
   so the property area can stay wide enough for 4/3/2 responsive columns. */
@media (max-width: 1199px) {
    .listing-container-full {
        grid-template-columns: 1fr;
        padding: 0 24px;
    }

    .mobile-filter-btn { display: block; }

    .filter-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 320px;
        height: 100vh;
        z-index: 2000;
        border-radius: 0;
        overflow-y: auto;
        transition: left 0.4s ease;
    }

    .filter-sidebar.active { left: 0; }
    .close-filter { display: block; }
    .results-info { flex-direction: column; gap: 15px; align-items: flex-start; }
}

@media (max-width: 1023px) {
    /* Tablet portrait: 3 cards per row */
    .properties-page-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
    .listing-container-full { padding: 0 12px; }

    /* Mobile / narrow portrait: 2 cards per row */
    .properties-page-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        overflow-x: visible;
        scroll-snap-type: none;
    }
}

@media (max-width: 600px) {
    .listing-container-full { padding: 0 10px; }
    .properties-page-grid .property-card { min-width: 0; flex: none; }
    .properties-page-grid .card-image-wrapper { height: 125px; }
    .properties-page-grid .card-content { padding: 10px; }
    .properties-page-grid .tag { top: 8px; left: 8px; padding: 4px 7px; font-size: 9px; letter-spacing: .5px; }
    .properties-page-grid .price { font-size: 15px; margin-bottom: 4px; }
    .properties-page-grid .price span { font-size: 9px; }
    .properties-page-grid .title { font-size: 13px; line-height: 1.25; min-height: 33px; margin-bottom: 6px; }
    .properties-page-grid .location { font-size: 10px; line-height: 1.35; min-height: 28px; margin-bottom: 8px; }
    .properties-page-grid .card-features { gap: 6px; padding-bottom: 8px; margin-bottom: 8px; flex-wrap: wrap; }
    .properties-page-grid .card-features span { font-size: 9px; gap: 3px; }
    .properties-page-grid .view-btn { font-size: 10px; }
}

/* Consistent select arrow spacing across the site */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23334155' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 20px center !important;
    background-size: 10px 7px !important;
    padding-right: 46px !important;
}



/* --- Mobile sticky quick search: Search / Location / Filter --- */
.mobile-listing-toolbar {
    display: none;
}

@media (max-width: 767px) {
    .mobile-listing-toolbar {
        position: sticky;
        top: calc(var(--mobile-nav-height, 76px) + 8px);
        z-index: 920;
        display: grid;
        grid-template-columns: minmax(0, 70fr) minmax(0, 25fr) minmax(18px, 5fr);
        gap: 6px;
        width: calc(100% - 20px);
        margin: 0 auto 18px;
        padding: 8px;
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    }

    .mobile-toolbar-search,
    .mobile-toolbar-location {
        position: relative;
        min-width: 0;
    }

    .mobile-toolbar-search i,
    .mobile-toolbar-location i {
        position: absolute;
        left: 10px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 2;
        pointer-events: none;
        font-size: 12px;
    }

    .mobile-toolbar-search i { color: #94a3b8; }
    .mobile-toolbar-location i { color: #f59e0b; }

    .mobile-toolbar-search input,
    .mobile-toolbar-location select {
        width: 100%;
        height: 42px;
        min-width: 0;
        border: 1px solid #d9e0e8;
        border-radius: 7px;
        background-color: #fff;
        color: #334155;
        font-family: 'Poppins', sans-serif;
        outline: none;
    }

    .mobile-toolbar-search input {
        padding: 0 8px 0 32px;
        font-size: 12px;
    }

    .mobile-toolbar-location select {
        padding-left: 27px !important;
        padding-right: 22px !important;
        background-position: right 16px center !important;
        background-size: 8px 6px !important;
        font-size: 10px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-toolbar-filter {
        display: inline-flex;
        width: 100%;
        min-width: 18px;
        height: 42px;
        padding: 0;
        margin: 0;
        align-items: center;
        justify-content: center;
        border: 0;
        border-radius: 6px;
        background: #0f172a;
        color: #fff;
        font-size: 11px;
        cursor: pointer;
    }

    .mobile-toolbar-filter:active { transform: scale(.97); }

    .mobile-filter-btn { display: none !important; }

    .results-info {
        display: none;
    }

    .filter-sidebar {
        width: min(88vw, 340px);
        z-index: 2300;
    }

    .listing-section {
        padding-top: 18px;
    }
}


/* =========================================================
   Final mobile listing centering + toolbar proportion fix
   ========================================================= */
@media (max-width: 767px) {
    .listing-section {
        width: 100%;
        overflow-x: hidden;
    }

    .listing-container-full {
        width: calc(100% - 16px);
        max-width: none;
        margin-left: auto;
        margin-right: auto;
        padding-left: 0;
        padding-right: 0;
        box-sizing: border-box;
    }

    .properties-content {
        width: 100%;
        min-width: 0;
        margin: 0 auto;
    }

    .properties-page-grid {
        width: 100%;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-content: center;
        gap: 10px;
        box-sizing: border-box;
    }

    .properties-page-grid .property-card {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin: 0;
        box-sizing: border-box;
    }

    .mobile-listing-toolbar {
        width: calc(100% - 16px);
        max-width: none;
        grid-template-columns: minmax(0, 66fr) minmax(0, 24fr) minmax(38px, 10fr);
        gap: 6px;
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
    }

    .mobile-toolbar-filter {
        min-width: 38px;
        border-radius: 7px;
        font-size: 13px;
    }
}

@media (max-width: 430px) {
    .listing-container-full,
    .mobile-listing-toolbar {
        width: calc(100% - 16px);
    }

    .properties-page-grid {
        gap: 8px;
    }
}
