/* ============ Chittis.com ============ */
:root {
  --brand: #0f6b4f;
  --brand-dark: #0a4a37;
  --accent: #e8833a;
  --ink: #1d2733;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f6f8fa;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(15, 30, 50, .08);
  --topbar-h: 62px;
  --filterbar-h: 54px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
a { color: var(--brand); }

/* ---------- Header ---------- */
.topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  z-index: 1000;
}
.brand { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.brand .brand-name, .brand .brand-tag { align-self: center; }
.brand-logo { width: 34px; height: 34px; align-self: center; flex: 0 0 auto; }
.brand-name { font-size: 22px; font-weight: 800; color: var(--brand-dark); letter-spacing: -.5px; }
.brand-accent { color: var(--accent); }
.brand-tag { font-size: 11px; color: var(--muted); display: none; }
@media (min-width: 1100px) { .brand-tag { display: inline; } }

.top-search { flex: 1; display: flex; max-width: 560px; }
.top-search input {
  flex: 1; height: 40px; padding: 0 14px;
  border: 1.5px solid var(--line); border-right: none;
  border-radius: 8px 0 0 8px; font-size: 14px; outline: none;
}
.top-search input:focus { border-color: var(--brand); }
.top-search button {
  width: 46px; border: none; border-radius: 0 8px 8px 0;
  background: var(--brand); color: #fff; font-size: 16px; cursor: pointer;
}
.top-search button:hover { background: var(--brand-dark); }

.topnav { display: flex; gap: 6px; margin-left: auto; }
.nav-chip {
  padding: 8px 16px; border-radius: 20px; border: 1.5px solid var(--line);
  background: #fff; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink);
}
.nav-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.post-link {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 20px; margin-left: 6px;
  background: var(--accent); color: #fff; text-decoration: none;
  font-size: 13px; font-weight: 700; white-space: nowrap;
}
.post-link:hover { background: #d06f28; }
.post-link small {
  background: #fff; color: var(--accent); font-size: 9.5px; font-weight: 800;
  padding: 2px 6px; border-radius: 8px;
}

/* ---------- Demo banner ---------- */
.demo-banner {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 7px 16px;
  background: linear-gradient(90deg, #fff7ed, #ffedd5);
  border-bottom: 1px solid #fed7aa;
  color: #9a3412; font-size: 12.5px;
  z-index: 950;
}
.demo-banner.hidden { display: none; }
.demo-banner button {
  border: none; background: transparent; color: #9a3412;
  font-size: 13px; cursor: pointer; padding: 2px 6px;
}
.badge-demo {
  position: absolute; top: 10px; right: 10px;
  padding: 3px 8px; border-radius: 6px; font-size: 10px; font-weight: 800;
  background: rgba(232, 131, 58, .92); color: #fff; letter-spacing: .5px;
}

/* ---------- Filter bar ---------- */
.filterbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 18px;
  background: #fff; border-bottom: 1px solid var(--line);
  overflow-x: auto;
  z-index: 900;
}
.filterbar select, .filterbar input {
  height: 36px; padding: 0 10px;
  border: 1.5px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 13px; color: var(--ink); outline: none;
  flex: 0 0 auto;
}
.filterbar select:focus, .filterbar input:focus { border-color: var(--brand); }
#fPin { width: 100px; }
.btn-outline {
  height: 36px; padding: 0 12px; border-radius: 8px;
  border: 1.5px dashed var(--brand); background: #eef7f3;
  color: var(--brand-dark); font-size: 13px; font-weight: 600; cursor: pointer;
  flex: 0 0 auto;
}
.btn-outline.drawing { background: var(--brand); color: #fff; border-style: solid; }
.btn-clear {
  height: 36px; padding: 0 12px; border: none; border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 13px; cursor: pointer;
  flex: 0 0 auto;
}
.btn-clear:hover { color: #c0392b; }

/* ---------- Layout ---------- */
.content { flex: 1; display: flex; min-height: 0; }
#map { flex: 1.4; min-width: 0; }
.listings {
  flex: 1; max-width: 560px; min-width: 340px;
  display: flex; flex-direction: column;
  background: var(--bg); border-left: 1px solid var(--line);
}
.listings-head {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 8px;
}
.listings-head h2 { margin: 0; font-size: 16px; }
.listings-head select {
  height: 32px; border: 1.5px solid var(--line); border-radius: 8px;
  font-size: 12.5px; padding: 0 8px; background: #fff; outline: none;
}
.cards {
  flex: 1; overflow-y: auto; padding: 4px 16px 20px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px;
  grid-auto-rows: max-content; align-content: start;
}
.no-results {
  grid-column: 1 / -1; text-align: center; color: var(--muted);
  padding: 60px 20px; font-size: 14px;
}

/* ---------- Property card ---------- */
.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer;
  border: 2px solid transparent;
  transition: transform .12s ease, border-color .12s ease;
}
.card:hover, .card.hovered { transform: translateY(-2px); border-color: var(--brand); }
.card-img { position: relative; height: 150px; background: #dde5ec; }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge {
  position: absolute; top: 10px; left: 10px;
  padding: 3px 9px; border-radius: 6px; font-size: 11px; font-weight: 700; color: #fff;
}
.badge.sale { background: var(--brand); }
.badge.rent { background: #7c3aed; }
.badge-type {
  position: absolute; bottom: 10px; left: 10px;
  padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600;
  background: rgba(17, 24, 39, .72); color: #fff;
}
.card-body { padding: 10px 12px 12px; }
.card-price { font-size: 17px; font-weight: 800; color: var(--brand-dark); }
.card-price small { font-weight: 500; color: var(--muted); }
.card-title { font-size: 13.5px; font-weight: 600; margin: 3px 0 2px; }
.card-loc { font-size: 12px; color: var(--muted); }
.card-specs {
  display: flex; gap: 10px; margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--line); font-size: 12px; color: var(--ink);
}
.card-specs span b { color: var(--brand-dark); }

/* ---------- Map popup ---------- */
.leaflet-popup-content { margin: 10px 12px; }
.popup { width: 210px; font-family: inherit; }
.popup img { width: 100%; height: 110px; object-fit: cover; border-radius: 8px; }
.popup .p-price { font-size: 15px; font-weight: 800; color: var(--brand-dark); margin-top: 6px; }
.popup .p-title { font-size: 12.5px; font-weight: 600; }
.popup .p-loc { font-size: 11.5px; color: var(--muted); }
.popup .p-specs { font-size: 11.5px; margin-top: 4px; }
.popup button {
  margin-top: 8px; width: 100%; height: 30px; border: none; border-radius: 7px;
  background: var(--brand); color: #fff; font-weight: 700; cursor: pointer; font-size: 12px;
}
.popup button:hover { background: var(--brand-dark); }

/* price pin markers */
.price-pin {
  background: var(--brand-dark); color: #fff; font-weight: 700; font-size: 11px;
  padding: 3px 8px; border-radius: 12px; white-space: nowrap;
  border: 2px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,.35);
  display: inline-block; transform: translate(-50%, -100%);
}
.price-pin.rent { background: #7c3aed; }
.price-pin::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: inherit;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(15, 23, 42, .55);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal.hidden { display: none; }
.modal-box {
  position: relative; background: #fff; border-radius: 16px;
  width: min(860px, 100%); max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-close {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: rgba(17,24,39,.65); color: #fff; font-size: 15px; cursor: pointer;
}
.m-img { height: 320px; }
.m-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 16px 16px 0 0; }
.m-body { padding: 20px 26px 26px; }
.m-price { font-size: 26px; font-weight: 800; color: var(--brand-dark); }
.m-price small { font-size: 14px; color: var(--muted); font-weight: 500; }
.m-title { font-size: 18px; font-weight: 700; margin: 4px 0 2px; }
.m-loc { color: var(--muted); font-size: 14px; }
.m-badges { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.m-badges span {
  padding: 4px 12px; border-radius: 16px; font-size: 12px; font-weight: 600;
  background: #eef7f3; color: var(--brand-dark); border: 1px solid #cfe6dc;
}
.m-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px; margin: 18px 0; padding: 16px;
  background: var(--bg); border-radius: 12px;
}
.m-grid div { font-size: 13px; }
.m-grid div b { display: block; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 2px; }
.m-desc { font-size: 14px; line-height: 1.6; color: #334155; }
.m-amenities { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.m-amenities span {
  font-size: 12.5px; padding: 5px 12px; border-radius: 8px;
  background: #f1f5f9; border: 1px solid var(--line);
}
.m-contact {
  margin-top: 18px; padding: 16px; border-radius: 12px;
  background: linear-gradient(120deg, var(--brand-dark), var(--brand));
  color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.m-contact .agent b { font-size: 15px; }
.m-contact .agent p { margin: 2px 0 0; font-size: 12.5px; opacity: .9; }
.m-contact a {
  background: #fff; color: var(--brand-dark); text-decoration: none;
  padding: 10px 20px; border-radius: 9px; font-weight: 700; font-size: 14px;
}

/* ---------- Footer ---------- */
.footer {
  flex: 0 0 auto; padding: 8px 18px; background: #fff;
  border-top: 1px solid var(--line);
}
.footer p { margin: 0; font-size: 11.5px; color: var(--muted); }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  body { overflow: auto; height: auto; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 12px; gap: 10px; }
  .top-search { order: 3; flex-basis: 100%; max-width: none; }
  .content { flex-direction: column; }
  #map { height: 55vh; flex: none; }
  .listings { max-width: none; min-width: 0; border-left: none; }
  .cards { max-height: none; }
}
