/* =========================================================
   RESULTS.CSS — toolbar, chips, grid, cards, badges, empty
   ========================================================= */

/* ---------- TOOLBAR ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.result-count {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink);
}
.result-count em {
  font-style: normal;
  color: var(--muted);
  font-weight: 500;
}

.toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sort-wrap label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.sort-wrap select {
  padding: 9px 30px 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-weight: 550;
  font-size: 13.5px;
  color: var(--ink);
  outline: 0;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7b7a' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.sort-wrap select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13,122,107,.12);
}

.filter-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink);
}
.filter-toggle svg { width: 16px; height: 16px; }

/* ---------- CHIPS ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.chips:empty { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px 6px 12px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12.5px;
  font-weight: 600;
}
.chip button {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(13,122,107,.16);
  transition: .15s;
}
.chip button:hover { background: rgba(13,122,107,.32); }
.chip svg { width: 9px; height: 9px; }

/* ---------- GRID ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 22px;
}

/* ---------- CARD ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: #d5e0de;
}

.card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: linear-gradient(140deg, #dfe9e7, #c6d6d3);
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.card:hover .card-media img { transform: scale(1.05); }

/* ---------- BADGES ---------- */
.badges {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.badge {
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(0,0,0,.14);
}
.badge-new  { background: #fff; color: #0b6b5d; }
.badge-open { background: rgba(255,255,255,.94); color: #8a4b00; }
.badge-drop { background: #fff1ec; color: var(--danger); }

/* ---------- FAVORITE HEART ---------- */
.fav {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.93);
  display: grid;
  place-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.16);
  transition: .16s;
}
.fav:hover {
  transform: scale(1.1);
  background: #fff;
}
.fav svg {
  width: 18px;
  height: 18px;
  color: #8d9c9a;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transition: .16s;
}
.fav.saved svg {
  color: #e0526b;
  fill: #e0526b;
  stroke: #e0526b;
}
.fav.saved { animation: pop .3s ease; }
@keyframes pop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.28); }
  100% { transform: scale(1); }
}

/* ---------- CARD BODY ---------- */
.card-body {
  padding: 15px 17px 17px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.price-line {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 5px;
}
.price {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.025em;
  color: var(--ink);
}
.drop {
  font-size: 12px;
  font-weight: 700;
  color: var(--danger);
  background: #fff1ec;
  padding: 2px 7px;
  border-radius: 6px;
}
.card-title {
  margin: 0 0 3px;
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -.01em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-addr {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid #eef2f1;
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 550;
}
.meta span {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.meta svg {
  width: 15px;
  height: 15px;
  color: #8d9c9a;
  stroke-width: 1.9;
}
.meta .sep {
  width: 1px;
  height: 13px;
  background: var(--line);
}

/* ---------- EMPTY STATE ---------- */
.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 72px 24px;
  background: #fff;
  border: 1px dashed #d3dedc;
  border-radius: var(--radius);
}
.empty svg {
  width: 44px;
  height: 44px;
  color: #c0cfcc;
  margin-bottom: 14px;
  display: inline-block;
}
.empty h3 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}
.empty p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

/* =========================================================
   FIX: FORCE GRID at all viewport widths.
   - Overrides any stray `.grid` rule from base.css / responsive.css.
   - #grid.grid raises specificity above single-class rules.
   - Mobile single-column handled below at ≤640px.
   ========================================================= */
.grid,
#grid.grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)) !important;
  gap: 22px !important;
}

@media (max-width: 640px) {
  .grid,
  #grid.grid {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }
}

/* =========================================================
   FIX: force .layout to be a normal block child of body/main
   so its max-width + auto margins take effect again.
   ========================================================= */
.layout {
  display: grid !important;
  grid-template-columns: 264px 1fr !important;
  width: 100% !important;
  max-width: 1320px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box !important;
}

.layout > * {
  min-width: 0 !important;
}

/* Give the listing column the space it deserves */
#grid.grid {
  width: 100% !important;
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)) !important;
  gap: 22px !important;
}

@media (max-width: 1040px) {
  .layout {
    grid-template-columns: 1fr !important;
  }
}
/* ---- Price change badges ---- */
.drop-drop {
  color: #c2410c;
  background: #fff1ec;
}
.drop-drop-up,
.drop-up {
  color: #0d7a6b;
  background: #e6f2f0;
}