/* Best Property Plug V15.3 — coordinated phone/tablet polish */

@media (max-width: 991px) {
    .flat-section,
    .flat-section-v2,
    .flat-section-v3,
    .flat-section-v4,
    .flat-section-v5,
    .flat-section-v6 {
        padding-top: 42px !important;
        padding-bottom: 42px !important;
    }

    .property-card-grid {
        --bs-gutter-x: 16px;
        --bs-gutter-y: 18px;
    }

    .property-item.homeya-box {
        overflow: hidden;
        border: 1px solid #e5e9ec;
        border-radius: 13px !important;
        box-shadow: 0 6px 20px rgba(22, 30, 45, .07) !important;
    }

    .property-contact-actions {
        gap: 8px !important;
        padding: 10px 12px 12px !important;
    }

    .property-contact-actions > a,
    .property-contact-actions > button {
        min-height: 42px !important;
    }

    .widget-filter-search {
        border: 1px solid #e4e8eb;
        border-radius: 13px !important;
        box-shadow: 0 5px 18px rgba(22, 30, 45, .05);
    }
}

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

    .container,
    .container-fluid {
        padding-right: 14px;
        padding-left: 14px;
    }

    .flat-section,
    .flat-section-v2,
    .flat-section-v3,
    .flat-section-v4,
    .flat-section-v5,
    .flat-section-v6 {
        padding-top: 30px !important;
        padding-bottom: 30px !important;
    }

    .box-title,
    .shortcode-heading {
        margin-bottom: 18px !important;
    }

    .section-title,
    .box-title .title {
        font-size: 25px !important;
        line-height: 1.25 !important;
    }

    /* Listing and homepage cards */
    .property-card-grid > .col,
    .flat-recommended .property-card-grid > .col {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }

    .property-item .images-style {
        min-height: 0 !important;
        aspect-ratio: 16 / 10 !important;
    }

    .property-item .content {
        padding: 14px !important;
    }

    .property-item .content > .text-capitalize,
    .property-item .content > .h7,
    .property-item .content .link {
        min-height: auto !important;
        font-size: 17px !important;
        line-height: 1.35 !important;
    }

    .property-item .content .desc {
        min-height: auto !important;
        margin-top: 7px;
        font-size: 13px !important;
        line-height: 1.45 !important;
    }

    .property-item .content .meta-list {
        min-height: auto !important;
        flex-wrap: wrap;
        gap: 8px 14px !important;
        margin-top: 10px;
    }

    .property-item > .archive-bottom {
        grid-template-columns: minmax(0, 1fr) auto !important;
        gap: 8px !important;
        padding: 11px 14px !important;
    }

    .property-card-price {
        margin-left: 0 !important;
        text-align: right !important;
    }

    .property-card-price .h6,
    .property-card-price .h7 {
        font-size: 14px !important;
        line-height: 1.25 !important;
    }

    .property-author-name {
        max-width: 105px;
    }

    /* Keep filter controls readable and tappable. */
    .widget-filter-search {
        padding: 14px !important;
        margin-bottom: 18px;
    }

    .widget-filter-search .form-control,
    .widget-filter-search .nice-select,
    .widget-filter-search .tf-btn {
        min-height: 48px !important;
        font-size: 16px !important;
    }

    /* Property detail related carousel: native horizontal scrolling avoids collapsed Swiper slides. */
    .rpg-property-detail-page .flat-latest-property {
        min-height: 0 !important;
        padding-bottom: 24px !important;
    }

    .rpg-property-detail-page .tf-latest-property {
        width: 100% !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    .rpg-property-detail-page .tf-latest-property::-webkit-scrollbar {
        display: none;
    }

    .rpg-property-detail-page .tf-latest-property .swiper-wrapper {
        width: max-content !important;
        height: auto !important;
        display: flex !important;
        gap: 12px !important;
        transform: none !important;
    }

    .rpg-property-detail-page .tf-latest-property .swiper-slide {
        width: calc(100vw - 52px) !important;
        min-width: calc(100vw - 52px) !important;
        max-width: 360px !important;
        height: auto !important;
        flex: 0 0 calc(100vw - 52px) !important;
        scroll-snap-align: start;
    }

    .rpg-property-detail-page .tf-latest-property .property-item {
        height: 100% !important;
    }

    /* Homepage sections use consistent rhythm and no artificial empty height. */
    .flat-recommended,
    .flat-location,
    .flat-service,
    .flat-benefit,
    .flat-property,
    .flat-agents,
    .flat-latest-new,
    .flat-latest-new-v2 {
        min-height: 0 !important;
    }

    .flat-recommended .nav-tab-recommended {
        max-width: 100%;
        justify-content: flex-start !important;
        overflow-x: auto;
        padding-bottom: 5px;
        white-space: nowrap;
        scrollbar-width: none;
    }

    .flat-recommended .nav-tab-recommended::-webkit-scrollbar {
        display: none;
    }

    .flat-agents .row > .box {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        margin-bottom: 18px !important;
    }

    .flat-agents .box-agent {
        display: grid;
        grid-template-columns: 96px minmax(0, 1fr);
        gap: 14px;
        align-items: center;
        padding: 12px;
        border: 1px solid #e5e9ec;
        border-radius: 12px;
        background: #fff;
    }

    .flat-agents .box-agent .box-img {
        width: 96px !important;
        height: 96px !important;
        margin: 0 !important;
    }

    .flat-agents .box-agent .content {
        min-width: 0;
    }

    .flat-location .swiper-slide,
    .flat-latest-new .swiper-slide,
    .flat-latest-new-v2 .swiper-slide {
        height: auto !important;
    }
}

@media (max-width: 380px) {
    .property-item > .archive-bottom {
        grid-template-columns: 1fr !important;
    }

    .property-card-price {
        text-align: left !important;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .property-card-grid > .col {
        width: 50% !important;
        max-width: 50% !important;
        flex: 0 0 50% !important;
    }

    .rpg-property-detail-page .tf-latest-property .swiper-slide {
        width: calc(50% - 10px) !important;
        min-width: calc(50% - 10px) !important;
        flex: 0 0 calc(50% - 10px) !important;
    }
}
