/***
Pers theme - listing card (grid + list)

Row classes set by search.php / loop.php:
  .listing-grid  -> Grid view  (3 per row)
  .listing-list  -> List view  (full width, horizontal card)
  .premium-list  -> Premium block, always a 3-column grid at the top

Equal-height cards by construction: fixed-ratio media, 2-line title
clamp and a 2-line price reservation, so a missing photo or a
wrapping "Check with seller" cannot change card height.

Accents use the theme's .sclr / .clr classes so the backoffice
colour pickers keep working.
***/

.listing-card { margin-bottom: 24px; display: flex; float: left; }
.listing-card > .pers-card { width: 100%; }

.listing-card .pers-card {
    position: relative;
    background: #fff;
    border: 1px solid #e8ebf0;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.listing-card .pers-card:hover {
    box-shadow: 0 6px 18px rgba(16,24,40,.10);
    transform: translateY(-2px);
    border-color: #dfe4ec;
}
/* premium gets the gold outline from the design */
.listing-card.premium .pers-card { border-color: #f0c14b; }

.listing-card .pers-card-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ---------- media ---------- */
.listing-card .pers-card-media {
    position: relative;
    width: 100%;
    padding-bottom: 75%;
    overflow: hidden;
    background: #f3f5f8;
    flex: none;
}
.listing-card .pers-card-media > a {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: block;
}
.listing-card .pers-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ---------- badges ---------- */
.listing-card .pers-badge {
    position: absolute;
    left: 10px;
    bottom: 10px;
    z-index: 2;
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
    max-width: calc(100% - 20px);
    overflow: hidden;
    text-overflow: ellipsis;
}
.listing-card .pers-badge-cat { background: rgba(17,24,39,.78); color: #fff; }
.listing-card .pers-badge-premium { background: #f5a623; color: #fff; top: 10px; bottom: auto; }
.listing-card .pers-badge-premium .fa { margin-right: 3px; }

/* ---------- favourite ---------- */
.listing-card .pers-card-fav {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,.94);
    box-shadow: 0 1px 3px rgba(16,24,40,.16);
    text-align: center;
}
.listing-card .pers-card-fav a {
    display: block; width: 30px; height: 30px; line-height: 30px;
    color: #667085; font-size: 14px;
}
.listing-card .pers-card-fav a:hover { color: #e5484d; }

/* ---------- body ---------- */
.listing-card .pers-card-body { padding: 12px 14px 10px; flex: 1 1 auto; }
.listing-card .pers-card-title {
    margin: 0 0 8px;
    padding-right: 26px;
    font-size: 14px; font-weight: 600; line-height: 1.4;
    height: 2.8em; overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.listing-card .pers-card-title a { color: #101828; }
.listing-card .pers-card-title a:hover { text-decoration: none; opacity: .8; }

.listing-card .pers-card-price {
    font-size: 17px; font-weight: 700; line-height: 1.3;
    min-height: 2.6em; margin-bottom: 2px;
}
.listing-card .pers-card-loc {
    font-size: 12px; color: #667085; line-height: 1.5;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    /* reserve one line even when the listing has no location, so cards
       in a row stay the same height */
    min-height: 18px;
}
.listing-card .pers-card-loc .fa { margin-right: 3px; }

/* ---------- footer ---------- */
.listing-card .pers-card-foot {
    border-top: 1px solid #eef0f4;
    padding: 8px 14px;
    display: flex; justify-content: space-between; align-items: center;
    font-size: 12px; color: #667085; min-height: 34px;
}
.listing-card .pers-card-foot .fa { margin-right: 4px; }
.listing-card .pers-card-stat { white-space: nowrap; }
/* location is shown in the body in grid view, in the meta row in list view */
.listing-card .pers-stat-loc { display: none; }

.listing-card .pers-card-admin {
    border-top: 1px solid #eef0f4; padding: 8px 14px; font-size: 12px;
}
.listing-card .pers-card-admin a { margin-right: 10px; color: #667085; }
.listing-card .pers-card-admin a:hover { color: #101828; }

/* =========================================================
   LIST VIEW - horizontal card, small fixed image
   Scoped to .listing-list only, so .listing-grid and the
   .premium-list block keep the 3-column grid card.
   ========================================================= */
@media (min-width: 769px) {
    .listing-list > .listing-card {
        width: 100%;
        float: none;
        display: block;
        margin-bottom: 14px;
    }
    .listing-list .pers-card { flex-direction: row; align-items: stretch; }

    .listing-list .pers-card-media {
        width: 190px;
        min-width: 190px;
        padding-bottom: 0;
        min-height: 150px;
        border-radius: 10px 0 0 10px;
    }
    .listing-list .pers-card-main { justify-content: center; padding: 4px 0; }

    .listing-list .pers-card-body { padding: 10px 16px 6px; flex: 0 0 auto; }
    .listing-list .pers-card-title {
        height: auto;
        max-height: 2.8em;
        -webkit-line-clamp: 1;
        font-size: 15px;
        margin-bottom: 6px;
    }
    .listing-list .pers-card-price { min-height: 0; font-size: 18px; margin-bottom: 6px; }

    /* one meta row: location, time, views */
    .listing-list .pers-card-loc { display: none; }
    .listing-list .pers-stat-loc { display: inline; }
    .listing-list .pers-card-foot {
        border-top: 0;
        padding: 0 16px 10px;
        min-height: 0;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    .listing-list .pers-card-stat { margin-right: 18px; }
    .listing-list .pers-card-admin { border-top: 0; padding: 0 16px 10px; }
}

/* ---------- small screens: always the vertical card ---------- */
@media (max-width: 767px) {
    .listing-card .pers-card-title { font-size: 13px; }
    .listing-card .pers-card-price { font-size: 15px; }
    .listing-card .pers-card-body { padding: 10px 11px 8px; }
    .listing-card .pers-card-foot { padding: 7px 11px; font-size: 11px; }
    .listing-card .pers-stat-views { display: none; }
}

/* ---------------------------------------------------------
   Whole card clickable ("stretched link").
   The title anchor is expanded with a transparent overlay that
   covers the entire card, instead of wrapping the card in an <a>
   -- nesting anchors is invalid HTML and would swallow the
   watchlist heart and the owner edit/delete controls.
   Those sit above the overlay on a higher z-index.
   --------------------------------------------------------- */
.listing-card .pers-card-title a::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1;
}
.listing-card .pers-card-fav,
.listing-card .pers-card-admin {
    position: relative;
    z-index: 3;
}
.listing-card .pers-card-fav { position: absolute; }
/* badges are decorative: let clicks fall through to the card link */
.listing-card .pers-badge { pointer-events: none; }
.listing-card .pers-card { cursor: pointer; }

/* ---------------------------------------------------------
   Homepage grids: 4 cards per row on desktop.
   The card markup keeps its col-md-4 classes, so this simply
   narrows them where the .listing-4up row class is present.
   --------------------------------------------------------- */
@media (min-width: 992px) {
    .listing-4up > .listing-card {
        width: 25%;
    }
}

/* ---------------------------------------------------------
   HOMEPAGE CAROUSELS (Owl Carousel v1)

   loop.php renders each card as a Bootstrap column
   (col-md-4 col-sm-6 col-xs-6). Inside a carousel Owl wraps
   every card in .owl-item and controls the width itself, so
   the column widths and floats have to be neutralised or the
   cards collapse to a third of the slot.
   --------------------------------------------------------- */
.pers-home-carousel {
    position: relative;
}
/* .row's negative margins would push the carousel out of its container */
.pers-home-carousel.row {
    margin-left: 0;
    margin-right: 0;
}
.pers-home-carousel .owl-item {
    padding: 0 8px;
}
.pers-home-carousel .owl-item > .listing-card,
.pers-home-carousel > .listing-card {
    width: 100%;
    float: none;
    padding-left: 0;
    padding-right: 0;
    margin-bottom: 4px;
    display: block;
}
/* keep every slide the same height regardless of content */
.pers-home-carousel .owl-item {
    display: flex;
}
.pers-home-carousel .owl-item > .listing-card {
    display: flex;
}
.pers-home-carousel .owl-item .pers-card {
    height: auto;
    width: 100%;
}
/* leave room above for the arrows, which sit at top:-42px */
.pers-home-carousel .owl-controls {
    margin-top: 0;
}
