/* Responsive fixes for the property list pages (/properties and /properties/premium).
   Loaded after premium-property-list.css (+ listing-index.css). Every rule sits inside a
   max-width media query so the approved desktop layout (>= 1200px) is untouched. */

/* ---- Below desktop: let grid items shrink, make card images fill their frame ---- */
@media (max-width: 1199px) {
    .ppl-listings-area,
    .ppl-cards-grid > * { min-width: 0 !important; }

    .ppl-card-image .property-image-wrapper {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
    }

    .ppl-card-title,
    .ppl-card-location { overflow-wrap: anywhere; }

    /* Min/Max inputs side by side must not push past the sidebar edge */
    .ppl-range-inputs { display: flex !important; gap: 10px !important; }
    .ppl-range-input { min-width: 0 !important; width: 100% !important; }
}

/* ---- Tablet / small laptop with the sidebar beside the cards: 2 cards per row ---- */
@media (min-width: 769px) and (max-width: 1199px) {
    .ppl-main { grid-template-columns: 270px minmax(0, 1fr) !important; gap: 18px !important; }
    .ppl-filter-sidebar { min-width: 0 !important; }
    .ppl-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    /* Drawer close (x) is useless beside the inline sidebar and was covering "Clear All" (premium) */
    .ppl-filter-close { display: none !important; }
    .ppl-filter-header { padding-right: 0 !important; }
}

/* ---- Large phones / portrait tablets (drawer layout): 2 cards per row ---- */
@media (min-width: 577px) and (max-width: 768px) {
    .ppl-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .ppl-card-image { height: 180px !important; }
}

/* ---- Phones + portrait tablets: filter drawer, sort bar, titles ---- */
@media (max-width: 768px) {
    /* cp-responsive.css forces every checkbox visible on phones; the filters use a styled span */
    .ppl-filter-option input[type="checkbox"],
    .ppl-filter-option input[type="radio"] { display: none !important; }
    .ppl-filter-option { min-height: 44px !important; }

    /* 16px controls stop iOS zooming in on focus */
    .ppl-filter-sidebar input,
    .ppl-filter-sidebar select,
    .ppl-sort-select {
        font-size: 16px !important;
        min-height: 44px !important;
    }
    .ppl-sort-select { min-width: 0 !important; }
    .ppl-apply-btn { min-height: 48px !important; }

    /* Drawer: never taller than the visible viewport (mobile browser bars) */
    .ppl-filter-sidebar {
        height: 85vh !important;
        height: 85dvh !important;
        max-height: 85dvh !important;
        overscroll-behavior: contain;
    }

    .ppl-page-title h2,
    .page-title h2 {
        font-size: clamp(22px, 6.2vw, 28px) !important;
        line-height: 1.2 !important;
        overflow-wrap: anywhere;
    }
    .ppl-page-title { padding: 16px !important; }

    .ppl-quick-pill { min-height: 40px; display: inline-flex; align-items: center; }

    .ppl-card-btn { min-height: 44px !important; }
}

/* ---- Small phones ---- */
@media (max-width: 400px) {
    .ppl-container { padding: 0 12px !important; }
    .ppl-header-section { padding: 14px !important; }
    .ppl-card-content { padding: 14px !important; }
    .ppl-card-details { flex-wrap: wrap !important; gap: 10px !important; }
}

/* The /properties drawer close button only exists for the phone drawer */
@media (min-width: 769px) {
    .ppl-close-index { display: none !important; }
}

/* Desktop bug fixes (legacy): Min/Max inputs poked past the sidebar edge, and on premium
   the drawer close (x) sat on top of "Clear All" beside the inline sidebar. */
@media (min-width: 1200px) {
    .ppl-range-inputs { display: flex !important; gap: 10px !important; }
    .ppl-range-input { min-width: 0 !important; width: 100% !important; }
    .ppl-filter-close { display: none !important; }
    .ppl-filter-header { padding-right: 0 !important; }
}
