/* Category listing pages: Villas / Bare Lands / House */
/* Same hero banner used on the All Properties page */
.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; }

.category-listing-page {
    background: #f4f7f6;
}

.category-listing-main {
    padding: 60px 0 95px;
    min-height: 100vh;
}

.category-listing-container {
    width: min(1880px, calc(100% - 48px));
    margin: 0 auto;
}

.category-top-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
    gap: 24px;
    margin-bottom: 26px;
}

.category-heading {
    grid-column: 2;
    text-align: center;
}

.category-result-count {
    grid-column: 3;
    justify-self: end;
}

.category-heading .sub-heading {
    margin-bottom: 6px;
}

.category-heading h1 {
    font-family: 'Oswald', sans-serif;
    font-size: clamp(32px, 3vw, 48px);
    line-height: 1;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

.category-heading h1 span {
    color: #f59e0b;
}

.category-result-count {
    color: #64748b;
    font-size: 14px;
    white-space: nowrap;
    margin: 0;
}

.category-result-count strong {
    color: #0f172a;
}

.category-filter-bar {
    display: grid;
    grid-template-columns: minmax(220px, 1.7fr) minmax(150px, 1fr) minmax(135px, .8fr) minmax(180px, 1.1fr) minmax(185px, 1.15fr);
    gap: 12px;
    align-items: stretch;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
    margin-bottom: 28px;
}

.category-filter-control {
    min-width: 0;
    position: relative;
}

.category-filter-control.search-control i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 14px;
    pointer-events: none;
}

.category-filter-control input[type="search"],
.category-filter-control select {
    width: 100%;
    height: 46px;
    border: 1px solid #d9e0e8;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    outline: none;
    transition: border-color .25s ease, box-shadow .25s ease;
}

.category-filter-control input[type="search"] {
    padding: 0 14px 0 42px;
}

.category-filter-control select {
    padding: 0 34px 0 13px;
    cursor: pointer;
}

.category-filter-control input:focus,
.category-filter-control select:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.09);
}

.category-price-control {
    min-width: 180px;
    height: 46px;
    border: 1px solid #d9e0e8;
    border-radius: 8px;
    padding: 5px 12px 4px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #fff;
}

.category-price-label {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 10px;
    line-height: 1;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: .3px;
    margin-bottom: 5px;
}

.category-price-label strong {
    color: #f59e0b;
    font-size: 10px;
}

.category-price-control input[type="range"] {
    width: 100%;
    accent-color: #f59e0b;
    cursor: pointer;
    height: 12px;
}

.category-property-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 18px;
}

.category-property-grid .property-card {
    min-width: 0;
}

.category-property-grid .card-image-wrapper {
    height: 185px;
}

.category-property-grid .card-content {
    padding: 16px;
}

.category-property-grid .price {
    font-size: 19px;
    line-height: 1.15;
}

.category-property-grid .title {
    font-size: 16px;
    line-height: 1.25;
    min-height: 40px;
}

.category-property-grid .location {
    min-height: 20px;
}

.category-property-grid .card-features {
    gap: 9px;
    flex-wrap: wrap;
}

.category-property-grid .tag.status-sell {
    background: #0f172a;
}

.category-property-grid .tag.status-rent {
    background: #f59e0b;
}

.category-empty-state {
    display: none;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 48px 22px;
    text-align: center;
    color: #64748b;
}

.category-empty-state i {
    display: block;
    color: #f59e0b;
    font-size: 28px;
    margin-bottom: 12px;
}

.category-empty-state h3 {
    font-family: 'Oswald', sans-serif;
    color: #0f172a;
    font-size: 22px;
    margin: 0 0 6px;
    text-transform: uppercase;
}

.category-empty-state p {
    margin: 0;
    font-size: 14px;
}

@media (max-width: 1599px) {
    /* Laptop / medium desktop: 4 property cards per row */
    .category-property-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
    .category-filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .category-filter-control:first-child { grid-column: 1 / -1; }
}

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

@media (max-width: 767px) {
    .category-listing-main { padding-top: 28px; }
    .category-listing-container { width: min(100% - 24px, 1880px); }
    .category-top-row {
        grid-template-columns: 1fr;
        align-items: start;
        gap: 8px;
    }
    .category-heading,
    .category-result-count {
        grid-column: 1;
        justify-self: center;
        text-align: center;
    }

    /* Mobile and narrow portrait tablets: 2 cards per row */
    .category-property-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
}

@media (max-width: 560px) {
    .category-listing-container { width: min(100% - 20px, 1880px); }
    .category-filter-bar { grid-template-columns: 1fr; padding: 12px; }
    .category-filter-control:first-child { grid-column: auto; }

    .category-property-grid .card-image-wrapper { height: 125px; }
    .category-property-grid .card-content { padding: 10px; }
    .category-property-grid .tag { top: 8px; left: 8px; padding: 4px 7px; font-size: 9px; letter-spacing: .5px; }
    .category-property-grid .price { font-size: 15px; margin-bottom: 4px; }
    .category-property-grid .price span { font-size: 9px; }
    .category-property-grid .title { font-size: 13px; line-height: 1.25; min-height: 33px; margin-bottom: 6px; }
    .category-property-grid .location { font-size: 10px; line-height: 1.35; min-height: 28px; margin-bottom: 8px; }
    .category-property-grid .card-features { gap: 6px; padding-bottom: 8px; margin-bottom: 8px; }
    .category-property-grid .card-features span { font-size: 9px; gap: 3px; }
    .category-property-grid .view-btn { font-size: 10px; }
}

/* --- Real Pagination: 16 properties per page --- */
.category-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 42px;
}

.category-page-link {
    width: 42px;
    height: 42px;
    display: inline-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: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.25s ease;
}

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

.category-page-link.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* 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 --- */
.category-advanced-filters {
    display: contents;
}

.category-mobile-filter-toggle,
.category-mobile-filter-header,
.mobile-location-icon,
.category-filter-overlay {
    display: none;
}

@media (max-width: 767px) {
    .category-filter-bar {
        position: sticky;
        top: calc(var(--mobile-nav-height, 76px) + 8px);
        z-index: 920;
        grid-template-columns: minmax(0, 70fr) minmax(0, 25fr) minmax(18px, 5fr);
        gap: 6px;
        padding: 8px;
        margin: 0 -2px 20px;
        border-radius: 10px;
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    }

    .category-filter-control.search-control,
    .category-filter-control.location-control {
        min-width: 0;
    }

    .category-filter-bar > .search-control {
        grid-column: auto !important;
    }

    .category-filter-control input[type="search"],
    .category-filter-control select {
        height: 42px;
        border-radius: 7px;
        font-size: 12px;
    }

    .category-filter-control.search-control i {
        left: 11px;
        font-size: 12px;
    }

    .category-filter-control input[type="search"] {
        padding-left: 32px;
        padding-right: 8px;
    }

    .category-filter-control.location-control .mobile-location-icon {
        display: block;
        position: absolute;
        left: 9px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 2;
        color: #f59e0b;
        font-size: 12px;
        pointer-events: none;
    }

    .category-filter-control.location-control 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;
    }

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

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

    .category-advanced-filters {
        display: block;
        position: fixed;
        top: var(--mobile-nav-height, 68px);
        right: -100%;
        width: min(86vw, 330px);
        height: calc(100dvh - var(--mobile-nav-height, 68px));
        padding: 22px 20px 30px;
        background: #ffffff;
        z-index: 3200;
        opacity: 1;
        filter: none;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        box-shadow: -14px 0 35px rgba(15, 23, 42, 0.18);
        overflow-y: auto;
        transition: right .32s ease;
    }

    /* Applied while JS temporarily moves the mobile drawer to <body>. */
    .category-advanced-filters.mobile-floating-filter {
        z-index: 3200;
    }

    .category-advanced-filters.active {
        right: 0;
    }

    .category-mobile-filter-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 24px;
        padding-bottom: 14px;
        border-bottom: 1px solid #e2e8f0;
    }

    .category-mobile-filter-header h3 {
        margin: 0;
        color: #0f172a;
        font-family: 'Oswald', sans-serif;
        font-size: 20px;
        letter-spacing: 1px;
    }

    .category-mobile-filter-close {
        width: 38px;
        height: 38px;
        border: 0;
        border-radius: 50%;
        background: #f1f5f9;
        color: #0f172a;
        font-size: 18px;
        cursor: pointer;
    }

    .category-advanced-filters > .category-filter-control,
    .category-advanced-filters > .category-price-control {
        display: block;
        width: 100%;
        min-width: 0;
        margin-bottom: 22px;
    }

    .category-advanced-filters > .category-filter-control::before {
        content: attr(data-mobile-label);
        display: block;
        margin-bottom: 8px;
        color: #64748b;
        font-size: 11px;
        font-weight: 600;
        letter-spacing: .5px;
        text-transform: uppercase;
    }

    .category-advanced-filters .category-filter-control select {
        height: 48px;
        font-size: 13px;
        padding-left: 13px !important;
        padding-right: 46px !important;
        background-position: right 20px center !important;
        background-size: 10px 7px !important;
    }

    .category-advanced-filters .category-price-control {
        height: auto;
        min-height: 64px;
        padding: 12px 14px;
    }

    .category-filter-overlay {
        display: block;
        position: fixed;
        top: var(--mobile-nav-height, 68px);
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 3100;
        background: rgba(15, 23, 42, .42);
        -webkit-backdrop-filter: blur(2.5px);
        backdrop-filter: blur(2.5px);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity .25s ease, visibility .25s ease;
    }

    .category-filter-overlay.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
}


/* Category hero mobile sizing */
@media (max-width: 767px) {
    .page-header { min-height: 270px; height: 32vh; }
    .page-title { margin-top: 54px; padding: 0 18px; }
    .page-title h1 { font-size: clamp(34px, 10vw, 46px); line-height: 1.08; }
    .page-title p { font-size: 14px; line-height: 1.5; }
}


/* =========================================================
   Desktop filter toolbar polish
   Compact + centered + sticky below the fixed navbar
   ========================================================= */
@media (min-width: 768px) {
    .category-listing-main {
        padding-top: 34px;
    }

    .category-top-row {
        width: min(1480px, 100%);
        margin: 0 auto 10px;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        min-height: 30px;
    }

    .category-result-count {
        grid-column: auto;
        justify-self: auto;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 7px 11px;
        border: 1px solid #e2e8f0;
        border-radius: 999px;
        background: #ffffff;
        box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
        color: #64748b;
        font-size: 12px;
        line-height: 1;
    }

    .category-filter-bar {
        position: sticky;
        top: 82px;
        z-index: 930;
        width: min(1480px, 100%);
        margin: 0 auto 30px;
        padding: 9px;
        gap: 8px;
        border: 1px solid rgba(203, 213, 225, 0.82);
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 12px 34px rgba(15, 23, 42, 0.09);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
    }

    .category-filter-control input[type="search"],
    .category-filter-control select,
    .category-price-control {
        height: 46px;
        border-color: #e2e8f0;
        border-radius: 9px;
        background-color: #f8fafc;
    }

    .category-filter-control input[type="search"]:hover,
    .category-filter-control select:hover,
    .category-price-control:hover {
        border-color: #cbd5e1;
        background-color: #ffffff;
    }

    .category-price-control {
        padding-left: 13px;
        padding-right: 13px;
    }
}

/* Keep all five desktop controls in one clean row on laptop/desktop widths. */
@media (min-width: 900px) {
    .category-filter-bar {
        grid-template-columns: minmax(220px, 1.7fr) minmax(145px, .92fr) minmax(130px, .78fr) minmax(175px, 1.05fr) minmax(165px, 1fr);
    }

    .category-filter-control:first-child {
        grid-column: auto;
    }
}

/* Mid-size portrait tablets can use two rows without crowding. */
@media (min-width: 768px) and (max-width: 899px) {
    .category-filter-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        top: 78px;
    }

    .category-filter-control:first-child {
        grid-column: 1 / -1;
    }
}


/* =========================================================
   Mobile listing width / spacing fix
   ========================================================= */
.category-listing-page,
.category-listing-main,
.category-listing-container {
    overflow-x: clip;
}

.category-property-grid,
.category-property-grid .property-card {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 767px) {
    html, body { overflow-x: hidden; }

    .category-listing-main {
        padding-top: 22px;
        padding-bottom: 62px;
    }

    .category-listing-container {
        width: min(100% - 16px, 1880px);
    }

    .category-filter-bar {
        width: 100%;
        margin: 0 0 16px;
        box-sizing: border-box;
    }

    .category-property-grid {
        width: 100%;
        gap: 10px;
    }
}

@media (max-width: 560px) {
    .category-listing-container {
        width: min(100% - 16px, 1880px);
    }

    .category-filter-bar {
        margin: 0 0 14px;
        padding: 8px;
        gap: 6px;
        border-radius: 10px;
    }

    .category-filter-control input[type="search"],
    .category-filter-control select,
    .category-mobile-filter-toggle {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .category-property-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        align-items: start;
    }

    .category-property-grid .property-card {
        overflow: hidden;
    }

    .category-property-grid .card-content {
        padding: 10px 9px;
    }
}


/* =========================================================
   Final mobile category centering + toolbar proportion fix
   ========================================================= */
@media (max-width: 767px) {
    .category-listing-container {
        width: calc(100% - 16px);
        max-width: none;
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
    }

    .category-property-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;
    }

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

    .category-filter-bar {
        width: 100%;
        max-width: 100%;
        grid-template-columns: minmax(0, 66fr) minmax(0, 24fr) minmax(38px, 10fr);
        gap: 6px;
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
    }

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

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

    .category-property-grid {
        gap: 8px;
    }
}
