/* ============================================================
   Long-term browse — listings grid + filter chrome.
   Mirrors /rentals/list.css's flex-based override (CSS grid does
   NOT work on the table/tbody/tr structure — `display: table-*`
   wins over `display: grid` in the cascade unless overridden first).
   ============================================================ */

/* overflow:visible (with !important, in case a table default sets
   overflow:auto/hidden at higher specificity) so the card's hover
   `transform: translateY(-2px)` lift isn't clipped at the top edge —
   that clip was hiding the hovered card's top border. */
#npbnb-listing-grid { overflow: visible !important; }
#npbnb-listing-grid table {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    border: 0 !important;
}
#npbnb-listing-grid tbody {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 16px;
    width: 100%;
    background: transparent !important;
}
#npbnb-listing-grid tbody tr,
#npbnb-listing-grid tbody tr:hover {
    display: flex !important;
    background: transparent !important;
    border: 0 !important;
    flex: 0 0 100%;
    max-width: 100%;
}
/* 2 cols ≥ 768px, 3 cols ≥ 1200px */
@media (min-width: 768px) {
    #npbnb-listing-grid tbody tr,
#npbnb-listing-grid tbody tr:hover {
        flex: 0 0 calc((100% - 16px) / 2);
        max-width: calc((100% - 16px) / 2);
    }
}
@media (min-width: 1200px) {
    #npbnb-listing-grid tbody tr,
#npbnb-listing-grid tbody tr:hover {
        flex: 0 0 calc((100% - 32px) / 3);
        max-width: calc((100% - 32px) / 3);
    }
}
#npbnb-listing-grid tbody td {
    border: 0 !important;
    padding: 0 !important;
    display: block !important;
    width: 100%;
    background: transparent !important;
    /* overflow:hidden on td would clip the hovered
       card's bottom border (the translateY(-2px) lift moves it 2px past
       the td box) and its right-edge shadow. The wrappers above are
       already overflow:visible; the td must be too. */
    overflow: visible !important;
}

/* ==================== Listing card ==================== */
.rq-listing-card-grid {
    background: var(--rq-surface);
    border: 1px solid var(--bs-border-color, rgba(255,255,255,.08));
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-shadow: 0 2px 12px 0 rgba(0,0,0,0.18);
    transition: box-shadow .2s, border-color .2s, transform .2s;
    /* Establish a stacking context so :hover can lift this card above
       its flex-sibling cards. Without this, the next card in DOM order
       paints over the hovered card's shared right (and partially top)
       border — the new primary border only showed on the left/bottom
       edges that no sibling covers. */
    position: relative;
    z-index: 0;
}
.rq-listing-card-grid:hover {
    border-color: var(--bs-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px 0 rgba(0,0,0,0.28);
    /* Above all sibling cards so the full 4-side border + shadow render
       unobstructed. */
    z-index: 2;
}
.rq-listing-card-grid .rq-listing-photo {
    height: 180px;
    background: linear-gradient(135deg, var(--rq-surface-raised) 0%, var(--rq-surface-sunken) 100%);
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,.3);
    font-size: 32px;
    position: relative;
    flex-shrink: 0;
}
.rq-listing-card-grid .rq-listing-photo img { width: 100%; height: 100%; object-fit: cover; }
/*
   Favorite button — mirrors the polished /rentals card-corner heart
   (see wwwroot/css/areas/rentals/list.css) so the long-term browse and
   short-term browse share the same visual + interaction language.
   Only `position`/`top`/`right` differ from /rentals (which puts the
   heart top-left because the photo-count badge takes top-right) — on
   the long-term card there's no photo-count badge so the heart sits
   top-right where most listing platforms put it.

   The .favorited modifier + Font Awesome class swap (fa-regular ↔
   fa-solid) is driven by npbnb.rentals.favorites.js — same module
   that powers /rentals, now grid-agnostic.
*/
.rq-listing-card-grid .favorite-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(8px);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 3;
    padding: 0;
    line-height: 1;
}
.rq-listing-card-grid .favorite-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: scale(1.1);
}
.rq-listing-card-grid .favorite-btn:active {
    transform: scale(0.95);
}
.rq-listing-card-grid .favorite-btn i {
    font-size: 1rem;
    color: var(--rq-text);
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.rq-listing-card-grid .favorite-btn.favorited {
    background: rgba(255, 255, 255, 0.98);
}
.rq-listing-card-grid .favorite-btn.favorited i {
    color: var(--rq-favorite) !important;
}
.rq-listing-card-grid .favorite-btn.favorited:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.rq-listing-card-grid .rq-listing-body {
    padding: 14px 16px 16px;
    display: flex; flex-direction: column; gap: 8px;
    flex: 1;
}
.rq-listing-card-grid .rq-listing-title {
    font-size: 15px; font-weight: 600; line-height: 1.3;
    color: var(--bs-body-color);
}
.rq-listing-card-grid .rq-listing-sub {
    font-size: 12.5px; color: var(--bs-secondary-color, rgba(255,255,255,.55));
}
/* The price is the number a listing card is ABOUT, so it takes the
   money role. It used to be var(--bs-primary) — the identical colour to
   the Apply button sitting directly beneath it, which made the figure
   read as another control. */
.rq-listing-card-grid .rq-listing-price {
    font-size: 20px; font-weight: 700; color: var(--rq-money);
    font-variant-numeric: tabular-nums;
}
.rq-listing-card-grid .rq-listing-actions { display: flex; gap: 8px; margin-top: auto; }
.rq-listing-card-grid .rq-listing-actions .rq-btn { flex: 1; }

/* Toggle pills */
.rq-pill.toggle { cursor: pointer; user-select: none; }
.rq-pill.toggle.active {
    background: var(--bs-primary); color: var(--rq-on-accent); border-color: var(--bs-primary);
}

/* Phase 4: the heart is the most-tapped control on a listing card, and at
   32x32 it was the smallest target on the page. 44px is the minimum a
   thumb can hit reliably. Sized here rather than in rq-utilities.css
   because this file sets min-width/min-height explicitly and would win
   against it — better one rule that is right than two that disagree. */
@media (max-width: 767.98px) {
    .rq-listing-card-grid .favorite-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }
}
