/* listing.css — bestdubai-style faceted listing + cards (Phase A).
   Builds on tokens from styles.css (--brand, --border, --muted, --maxw). */

/* ---- Global bestdubai-style header ---- */
.bm-header { position: sticky; top: 0; z-index: 50; background: #fff; border-bottom: 1px solid var(--border); }
.bm-header-top { max-width: var(--maxw); margin: 0 auto; padding: 10px 18px; display: flex; align-items: center; gap: 16px; }
.bm-logo img { display: block; height: 38px; width: auto; }
.bm-search { flex: 1 1 auto; display: flex; align-items: center; max-width: 520px; border: 1px solid var(--border); border-radius: 999px; background: #fff; overflow: hidden; }
.bm-search input { flex: 1; border: 0; outline: 0; padding: 10px 16px; font-size: .95rem; background: transparent; }
.bm-search button { border: 0; background: var(--brand); color: #fff; padding: 0 16px; align-self: stretch; cursor: pointer; display: flex; align-items: center; }
.bm-saved { position: relative; display: inline-flex; align-items: center; color: #555; text-decoration: none; padding: 6px; }
.bm-saved svg { fill: none; stroke: currentColor; stroke-width: 2; }
.bm-saved:hover { color: #e0245e; }
.bm-saved .fav-count { position: absolute; top: -2px; right: -4px; background: #e0245e; color: #fff; font-size: .68rem; font-weight: 700; min-width: 16px; height: 16px; border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.bm-cta { white-space: nowrap; background: #fff; color: var(--brand); border: 1px solid var(--brand); padding: 9px 16px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: .9rem; }
.bm-cta:hover { background: var(--chip-on); }
.bm-catnav { max-width: var(--maxw); margin: 0 auto; padding: 0 18px 4px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin; }
.bm-catnav a { white-space: nowrap; padding: 8px 12px; color: #444; text-decoration: none; font-size: .9rem; font-weight: 600; border-bottom: 2px solid transparent; }
.bm-catnav a:hover { color: var(--brand); }
.bm-catnav a.active { color: var(--brand); border-bottom-color: var(--brand); }
@media (max-width: 680px) {
  .bm-header-top { flex-wrap: wrap; }
  .bm-search { order: 3; flex-basis: 100%; max-width: none; }
  .bm-cta { font-size: .82rem; padding: 8px 12px; }
}

.breadcrumbs { max-width: var(--maxw); margin: 12px auto 0; padding: 0 18px; color: var(--muted); font-size: .9rem; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs span { margin: 0 6px; opacity: .6; }

/* Two-column listing: filter sidebar + results */
.listing { max-width: var(--maxw); margin: 0 auto; padding: 12px 18px 40px; display: grid; grid-template-columns: 248px 1fr; gap: 24px; align-items: start; }
@media (max-width: 860px) { .listing { grid-template-columns: 1fr; } .filters { position: static !important; } }

.filters { position: sticky; top: calc(var(--site-header-h) + 12px); border: 1px solid var(--border); border-radius: 14px; background: #fff; padding: 14px 16px; }
.filters h2 { font-size: 1rem; margin: 0 0 8px; display: flex; justify-content: space-between; align-items: center; }
.filters .reset { font-size: .8rem; color: var(--brand); cursor: pointer; background: none; border: none; padding: 0; }
.facet { border-top: 1px solid var(--border); padding: 10px 0; }
.facet > summary { cursor: pointer; font-weight: 600; font-size: .92rem; list-style: none; display: flex; justify-content: space-between; }
.facet > summary::-webkit-details-marker { display: none; }
.facet > summary::after { content: "▾"; color: var(--muted); }
.facet[open] > summary::after { content: "▴"; }
.facet-options { margin-top: 8px; max-height: 220px; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.facet-options label { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: #333; cursor: pointer; }
.facet-options .c { margin-left: auto; color: var(--muted); font-size: .8rem; }
.rating-radios { display: flex; flex-wrap: wrap; gap: 6px; }
.rating-radios label { border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; cursor: pointer; font-size: .85rem; }
.rating-radios input { display: none; }
.rating-radios input:checked + span { font-weight: 700; }
.rating-radios label:has(input:checked) { background: var(--chip-on); border-color: #a3c0ff; }

/* Results toolbar */
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.results-head .count { margin: 0; }
.results-head select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.filter-toggle { display: none; }
@media (max-width: 860px) { .filter-toggle { display: inline-block; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; } }
.view-toggle { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; font-size: .9rem; }
.view-toggle[aria-pressed="true"] { background: var(--chip-on); border-color: #a3c0ff; }

/* Proximity */
.geo-btn { width: 100%; padding: 9px 12px; border: 1px solid var(--brand); color: var(--brand); background: #fff; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .88rem; }
.geo-btn:hover { background: var(--chip-on); }
.geo-status { display: block; font-size: .8rem; color: var(--muted); margin-top: 6px; }
.pc-distance { color: var(--brand); font-weight: 700; }

/* Map view */
.listing-map { height: 70vh; min-height: 420px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); }

/* bestdubai-style place cards */
.places-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
/* Listing results: a strict, uniform 3-column grid (2 on tablet, 1 on mobile). */
.listing .places-grid { grid-template-columns: 1fr; }
@media (min-width: 560px) { .listing .places-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .listing .places-grid { grid-template-columns: repeat(3, 1fr); } }
.place-card { position: relative; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: #fff; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; }
/* Save (heart) button overlaid on the card image */
.fav-btn { position: absolute; top: 10px; left: 10px; z-index: 2; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255,255,255,.92); color: #555; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0,0,0,.2); padding: 0; }
.fav-btn:hover { color: #e0245e; }
.fav-btn svg { fill: none; stroke: currentColor; stroke-width: 2; }
.fav-btn.on { color: #e0245e; }
.fav-btn.on svg { fill: #e0245e; stroke: #e0245e; }
.place-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.08); transform: translateY(-2px); }
/* Fixed image height => every card banner is identical (aspect-ratio alone was
   being overridden by the <img> intrinsic size). */
.place-card .pc-img { position: relative; display: block; height: 172px; background: #f1f1f1; overflow: hidden; }
.place-card .pc-img img { width: 100%; height: 172px; object-fit: cover; display: block; }
.pc-rating { position: absolute; top: 10px; right: 10px; background: rgba(11,87,208,.95); color: #fff; font-weight: 700; font-size: .85rem; padding: 4px 8px; border-radius: 8px; display: flex; align-items: center; gap: 4px; }
.pc-rating small { font-weight: 500; opacity: .85; }
.pc-awards { position: absolute; top: 10px; left: 10px; display: flex; gap: 4px; flex-wrap: wrap; }
.pc-award { background: rgba(0,0,0,.7); color: #fff; font-size: .7rem; padding: 3px 7px; border-radius: 999px; }
/* Uniform body so every card is the same total height. */
.pc-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 116px; }
.pc-name { font-size: 1.02rem; font-weight: 700; margin: 0; line-height: 1.25; min-height: 2.5em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pc-name a { color: #111; text-decoration: none; }
.pc-name a:hover { color: var(--brand); }
.pc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: .85rem; }
.pc-price { font-weight: 700; color: #111; }
.pc-area { overflow: hidden; text-overflow: ellipsis; }
.pc-area a { color: var(--muted); text-decoration: none; }
.pc-area a:hover { text-decoration: underline; }
.pc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; max-height: 28px; overflow: hidden; }
.pc-tags a, .pc-tags span { font-size: .76rem; background: var(--chip); border-radius: 999px; padding: 3px 9px; color: #333; text-decoration: none; }
.pc-tags a:hover { background: var(--chip-on); }
.no-results { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 14px; }
.place-card[hidden] { display: none !important; }
