/* =============================================================
   TORONTOPROPERTY.CA — Search Results
   search-results.css
   ============================================================= */

/* -------------------------------------------------------------
   HIDE OLD REALTYPRESS CHROME
   ------------------------------------------------------------- */
.realtypress-results .row { margin: 0; }
.realtypress-results .col-md-4,
.realtypress-results .col-md-6,
.realtypress-results .col-sm-6 { padding: 0; width: auto; float: none; }
.realtypress-results .thumbnail { border: none; border-radius: 0; padding: 0; background: none; box-shadow: none; margin: 0; }
.realtypress-results .caption { padding: 0; }

/* Hide old Bootstrap nav, header_main, breadcrumb, controls row */
.header_main { display: none !important; }
.new-header   { display: none !important; }
.row.controls { display: none !important; }
main > .container.clearfix { display: none !important; }
.breadcrumb { display: none !important; }
.rps-result-overlay { display: none !important; }

/* -------------------------------------------------------------
   RESULTS PAGE WRAPPER
   ------------------------------------------------------------- */
.tp-results-page { background: #FAFAF8; }

/* -------------------------------------------------------------
   FILTER SUMMARY STRIP
   ------------------------------------------------------------- */
.tp-filter-strip {
  background: #FAFAF8;
  border-bottom: 0.5px solid #E2E2DF;
  padding: 10px 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 44px;
}
.tp-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #2C3D55;
  color: #FFFFFF;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 400;
  padding: 5px 10px 5px 12px;
  border-radius: 12px;
  white-space: nowrap;
}
.tp-filter-tag-x {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 600ms ease;
}
.tp-filter-tag-x:hover { color: #FFFFFF; }
.tp-filter-clear {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 12px;
  color: #999999;
  cursor: pointer;
  margin-left: auto;
  background: none;
  border: none;
  padding: 0;
  transition: color 600ms ease;
}
.tp-filter-clear:hover { color: #1A1A1A; }

/* -------------------------------------------------------------
   RESULTS HEADER — FIX 2
   count left · sort + view right
   ------------------------------------------------------------- */
.tp-results-header {
  padding: 14px 40px;
  border-bottom: 0.5px solid #E2E2DF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FAFAF8;
}
.tp-results-count-block {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.tp-results-count {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 400;
  color: #1A1A1A;
}
.tp-results-location {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #999999;
}
.tp-results-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* -------------------------------------------------------------
   SORT DROPDOWN — FIX 1
   ------------------------------------------------------------- */
.tp-sort-wrap {
  position: relative;
}
.tp-sort-btn {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #1A1A1A;
  background: #FAFAF8;
  border: 0.5px solid #E2E2DF;
  border-radius: 2px;
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: border-color 600ms ease;
}
.tp-sort-btn:hover { border-color: #2C3D55; }
.tp-sort-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #FAFAF8;
  border: 0.5px solid #E2E2DF;
  border-radius: 2px;
  min-width: 170px;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,0.07);
}
.tp-sort-dropdown.open { display: block; }
.tp-sort-option {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #1A1A1A;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 600ms ease;
  white-space: nowrap;
}
.tp-sort-option:hover { background: #F2EFE8; }
.tp-sort-option.active { color: #2C3D55; font-weight: 500; }

/* -------------------------------------------------------------
   VIEW TOGGLE — FIX 5
   ------------------------------------------------------------- */
.tp-view-toggle {
  display: flex;
  align-items: center;
  gap: 0;
}
.tp-vt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: #C8C8C4;
  text-decoration: none;
  transition: color 600ms ease;
  border: none;
  background: none;
}
.tp-vt:hover { color: #2C3D55; text-decoration: none; }
.tp-vt.active { color: #2C3D55; }
/* FIX 6 — Map disabled until implemented */
.tp-vt[data-view="map"] { opacity: 1; cursor: pointer; pointer-events: auto; }

/* -------------------------------------------------------------
   GRID VIEW — 3 column
   ------------------------------------------------------------- */
.tp-grid-view {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-left: 0.5px solid #E2E2DF;
  border-top: 0.5px solid #E2E2DF;
}
.tp-grid-view.hidden,
.tp-list-view.hidden,
.tp-map-view.hidden { display: none !important; }

.tp-card {
  border-right: 0.5px solid #E2E2DF;
  border-bottom: 0.5px solid #E2E2DF;
  overflow: hidden;
  cursor: pointer;
  transition: background 600ms ease;
  text-decoration: none;
  display: block;
  color: inherit;
  background: #FAFAF8;
  position: relative;
}
.tp-card:hover { background: #FFFFFF; }

/* FIX 4 — image */
.tp-card-img {
  height: 200px !important;
  overflow: hidden;
  position: relative;
}
.tp-card-img img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block;
  transition: transform 800ms ease;
}
.tp-card:hover .tp-card-img img { transform: scale(1.05); }

.tp-card-badges {
  position: absolute; top: 10px; left: 10px;
  display: flex; gap: 5px; z-index: 1;
}
.tp-badge {
  font-family: 'Inter', sans-serif;
  font-size: 9px; font-weight: 500;
  letter-spacing: 0.10em; text-transform: uppercase;
  padding: 3px 8px; line-height: 1.4;
}
.tp-badge-sale { background: #2C3D55; color: #FFFFFF; }
.tp-badge-rent { background: #FFFFFF; color: #2C3D55; border: 0.5px solid #2C3D55; }
.tp-badge-new  { background: #A07830; color: #FFFFFF; }

.tp-card-save {
  position: absolute; top: 10px; right: 10px;
  background: rgba(0,0,0,0.38);
  border: none; width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 600ms ease; z-index: 1;
}
.tp-card-save:hover { background: rgba(0,0,0,0.60); }
.tp-card-save svg {
  width: 12px; height: 12px;
  stroke: #FFFFFF; fill: none;
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.tp-card-save.saved svg { fill: #FFFFFF; }

.tp-card-body { padding: 13px 14px 16px; }

/* FIX 3 — card typography */
.tp-card-type {
  font-family: 'Inter', sans-serif !important;
  font-size: 9px !important;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: #C8C8C4 !important;
  margin-bottom: 5px;
}
.tp-card-address {
  font-family: 'Playfair Display', serif !important;
  font-size: 17px !important;
  font-weight: 400;
  color: #1A1A1A;
  line-height: 1.2;
  margin-bottom: 2px;
}
.tp-card-neighbourhood {
  font-family: 'Inter', sans-serif !important;
  font-size: 11px !important;
  color: #C8C8C4 !important;
  margin-bottom: 9px;
}
.tp-card-price {
  font-family: 'Playfair Display', serif !important;
  font-size: 19px !important;
  font-weight: 400;
  color: #1A1A1A;
  margin-bottom: 8px;
}
.tp-card-meta {
  display: flex;
  gap: 10px;
  padding-top: 8px;
  border-top: 0.5px solid #E2E2DF;
  font-family: 'Inter', sans-serif !important;
  font-size: 11px !important;
  color: #999999 !important;
  align-items: center;
}
.tp-card-meta-item { display: flex; align-items: center; gap: 4px; }
.tp-card-meta-item svg {
  width: 12px; height: 12px; stroke: #C8C8C4; fill: none;
  stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0;
}
.tp-card-dom {
  font-family: 'Inter', sans-serif;
  font-size: 10px; color: #C8C8C4; margin-top: 5px;
}

/* -------------------------------------------------------------
   LIST VIEW
   ------------------------------------------------------------- */
.tp-list-view {
  display: flex; flex-direction: column;
  border-left: 0.5px solid #E2E2DF;
  border-top: 0.5px solid #E2E2DF;
}
.tp-list-card {
  display: grid; grid-template-columns: 240px 1fr;
  border-right: 0.5px solid #E2E2DF;
  border-bottom: 0.5px solid #E2E2DF;
  overflow: hidden; cursor: pointer;
  transition: background 600ms ease;
  text-decoration: none; color: inherit; background: #FAFAF8;
}
.tp-list-card:hover { background: #FFFFFF; }
.tp-list-card:hover .tp-list-card-img img { transform: scale(1.04); }

.tp-list-card-img {
  height: 170px; overflow: hidden;
  position: relative; flex-shrink: 0;
}
.tp-list-card-img img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 800ms ease;
}
.tp-list-card-body {
  padding: 18px 20px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.tp-list-card-type {
  font-family: 'Inter', sans-serif;
  font-size: 9px; font-weight: 500;
  letter-spacing: 0.10em; text-transform: uppercase;
  color: #C8C8C4; margin-bottom: 4px;
}
.tp-list-card-address {
  font-family: 'Playfair Display', serif;
  font-size: 20px; font-weight: 400;
  color: #1A1A1A; line-height: 1.2; margin-bottom: 3px;
}
.tp-list-card-neighbourhood {
  font-family: 'Inter', sans-serif;
  font-size: 12px; color: #999999; margin-bottom: 10px;
}
.tp-list-card-price {
  font-family: 'Playfair Display', serif;
  font-size: 24px; font-weight: 400; color: #1A1A1A;
}
.tp-list-card-meta {
  display: flex; gap: 14px;
  padding-top: 9px; border-top: 0.5px solid #E2E2DF;
  font-family: 'Inter', sans-serif; font-size: 12px;
  color: #999999; margin-top: 10px; align-items: center;
}
.tp-list-card-meta-item { display: flex; align-items: center; gap: 4px; }
.tp-list-card-meta-item svg {
  width: 12px; height: 12px; stroke: #C8C8C4; fill: none;
  stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round;
}
.tp-list-card-dom {
  font-family: 'Inter', sans-serif;
  font-size: 10px; color: #C8C8C4; margin-top: 5px;
}

/* -------------------------------------------------------------
   MAP VIEW — full page, ?view=map
   ------------------------------------------------------------- */
.tp-map-view { width: 100%; }

/* Full-screen mode: hide masthead nav and footer */
body.tp-map-view .tp-masthead { display: none !important; }
body.tp-map-view #tp-footer,
body.tp-map-view footer.tp-footer { display: none !important; }

/* Map bar: count left, toggles + back right */
.tp-map-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 28px;
  background: #FAFAF8;
  border-bottom: 0.5px solid #E2E2DF;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
}
.tp-map-bar-count { color: #999999; }
.tp-map-bar-limit { color: #C8C8C4; margin-left: 6px; }
.tp-map-bar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.tp-map-view-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tp-mvt {
  color: #C8C8C4;
  display: flex;
  align-items: center;
  transition: color 300ms ease;
}
.tp-mvt:hover { color: #2C3D55; }
.tp-map-back {
  color: #2C3D55;
  text-decoration: none;
  font-size: 12px;
  transition: opacity 400ms ease;
}
.tp-map-back:hover { opacity: 0.6; text-decoration: none; }

/* Map fills everything below search bar (~60px) + map bar (~40px) = ~100px */
/* Masthead is hidden in map view so deduct only search bar + map bar */
.tp-map-full {
  width: 100%;
  height: calc(100vh - 100px);
  min-height: 500px;
}
body.tp-map-view .tp-map-full {
  height: calc(100vh - 100px);
}

/* OSM tile greyscale */
#tp-map .leaflet-tile-pane {
  filter: grayscale(1) brightness(1.1) contrast(0.88);
}

/* -------------------------------------------------------------
   MAP MARKERS + POPUPS
   ------------------------------------------------------------- */

/* OSM tile greyscale — makes the map match the site's neutral palette */
.tp-map-tiles { filter: grayscale(1) brightness(1.08) contrast(0.9); }

/* Amber individual pin */
.tp-map-pin {
  width: 14px !important;
  height: 14px !important;
  background: #A07830;
  border: 2px solid #FFFFFF;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  cursor: pointer;
  transition: transform 200ms ease;
}
.tp-map-pin:hover { transform: scale(1.4); }

/* Navy cluster bubble */
.tp-map-cluster { background: transparent !important; border: none !important; }
.tp-map-cluster-inner {
  background: #2C3D55;
  color: #FFFFFF;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #FFFFFF;
  box-shadow: 0 1px 5px rgba(0,0,0,0.30);
  box-sizing: border-box;
}

/* Popup wrapper — override Leaflet default chrome */
.tp-map-popup-wrap .leaflet-popup-content-wrapper {
  background: #FAFAF8;
  border: 0.5px solid #E2E2DF;
  border-radius: 3px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 0;
  overflow: hidden;
  width: 240px;
}
/* Fix: do NOT use width: auto — the image would expand the popup to full photo size */
.tp-map-popup-wrap .leaflet-popup-content { margin: 0; width: 240px !important; }
.tp-map-popup-wrap .leaflet-popup-tip { background: #FAFAF8; }
.tp-map-popup-wrap .leaflet-popup-close-button {
  color: #999 !important;
  font-size: 16px !important;
  padding: 4px 6px !important;
  z-index: 10;
}

/* Popup card */
.tp-mpop-card {
  display: block;
  text-decoration: none;
  color: inherit;
  width: 240px;
  overflow: hidden;
}
a.tp-mpop-card:hover .tp-mpop-body { background: #F2EFE8; }

.tp-mpop-img {
  width: 240px;
  height: 150px;
  overflow: hidden;
  background: #F2EFE8;
  flex-shrink: 0;
}
.tp-mpop-img-empty { background: #EDEBE5; }
.tp-mpop-img img {
  width: 240px;
  height: 150px;
  object-fit: cover;
  display: block;
  transition: transform 600ms ease;
}
a.tp-mpop-card:hover .tp-mpop-img img { transform: scale(1.04); }

.tp-mpop-body {
  padding: 12px 14px 14px;
  background: #FAFAF8;
  transition: background 400ms ease;
}
.tp-mpop-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 3px;
}
.tp-mpop-price {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 400;
  color: #1A1A1A;
  line-height: 1.2;
}
.tp-mpop-save {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 0 0 8px;
  color: #C8C8C4;
  line-height: 1;
  flex-shrink: 0;
  transition: color 300ms ease;
}
.tp-mpop-save:hover { color: #A07830; }
.tp-mpop-save.saved { color: #A07830; }
.tp-mpop-addr {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: #1A1A1A;
  margin-bottom: 2px;
  line-height: 1.3;
}
.tp-mpop-hood {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: #999999;
  margin-bottom: 8px;
}
.tp-mpop-meta {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: #999999;
  padding-top: 7px;
  border-top: 0.5px solid #E2E2DF;
  margin-bottom: 8px;
}
.tp-mpop-cta {
  display: inline-block;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: #A07830;
  letter-spacing: 0.03em;
}

/* -------------------------------------------------------------
   PAGINATION
   ------------------------------------------------------------- */
.tp-pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 40px; border-top: 0.5px solid #E2E2DF; background: #FAFAF8;
}
.tp-pagination-info {
  font-family: 'Inter', sans-serif; font-size: 13px; color: #999999;
}
.tp-pagination-pages { display: flex; gap: 4px; align-items: center; }
/* rps_pagination() wraps links in nav > ul.pagination > li — flatten to flex row */
.tp-pagination-pages nav { display: contents; }
.tp-pagination-pages ul.pagination {
  display: flex !important; flex-wrap: wrap !important; gap: 4px !important;
  align-items: center !important; list-style: none !important;
  margin: 0 !important; padding: 0 !important;
}
.tp-pagination-pages ul.pagination li {
  display: flex !important; list-style: none !important;
  margin: 0 !important; padding: 0 !important;
}

/* Style RealtyPress pagination output — !important to beat old CSS */
.tp-pagination-pages .page-numbers,
.tp-pagination-pages a,
.tp-pagination-pages span {
  width: 34px !important; height: 34px !important;
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
  border: 0.5px solid #E2E2DF !important; background: #FAFAF8 !important;
  font-family: 'Inter', sans-serif !important; font-size: 13px !important;
  color: #999999 !important; cursor: pointer !important; border-radius: 2px !important;
  transition: all 600ms ease !important; text-decoration: none !important;
  line-height: 1 !important; margin: 0 !important; padding: 0 !important;
  box-shadow: none !important; min-width: 0 !important;
}
.tp-pagination-pages .page-numbers:hover,
.tp-pagination-pages a:hover { border-color: #2C3D55 !important; color: #2C3D55 !important; background: #FAFAF8 !important; }
.tp-pagination-pages .page-numbers.current,
.tp-pagination-pages .page-numbers.current:hover { background: #2C3D55 !important; color: #FFFFFF !important; border-color: #2C3D55 !important; }
.tp-pagination-pages .page-numbers.dots,
.tp-pagination-pages .page-numbers.dots:hover { border: none !important; background: none !important; cursor: default !important; color: #C8C8C4 !important; width: auto !important; }

/* -------------------------------------------------------------
   MOBILE
   ------------------------------------------------------------- */
@media (max-width: 768px) {
  .tp-filter-strip { padding: 10px 20px; }
  .tp-results-header { padding: 10px 20px; flex-wrap: wrap; gap: 10px; }
  .tp-results-count { font-size: 15px; }
  .tp-results-location { display: none; }
  .tp-results-right { gap: 8px; }
  .tp-sort-dropdown { right: auto; left: 0; }
  .tp-grid-view { grid-template-columns: 1fr; }
  .tp-card-img { height: 220px !important; }
  .tp-list-card { grid-template-columns: 1fr; }
  .tp-list-card-img { height: 200px; }
  .tp-pagination { padding: 16px 20px; flex-wrap: wrap; justify-content: center; gap: 10px; }
  .tp-pagination-info { width: 100%; text-align: center; }
  .tp-pagination-pages { justify-content: center; flex-wrap: wrap; }
  .tp-map-bar { padding: 8px 12px; }
  .tp-map-bar-count { font-size: 11px; }
  .tp-map-view-toggle { gap: 8px; }
  /* On mobile the search bar is taller (~100px) + map bar (~36px) */
  .tp-map-full,
  body.tp-map-view .tp-map-full { height: calc(100vh - 136px); min-height: 300px; }
  /* Popup: constrain to fit narrow screens */
  .tp-map-popup-wrap .leaflet-popup-content-wrapper,
  .tp-map-popup-wrap .leaflet-popup-content,
  .tp-mpop-card { width: 200px !important; max-width: 200px !important; }
  .tp-mpop-carousel,
  .tp-mpop-carousel img { width: 200px !important; height: 130px !important; }
  .tp-mpop-carr-next { right: 34px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .tp-grid-view { grid-template-columns: repeat(2, 1fr); }
}
