/* Listings page — Room / Home / PG / Shop */
body.listings-page {
  background: var(--paper);
}

body.listings-page .site-nav {
  background: var(--navy);
  border-bottom: 0;
}

.listings-wrap {
  padding: 1rem 0 3rem;
}

.listings-head {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 0.85rem;
  margin-bottom: 0.95rem;
}

.listings-head > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.listings-head h1 {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 4.5vw, 2.35rem);
  margin: 0 0 0.15rem;
  letter-spacing: -0.02em;
  color: var(--navy);
  line-height: 1.15;
}

.listings-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.3;
}

.mode-switch {
  display: inline-flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-self: center;
  padding: 0.18rem;
  background: #fff;
  border: 1px solid rgba(11, 28, 51, 0.1);
  border-radius: 10px;
  gap: 0.12rem;
  white-space: nowrap;
}

.mode-switch button {
  border: 0;
  background: transparent;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  font-weight: 650;
  font-size: 0.84rem;
  cursor: pointer;
  color: var(--ink-soft);
  white-space: nowrap;
  line-height: 1.2;
}

.mode-switch button.is-active {
  background: var(--navy);
  color: #fff;
}

@media (max-width: 640px) {
  .listings-head {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
  }

  .listings-head > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
  }

  .listings-head p {
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mode-switch {
    display: inline-flex;
    width: auto;
    grid-template-columns: none;
  }

  .mode-switch button {
    width: auto;
    padding: 0.38rem 0.62rem;
    font-size: 0.8rem;
  }
}

.search-bar {
  background: #fff;
  border: 1px solid rgba(11, 28, 51, 0.1);
  border-radius: 14px;
  padding: 0.85rem;
  margin-bottom: 1rem;
  box-shadow: 0 8px 24px rgba(11, 28, 51, 0.04);
}

.search-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 0.65rem;
  align-items: end;
}

/* Home: City | For | Budget | actions */
body[data-type="home"] .search-row {
  grid-template-columns: 1.3fr 1fr 1fr auto;
}

/* Shop: City | Budget | actions — no For, no Sharing */
body[data-type="shop"] .search-row {
  grid-template-columns: 1.4fr 1fr auto;
}

body[data-type="shop"] #for-wrap,
body[data-type="shop"] #sharing-wrap {
  display: none !important;
}

@media (max-width: 900px) {
  .search-row,
  body[data-type="home"] .search-row,
  body[data-type="shop"] .search-row,
  body[data-type="room"] .search-row,
  body[data-type="pg"] .search-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
  }

  .search-row .search-actions {
    grid-column: 1 / -1;
  }
}

.search-bar label {
  display: grid;
  gap: 0.28rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0;
}

.search-bar input,
.search-bar select {
  width: 100%;
  border-radius: 9px;
  border: 1px solid rgba(11, 28, 51, 0.12);
  background: #eef2f7;
  padding: 0.58rem 0.7rem;
  font-size: 0.88rem;
  color: var(--navy);
  appearance: none;
  -webkit-appearance: none;
}

.search-bar select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235a6b7d' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 1.7rem;
}

.search-bar input::placeholder {
  color: #8a97a8;
  font-size: 0.82rem;
}

.search-bar input:focus,
.search-bar select:focus {
  outline: none;
  border-color: rgba(11, 28, 51, 0.35);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(11, 28, 51, 0.08);
}

.search-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: nowrap;
  align-items: stretch;
}

.search-actions .btn {
  white-space: nowrap;
  min-height: 40px;
  flex: 1 1 auto;
  padding: 0.55rem 0.9rem;
  font-size: 0.88rem;
}

.search-actions .btn-primary {
  background: var(--navy);
  color: #fff;
}

.search-actions .btn-ghost {
  background: #fff;
  border: 1px solid rgba(11, 28, 51, 0.14);
  color: var(--navy);
}

@media (max-width: 640px) {
  .listings-wrap {
    padding: 0.85rem 0 2.5rem;
  }

  .search-bar {
    padding: 0.7rem;
    border-radius: 12px;
  }

  .search-actions .btn {
    min-height: 38px;
    padding: 0.5rem 0.75rem;
    font-size: 0.84rem;
  }
}

.near-hint {
  display: none;
  margin-top: 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: rgba(11, 28, 51, 0.06);
  color: var(--navy);
  font-size: 0.9rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.near-hint.is-on {
  display: flex;
}

.near-hint select {
  width: auto;
  min-width: 110px;
  background: #fff;
  border: 1px solid rgba(11, 28, 51, 0.12);
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
  color: var(--navy);
}

.results-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.results-meta strong {
  color: var(--navy);
  font-size: 1.05rem;
}

.results-meta span {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.listing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (min-width: 900px) {
  .listing-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.1rem;
  }
}

@media (min-width: 1100px) {
  .listing-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .listing-card .body {
    padding: 0.7rem 0.75rem 0.85rem;
  }

  .listing-card h3 {
    font-size: 0.92rem;
  }

  .listing-card .where {
    font-size: 0.78rem;
  }

  .listing-card .price {
    font-size: 0.92rem;
  }

  .listing-card .tag {
    font-size: 0.68rem;
  }

  .listing-card .view {
    font-size: 0.75rem;
  }
}

.listing-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid rgba(11, 28, 51, 0.08);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: riseIn 0.45s ease both;
}

.listing-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px rgba(11, 28, 51, 0.1);
}

.listing-card .thumb {
  aspect-ratio: 16 / 11;
  background: #d7dee8;
  position: relative;
  overflow: hidden;
}

.listing-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.listing-card .badge {
  position: absolute;
  left: 0.7rem;
  top: 0.7rem;
  background: rgba(11, 28, 51, 0.85);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
}

.listing-card .dist {
  position: absolute;
  right: 0.7rem;
  top: 0.7rem;
  background: var(--navy);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
}

.listing-card .body {
  padding: 0.95rem 1rem 1.1rem;
  display: grid;
  gap: 0.3rem;
  flex: 1;
}

.listing-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.12rem;
  color: var(--navy);
  line-height: 1.25;
}

.listing-card .where {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.listing-card .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.listing-card .tag {
  font-size: 0.75rem;
  background: #eef2f7;
  color: var(--navy);
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  font-weight: 600;
}

.listing-card .price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 0.65rem;
}

.listing-card .price {
  font-weight: 750;
  font-size: 1.05rem;
  color: var(--navy);
}

.listing-card .price small {
  font-weight: 500;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.listing-card .view {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  background: #fff;
  border-radius: 16px;
  border: 1px dashed rgba(11, 28, 51, 0.15);
  color: var(--ink-soft);
}
