
/*
 * BestPropertyPlug — Projects Search Mobile Card Polish V3.8.3
 *
 * Builds on V3.8.2:
 * - Phone: keep exactly 2 project cards per row
 * - Tablet portrait: 2 columns
 * - Tablet landscape: 3 columns
 * - Move responsive CTA to image as "View Details →"
 * - Give price range a full-width row
 * - Make metrics more compact and readable
 * - Normalize card heights
 * - Keep desktop >= 1200px unchanged
 */

/* =========================================================
   SHARED RESPONSIVE CARD POLISH
   ========================================================= */
@media (max-width: 1199px) {
    html body .bppp2-grid {
        align-items: stretch !important;
    }

    html body .bppp2-grid > *,
    html body .bppp2-grid .bppp2-card {
        min-width: 0 !important;
    }

    html body .bppp2-grid .bppp2-card {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        overflow: hidden !important;
    }

    html body .bppp2-card [data-bpp-v383-media="1"] {
        position: relative !important;
        display: block !important;
        overflow: hidden !important;
    }

    html body .bppp2-card [data-bpp-v383-media="1"] img {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
    }

    /* Overlay action copied from the approved Developer Available Units cards. */
    html body .bppp2-card .bpp-v383-view-details {
        position: absolute !important;
        right: 9px !important;
        bottom: 9px !important;
        z-index: 8 !important;

        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 5px !important;

        min-height: 30px !important;
        padding: 7px 10px !important;

        border: 1px solid rgba(255, 255, 255, .80) !important;
        border-radius: 999px !important;

        background: rgba(255, 255, 255, .95) !important;
        color: #087848 !important;

        font: inherit !important;
        font-size: 9px !important;
        line-height: 1 !important;
        font-weight: 800 !important;
        letter-spacing: .01em !important;
        white-space: nowrap !important;

        box-shadow: 0 7px 20px rgba(8, 44, 30, .16) !important;
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
    }

    html body .bppp2-card .bpp-v383-view-details::after {
        content: "→" !important;
        font-size: 11px !important;
        line-height: 1 !important;
    }

    /* Hide original lower CTA only where JS successfully installed the overlay. */
    html body .bppp2-card.bpp-v383-card-ready > .bppp2-view-project,
    html body .bppp2-card.bpp-v383-card-ready .bppp2-view-project {
        display: none !important;
    }

    /* Keep inner card content flexible so price can sit cleanly at the bottom. */
    html body .bppp2-card.bpp-v383-card-ready > :not([data-bpp-v383-media="1"]) {
        min-width: 0 !important;
    }

    /* Metrics: three equal compact columns instead of cramped mixed wrapping. */
    html body .bppp2-card .bppp2-stats,
    html body .bppp2-card .bppp2-meta,
    html body .bppp2-card [class*="stats"] {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        align-items: center !important;
        gap: 4px !important;
        width: auto !important;
    }

    html body .bppp2-card .bppp2-stats > *,
    html body .bppp2-card .bppp2-meta > *,
    html body .bppp2-card [class*="stats"] > * {
        min-width: 0 !important;
        text-align: center !important;
    }

    /* Price gets its own full-width footer row. */
    html body .bppp2-card .bppp2-price {
        display: block !important;
        width: auto !important;
        min-width: 0 !important;
        clear: both !important;
    }

    html body .bppp2-card .bppp2-price small,
    html body .bppp2-card .bppp2-price strong {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    html body .bppp2-card .bppp2-price strong {
        overflow: visible !important;
        text-overflow: clip !important;
        white-space: normal !important;
        word-break: normal !important;
    }
}

/* =========================================================
   MOBILE <= 767px — EXACT 2 COL + COMPACT PREMIUM CARD
   ========================================================= */
@media (max-width: 767px) {
    html body .bppp2-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-auto-flow: row !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    html body .bppp2-grid > *,
    html body .bppp2-grid > .bppp2-card,
    html body .bppp2-grid > * > .bppp2-card {
        grid-column: auto !important;
        grid-row: auto !important;
        grid-area: auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        margin: 0 !important;
        flex: none !important;
    }

    html body .bppp2-grid .bppp2-card {
        width: 100% !important;
        border-radius: 12px !important;
        border: 1px solid #dbe8e1 !important;
        background: #fff !important;
        box-shadow: 0 6px 16px rgba(10, 62, 42, .055) !important;
    }

    html body .bppp2-card [data-bpp-v383-media="1"] {
        width: 100% !important;
        height: 126px !important;
        min-height: 126px !important;
        max-height: 126px !important;
    }

    html body .bppp2-card h3,
    html body .bppp2-card h4,
    html body .bppp2-card .bppp2-title {
        display: -webkit-box !important;
        -webkit-box-orient: vertical !important;
        -webkit-line-clamp: 2 !important;
        overflow: hidden !important;
        min-height: 29px !important;
        max-height: 30px !important;
        margin: 8px 8px 4px !important;
        font-size: 10.5px !important;
        line-height: 1.38 !important;
        font-weight: 800 !important;
    }

    html body .bppp2-card .bppp2-location,
    html body .bppp2-card [class*="location"] {
        display: block !important;
        overflow: hidden !important;
        margin: 0 8px 6px !important;
        font-size: 8.5px !important;
        line-height: 1.2 !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    html body .bppp2-card .bppp2-stats,
    html body .bppp2-card .bppp2-meta,
    html body .bppp2-card [class*="stats"] {
        margin: 0 8px 6px !important;
        padding: 6px 4px !important;
        border-radius: 8px !important;
        font-size: 7.5px !important;
        line-height: 1.08 !important;
    }

    html body .bppp2-card .bppp2-completion,
    html body .bppp2-card [class*="completion"] {
        margin: 5px 8px 0 !important;
        font-size: 8px !important;
        line-height: 1.15 !important;
    }

    html body .bppp2-card .bppp2-price {
        margin: auto 8px 8px !important;
        padding-top: 7px !important;
        border-top: 1px solid #edf3f0 !important;
    }

    html body .bppp2-card .bppp2-price small {
        margin-bottom: 3px !important;
        color: #7e8d85 !important;
        font-size: 7.5px !important;
        line-height: 1.1 !important;
        font-weight: 600 !important;
    }

    html body .bppp2-card .bppp2-price strong {
        color: #17362b !important;
        font-size: 8.25px !important;
        line-height: 1.25 !important;
        font-weight: 800 !important;
    }

    html body .bppp2-card .bpp-v383-view-details {
        right: 7px !important;
        bottom: 7px !important;
        min-height: 27px !important;
        padding: 6px 8px !important;
        font-size: 8px !important;
        gap: 4px !important;
    }

    html body .bppp2-card .bpp-v383-view-details::after {
        font-size: 9px !important;
    }

    /* Compact badges/wishlist on half-width cards. */
    html body .bppp2-card [class*="featured"],
    html body .bppp2-card [class*="badge"],
    html body .bppp2-card [class*="category"] {
        font-size: 7px !important;
        line-height: 1 !important;
    }

    html body .bppp2-card [class*="wishlist"],
    html body .bppp2-card [class*="favorite"],
    html body .bppp2-card [class*="heart"] {
        transform: scale(.78) !important;
        transform-origin: top right !important;
    }

    /* Bottom pagination stays above global floating nav. */
    html body .bppp2-pagination,
    html body .bppp2-grid + .pagination,
    html body .pagination {
        margin-bottom: 100px !important;
    }
}

/* Narrow phones remain 2 columns. */
@media (max-width: 390px) {
    html body .bppp2-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 7px !important;
    }

    html body .bppp2-card [data-bpp-v383-media="1"] {
        height: 112px !important;
        min-height: 112px !important;
        max-height: 112px !important;
    }

    html body .bppp2-card h3,
    html body .bppp2-card h4,
    html body .bppp2-card .bppp2-title {
        min-height: 27px !important;
        max-height: 28px !important;
        font-size: 9.8px !important;
    }

    html body .bppp2-card .bppp2-price strong {
        font-size: 7.8px !important;
    }

    html body .bppp2-card .bpp-v383-view-details {
        min-height: 25px !important;
        padding: 5px 7px !important;
        font-size: 7.5px !important;
    }
}

/* =========================================================
   TABLET PORTRAIT 768–1023px — 2 COLUMNS
   ========================================================= */
@media (min-width: 768px) and (max-width: 1023px) {
    html body .bppp2-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 14px !important;
    }

    html body .bppp2-grid > *,
    html body .bppp2-grid .bppp2-card {
        grid-column: auto !important;
        grid-row: auto !important;
        grid-area: auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    html body .bppp2-grid .bppp2-card {
        width: 100% !important;
        border-radius: 15px !important;
    }

    html body .bppp2-card [data-bpp-v383-media="1"] {
        height: 205px !important;
        min-height: 205px !important;
    }

    html body .bppp2-card h3,
    html body .bppp2-card h4,
    html body .bppp2-card .bppp2-title {
        -webkit-line-clamp: 2 !important;
        min-height: 38px !important;
        font-size: 14px !important;
        line-height: 1.35 !important;
    }

    html body .bppp2-card .bppp2-stats,
    html body .bppp2-card .bppp2-meta,
    html body .bppp2-card [class*="stats"] {
        font-size: 9.5px !important;
    }

    html body .bppp2-card .bppp2-price strong {
        font-size: 11px !important;
        line-height: 1.3 !important;
    }

    html body .bppp2-card .bpp-v383-view-details {
        min-height: 32px !important;
        padding: 7px 10px !important;
        font-size: 9.5px !important;
    }
}

/* =========================================================
   TABLET LANDSCAPE 1024–1199px — 3 COLUMNS
   ========================================================= */
@media (min-width: 1024px) and (max-width: 1199px) {
    html body .bppp2-grid {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 12px !important;
    }

    html body .bppp2-grid > *,
    html body .bppp2-grid .bppp2-card {
        grid-column: auto !important;
        grid-row: auto !important;
        grid-area: auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    html body .bppp2-grid .bppp2-card {
        width: 100% !important;
        border-radius: 14px !important;
    }

    html body .bppp2-card [data-bpp-v383-media="1"] {
        height: 175px !important;
        min-height: 175px !important;
    }

    html body .bppp2-card h3,
    html body .bppp2-card h4,
    html body .bppp2-card .bppp2-title {
        -webkit-line-clamp: 2 !important;
        min-height: 34px !important;
        font-size: 12.5px !important;
        line-height: 1.35 !important;
    }

    html body .bppp2-card .bppp2-price strong {
        font-size: 10px !important;
    }
}

/* >=1200px intentionally untouched. */
