/* ============================================================================
   ATLAS REDESIGN — Property Search / IDX screen styles  ·  Phase 2
   Branch: atlas-redesign-2026-06-29

   Prefix: .rd-propsearch. Tokens only (--r-*) — both Calm + Operator auto-work.
   Layout: header → filter bar (static placeholder chips + save/share actions) →
   results table card with an internally-scrolling body. No hardcoded hex.

   DATA HONESTY: there is NO live IDX/search fetcher in this environment, so the
   results body renders an honest empty state by default — never fabricated rows.
   ========================================================================== */

.rd-propsearch {
  font-family: var(--r-font-body);
  color: var(--r-body);
  padding: var(--r-gutter);
  max-width: var(--r-page-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---- page header --------------------------------------------------------- */
.rd-ps-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 2px;
}
.rd-ps-eyebrow {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-eyebrow);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--r-clay);
}
.rd-ps-h1 {
  font-family: var(--r-font-display);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--r-ink);
  margin: 0;
}
.rd-ps-sub {
  font-family: var(--r-font-body);
  font-size: 14px;
  color: var(--r-muted);
  margin: 0;
}

/* ---- filter bar ---------------------------------------------------------- */
.rd-ps-filters {
  background: var(--r-surface);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-card);
  box-shadow: var(--r-shadow-card);
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* one filter "chip" (visual placeholder control) */
.rd-ps-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--r-font-body);
  font-size: 12.5px;
  color: var(--r-body);
  background: var(--r-canvas-raised);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-control);
  padding: 8px 12px;
  cursor: pointer;
  transition: border-color var(--r-dur) var(--r-ease),
              background var(--r-dur) var(--r-ease),
              box-shadow var(--r-dur) var(--r-ease);
}
.rd-ps-chip:hover {
  border-color: var(--r-primary);
  box-shadow: var(--r-shadow-card);
}
.rd-ps-chip:focus-visible { outline: var(--r-focus); outline-offset: 2px; }
.rd-ps-chip .ph { font-size: 14px; color: var(--r-muted); }
.rd-ps-chip .rd-ps-chip-caret { font-size: 12px; color: var(--r-faint); margin-left: 1px; }

/* highlighted status chip (Active) */
.rd-ps-chip[data-tone="active"] {
  background: var(--r-mint-surface);
  border-color: var(--r-mint-surface);
  color: var(--r-mint-ink);
}
.rd-ps-chip[data-tone="active"] .ph { color: var(--r-mint-ink); }
.rd-ps-chip[data-tone="active"]:hover { border-color: var(--r-mint-ink); }

/* right-aligned action group */
.rd-ps-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.rd-ps-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--r-font-body);
  font-size: var(--r-fs-body);
  font-weight: 600;
  border-radius: var(--r-radius-control);
  padding: 8px 16px;
  cursor: pointer;
  transition: box-shadow var(--r-dur) var(--r-ease),
              transform var(--r-dur) var(--r-ease),
              border-color var(--r-dur) var(--r-ease),
              background var(--r-dur) var(--r-ease);
}
.rd-ps-btn .ph { font-size: 15px; }
.rd-ps-btn:focus-visible { outline: var(--r-focus); outline-offset: 2px; }

.rd-ps-btn--secondary {
  color: var(--r-body);
  background: var(--r-surface);
  border: 1px solid var(--r-border);
}
.rd-ps-btn--secondary:hover {
  border-color: var(--r-primary);
  box-shadow: var(--r-shadow-card);
}
.rd-ps-btn--primary {
  color: var(--r-primary-ink);
  background: var(--r-primary);
  border: 1px solid var(--r-primary);
  box-shadow: var(--r-shadow-card);
}
.rd-ps-btn--primary:hover { box-shadow: var(--r-shadow-hover); transform: translateY(-1px); }

/* ---- results table ------------------------------------------------------- */
.rd-ps-table {
  background: var(--r-surface);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-card);
  overflow: hidden;
  box-shadow: var(--r-shadow-card);
  display: flex;
  flex-direction: column;
  /* fit within the 1080 frame — header(~120) + filter bar(~74) + gaps; body scrolls */
  max-height: 620px;
}

/* shared row grid: ADDRESS · PRICE · BD/BA · SQFT · DOM */
.rd-ps-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 70px 70px 60px;
  gap: 14px;
  align-items: center;
  padding: 12px 18px;
}

.rd-ps-thead {
  background: var(--r-canvas-raised);
  border-bottom: 1px solid var(--r-border);
  flex: 0 0 auto;
}
.rd-ps-th {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-eyebrow);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--r-faint);
}
.rd-ps-th--num { text-align: right; }

.rd-ps-tbody {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* a real result row (only rendered when a real search feed exists) */
.rd-ps-tr {
  border-bottom: 1px solid var(--r-hairline);
  cursor: pointer;
  transition: background var(--r-dur) var(--r-ease);
}
.rd-ps-tr:last-child { border-bottom: 0; }
.rd-ps-tr:hover { background: var(--r-canvas-raised); }
.rd-ps-tr:focus-visible { outline: var(--r-focus); outline-offset: -2px; }

.rd-ps-addr {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.rd-ps-addr-line {
  font-family: var(--r-font-body);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--r-ink);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-ps-addr-sub {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  letter-spacing: .04em;
  color: var(--r-faint);
}
.rd-ps-num {
  font-family: var(--r-font-body);
  font-size: 13px;
  color: var(--r-body);
  text-align: right;
}
.rd-ps-price {
  font-family: var(--r-font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--r-ink);
  text-align: right;
}
.rd-ps-dom { text-align: right; font-family: var(--r-font-mono); font-size: 12px; }
.rd-ps-dom[data-tone="fresh"] { color: var(--r-good); }
.rd-ps-dom[data-tone="aging"] { color: var(--r-amber); }
.rd-ps-dom[data-tone="neutral"] { color: var(--r-muted); }

/* ---- honest empty state (default) --------------------------------------- */
.rd-ps-empty {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 56px 24px;
  text-align: center;
}
.rd-ps-empty-icon {
  font-size: 30px;
  color: var(--r-faint);
  line-height: 1;
}
.rd-ps-empty-title {
  font-family: var(--r-font-body);
  font-size: var(--r-fs-body);
  font-weight: 600;
  color: var(--r-muted);
}
.rd-ps-empty-note {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  letter-spacing: .04em;
  color: var(--r-faint);
  max-width: 360px;
}

/* ---- W-PS1 interactive controls (city / price / beds / baths) ------------ */
.rd-ps-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--r-canvas-raised);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-control);
  padding: 0 10px;
  height: 36px;
  transition: border-color var(--r-dur) var(--r-ease), box-shadow var(--r-dur) var(--r-ease);
}
.rd-ps-field:focus-within { border-color: var(--r-primary); box-shadow: var(--r-shadow-card); }
.rd-ps-field-lead {
  font-family: var(--r-font-body);
  font-size: 13px;
  color: var(--r-muted);
  display: inline-flex;
  align-items: center;
}
.rd-ps-field-lead .ph { font-size: 15px; }
.rd-ps-field--addr { flex: 1 1 240px; min-width: 200px; max-width: 340px; }
.rd-ps-field--city { min-width: 168px; }
.rd-ps-field--price { width: 108px; }
.rd-ps-field--sort { min-width: 132px; }

.rd-ps-select,
.rd-ps-input {
  border: 0;
  background: transparent;
  font-family: var(--r-font-body);
  font-size: 13px;
  color: var(--r-body);
  outline: none;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.rd-ps-input { cursor: text; }
.rd-ps-input::placeholder { color: var(--r-faint); }
.rd-ps-select:focus-visible,
.rd-ps-input:focus-visible { outline: none; }
/* strip number-input spinners for a cleaner control */
.rd-ps-input::-webkit-outer-spin-button,
.rd-ps-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rd-ps-input[type="number"] { -moz-appearance: textfield; }

.rd-ps-dash { color: var(--r-faint); font-size: 13px; margin: 0 -2px; }

/* the Active-only indicator is informational (a <span>, not a control) */
.rd-ps-filters .rd-ps-chip[data-tone="active"] { cursor: default; }
.rd-ps-filters .rd-ps-chip[data-tone="active"]:hover { border-color: var(--r-mint-ink); box-shadow: none; }

/* ---- results meta line (honest counts) ----------------------------------- */
.rd-ps-meta {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  letter-spacing: .04em;
  color: var(--r-muted);
  padding: 0 4px;
  margin-top: -6px;
}

/* ---- responsive ---------------------------------------------------------- */
@media (max-width: 900px) {
  .rd-ps-actions { margin-left: 0; }
  .rd-ps-field--city { min-width: 140px; }
}
@media (max-width: 760px) {
  .rd-ps-tbody { overflow-x: auto; }
  .rd-ps-row {
    grid-template-columns: minmax(220px, 1fr) 90px 70px 70px 60px;
    min-width: 560px;
  }
}

/* ============================================================================
   W-PS2: property DETAIL slide-over content — rendered INSIDE RDRecordPanel
   (record-card.js .rd-rp__body / .rd-rp__foot). Tokens only (--r-*). The panel
   shell + rows are styled by the shared record-card CSS; these style the photo
   gallery, remarks, and the client-flyer action we inject.
   ========================================================================== */
.rd-pd-loading,
.rd-pd-noimg {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  letter-spacing: .04em;
  color: var(--r-faint);
  padding: 22px 4px;
  text-align: center;
}
.rd-pd-hero img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: var(--r-radius-card);
  display: block;
  background: var(--r-canvas-raised);
}
.rd-pd-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 6px;
}
.rd-pd-grid img {
  width: 100%;
  height: 84px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
  background: var(--r-canvas-raised);
}
.rd-pd-more {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  color: var(--r-faint);
  margin-top: 8px;
  text-align: center;
}
.rd-pd-remarks {
  font-family: var(--r-font-body);
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--r-body);
  white-space: pre-line;
  margin: 0;
}
/* client-flyer action (RDRecordPanel footer) + minted share-link output */
.rd-pd-flyer-out {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.rd-pd-flyer-note {
  flex-basis: 100%;
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  color: var(--r-muted);
}
.rd-pd-flyer-err {
  flex-basis: 100%;
  font-family: var(--r-font-body);
  font-size: 12.5px;
  color: var(--r-amber, #b8860b);
}

/* ============================================================================
   W-PS3: MLS#/ZIP search · More-filters disclosure · Load-more pagination.
   Tokens only (--r-*). The search box now also accepts a ZIP or MLS# (server
   classifies); these style the extra controls the frontend adds.
   ========================================================================== */
/* "More filters" toggle (a real button reusing the chip look) */
.rd-ps-more-toggle { cursor: pointer; }
.rd-ps-more-toggle[aria-expanded="true"] { border-color: var(--r-primary); color: var(--r-ink); }
.rd-ps-more-toggle[aria-expanded="true"] .ph { color: var(--r-primary); }

/* collapsible secondary filter row — full width, wraps under the main bar */
.rd-ps-more {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  margin-top: 2px;
  border-top: 1px solid var(--r-hairline);
}
.rd-ps-more[hidden] { display: none; }   /* beats the .rd-ps-more display:flex above */
.rd-ps-field--type { min-width: 168px; }
.rd-ps-field--num { width: 130px; }

/* "Load more" — centered pagination control under the results table */
.rd-ps-loadmore {
  display: flex;
  justify-content: center;
  padding: 2px 0 4px;
}
.rd-ps-loadmore[hidden] { display: none; }

/* ---- W-PS4: saved searches strip ----------------------------------------- */
.rd-ps-saved {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  margin-top: -4px;
}
.rd-ps-saved[hidden] { display: none; }
.rd-ps-saved-lead {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-eyebrow);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--r-faint);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rd-ps-saved-lead .ph { font-size: 13px; }
.rd-ps-saved-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--r-font-body);
  font-size: 12.5px;
  color: var(--r-body);
  background: var(--r-canvas-raised);
  border: 1px solid var(--r-border);
  border-radius: 999px;
  padding: 4px 5px 4px 12px;
  cursor: pointer;
  transition: border-color var(--r-dur) var(--r-ease), box-shadow var(--r-dur) var(--r-ease);
}
.rd-ps-saved-pill:hover { border-color: var(--r-primary); box-shadow: var(--r-shadow-card); }
.rd-ps-saved-pill:focus-visible { outline: var(--r-focus); outline-offset: 2px; }
.rd-ps-saved-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: var(--r-faint);
}
.rd-ps-saved-del:hover { background: var(--r-border); color: var(--r-ink); }
.rd-ps-saved-del .ph { font-size: 12px; }

/* ============================================================================
   W-PS6 (public "share these results") + W-PS7 (map view). Tokens only (--r-*).
   ========================================================================== */
/* results toolbar — List/Map toggle (left) + Share results (right) */
.rd-ps-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px;
  margin-top: -6px;
}
.rd-ps-toolbar[hidden] { display: none; }

.rd-ps-viewtoggle {
  display: inline-flex;
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-control);
  overflow: hidden;
  background: var(--r-surface);
}
.rd-ps-vt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--r-font-body);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--r-muted);
  background: transparent;
  border: 0;
  padding: 7px 14px;
  cursor: pointer;
  transition: background var(--r-dur) var(--r-ease), color var(--r-dur) var(--r-ease);
}
.rd-ps-vt + .rd-ps-vt { border-left: 1px solid var(--r-border); }
.rd-ps-vt .ph { font-size: 14px; }
.rd-ps-vt:hover { color: var(--r-ink); }
.rd-ps-vt[aria-pressed="true"] { background: var(--r-primary); color: var(--r-primary-ink); }
.rd-ps-vt[aria-pressed="true"] .ph { color: var(--r-primary-ink); }
.rd-ps-vt:focus-visible { outline: var(--r-focus); outline-offset: -2px; }
.rd-ps-toolbar #rd-ps-share { margin-left: auto; }

/* minted share-link output row (mirrors the flyer output) */
.rd-ps-shareout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
}
.rd-ps-shareout[hidden] { display: none; }

/* map view (Leaflet) — same card frame as the results table. position+z-index
   isolate Leaflet's internal pane/popup z-index stack from the fixed shell. */
.rd-ps-table[hidden] { display: none; }
.rd-ps-map {
  position: relative;
  z-index: 0;
  height: 560px;
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-card);
  box-shadow: var(--r-shadow-card);
  overflow: hidden;
  background: var(--r-canvas-raised);
}
.rd-ps-map[hidden] { display: none; }
.rd-ps-map-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  text-align: center;
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  color: var(--r-muted);
}

/* Leaflet marker popup content (the bubble chrome is leaflet.css) */
.rd-ps-pop { min-width: 150px; font-family: var(--r-font-body); }
.rd-ps-pop-price { font-family: var(--r-font-display); font-size: 16px; font-weight: 600; color: var(--r-ink); }
.rd-ps-pop-addr { font-size: 12.5px; color: var(--r-body); margin: 3px 0 8px; }
.rd-ps-pop-btn {
  font-family: var(--r-font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--r-primary-ink);
  background: var(--r-primary);
  border: 0;
  border-radius: var(--r-radius-control);
  padding: 6px 12px;
  cursor: pointer;
}
.rd-ps-pop-btn:hover { box-shadow: var(--r-shadow-card); }

@media (max-width: 640px) {
  .rd-ps-map { height: 440px; }
}
