/* ══════════════════════════════════════════════
   HagerBet — Marketplace styles
   ══════════════════════════════════════════════ */

/* Buy / Sell toggle */
.mkt-toggle { display: inline-flex; gap: 6px; background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; margin: 0 auto 32px; }
.mkt-toggle button { padding: 10px 32px; border: none; background: transparent; border-radius: calc(var(--radius) - 1px); font-family: var(--font-body); font-weight: 600; font-size: 14px; color: var(--ink-3); cursor: pointer; transition: all var(--transition); }
.mkt-toggle button:hover { color: var(--forest); }
.mkt-toggle button.active { background: var(--forest); color: var(--paper); }
section > .container > .mkt-toggle { display: flex; width: max-content; }

/* Filter bar — floating card overlapping the hero (listings-portal pattern) */
.mkt-filter-card {
  position: relative;
  z-index: 5;
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px 28px 22px;
  margin: -64px auto 0;
  max-width: 1080px;
}
@media (max-width: 760px) { .mkt-filter-card { margin-top: -32px; padding: 20px; } }
.mkt-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; align-items: end; }
.mkt-field { display: flex; flex-direction: column; }
.mkt-field label { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); margin-bottom: 6px; }
.mkt-field label .icon { width: 13px; height: 13px; }
.mkt-field select { width: 100%; padding: 11px 14px; border: 1px solid var(--line-strong); background: var(--paper); font-size: 14px; font-family: inherit; color: var(--ink); border-radius: var(--radius); cursor: pointer; }
.mkt-field select:focus { outline: none; border-color: var(--ink); }
.mkt-search-btn { display: flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }

.mkt-bar { display: flex; justify-content: space-between; align-items: center; margin: 24px 0 28px; gap: 12px; flex-wrap: wrap; }
.mkt-count { font-size: 14px; color: var(--ink-3); }
.mkt-bar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.mkt-sort { display: flex; align-items: center; gap: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); }
.mkt-sort select { padding: 9px 12px; border: 1px solid var(--line-strong); background: var(--paper); font-size: 13px; font-family: inherit; color: var(--ink); border-radius: var(--radius); cursor: pointer; }
.mkt-saved-toggle { border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink-2); padding: 9px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 500; cursor: pointer; transition: all var(--transition); }
.mkt-saved-toggle:hover { border-color: var(--forest); color: var(--forest); }
.mkt-saved-toggle.active { background: var(--forest); border-color: var(--forest); color: var(--paper); }

/* Cards — the whole card is a link through to /property/<slug>, with the
   favourite button as a sibling above it so the link doesn't swallow it. */
.mkt-card { position: relative; }
.mkt-card-link {
  display: flex; flex-direction: column; flex-grow: 1;
  color: inherit; text-decoration: none;
}
.mkt-card-link:hover { color: inherit; }
.mkt-card-link:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.mkt-fav { position: absolute; top: 12px; right: 12px; z-index: 4; width: 38px; height: 38px; border-radius: 50%; border: none; background: rgba(255,255,255,0.92); color: var(--ink-2); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all var(--transition); box-shadow: var(--shadow); }
.mkt-fav:hover { color: var(--forest); transform: scale(1.08); }
.mkt-fav.active { color: #C0392B; }
.mkt-fav.active svg { fill: #C0392B; }

/* Icon spec row + price-label + price-block are shared chrome now defined
   generically for .property-card in css/styles.css (so plain, non-JS-driven
   cards elsewhere on the site can use the same markup) — nothing mkt-specific
   left to add here. */

.mkt-empty { text-align: center; padding: 64px 24px; color: var(--ink-3); }
.mkt-empty p { margin-bottom: 20px; }
.mkt-help { font-size: 13px; color: var(--ink-3); }

/* Sell form wrap */
.quote-wrap { max-width: 660px; margin: 0 auto; background: var(--paper); border: 1px solid var(--line); padding: 36px; }
@media (max-width: 600px) { .quote-wrap { padding: 24px; } }

/* Detail modal */
.mkt-modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 24px; }
.mkt-modal[hidden] { display: none; }
.mkt-modal-backdrop { position: absolute; inset: 0; background: rgba(26,26,26,0.55); backdrop-filter: blur(2px); }
.mkt-modal-card { position: relative; background: var(--paper); border-radius: var(--radius-lg); max-width: 920px; width: 100%; max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lg); }
#modalBody { display: grid; grid-template-columns: 1fr 1fr; }
.mkt-modal-close { position: absolute; top: 14px; right: 16px; z-index: 4; width: 38px; height: 38px; border-radius: 50%; border: none; background: rgba(255,255,255,0.92); font-size: 22px; line-height: 1; color: var(--ink); cursor: pointer; box-shadow: var(--shadow); }
.modal-shell { border: none !important; height: 100%; }
.modal-shell .card-image { height: 100%; min-height: 340px; border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
.modal-info { padding: 36px; }
.modal-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 24px; }
.modal-head h3 { margin-bottom: 6px; }
.modal-price { font-family: var(--font-display); font-size: 1.6rem; color: var(--forest); white-space: nowrap; }
.modal-price .local { display: block; font-family: var(--font-body); font-size: 0.85rem; font-weight: 400; color: var(--ink-3); margin-top: 2px; }
.modal-specs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.modal-specs div { display: flex; flex-direction: column; gap: 2px; }
.modal-specs strong { font-family: var(--font-display); font-size: 1.15rem; color: var(--ink); }
.modal-specs span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); }
.modal-plan { display: flex; gap: 8px; align-items: flex-start; background: var(--forest-bg); color: var(--forest); padding: 12px 16px; border-radius: var(--radius); font-size: 0.9rem; font-weight: 500; margin-bottom: 20px; }
.modal-plan .icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.modal-highlights { list-style: none; margin: 0 0 28px; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.modal-highlights li { display: flex; gap: 10px; align-items: flex-start; font-size: 0.92rem; color: var(--ink-2); line-height: 1.45; }
.modal-highlights .icon { width: 16px; height: 16px; color: var(--forest); flex-shrink: 0; margin-top: 2px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.modal-actions .btn { flex: 1; min-width: 150px; }
.modal-source { font-size: 12px; color: var(--ink-3); margin-top: 16px; }
.modal-source a { color: var(--ink-3); }

@media (max-width: 760px) {
  #modalBody { grid-template-columns: 1fr; }
  .modal-shell .card-image { border-radius: var(--radius-lg) var(--radius-lg) 0 0; min-height: 220px; }
  .modal-info { padding: 24px; }
}

/* Real listing photos (layer under the darken gradient + overlay) */
.card-image .card-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.mkt-card .card-image::before, .modal-shell .card-image::before { z-index: 1; }
.mkt-card .card-image .image-overlay, .modal-shell .card-image .image-overlay { z-index: 2; }
.mkt-card .card-image .badge, .modal-shell .card-image .badge { z-index: 3; }
