:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --ink: #16181d;
  --ink-soft: #5a6072;
  --ink-faint: #9aa0b4;
  --brand: #2b59ff;
  --brand-dark: #1e3fd0;
  --brand-soft: #eaf0ff;
  --rent: #0a8f5b;
  --rent-soft: #e4f6ee;
  --sale: #c2410c;
  --sale-soft: #fdecdf;
  --border: #e7e9f0;
  --shadow: 0 1px 2px rgba(18, 24, 40, .06), 0 8px 24px rgba(18, 24, 40, .06);
  --shadow-lg: 0 20px 48px rgba(18, 24, 40, .16);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 20px; }

a { color: inherit; text-decoration: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { font-weight: 800; font-size: 20px; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.brand-mark { color: var(--brand); font-size: 18px; }
.main-nav { display: flex; gap: 4px; margin-left: 8px; }
.nav-link {
  padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--ink-soft);
  transition: all .15s ease;
}
.nav-link:hover { background: var(--brand-soft); color: var(--brand); }
.nav-link.active { background: var(--brand-soft); color: var(--brand); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* ---------- Buttons ---------- */
.btn {
  font-family: inherit; font-weight: 600; font-size: 14px; border: 0; cursor: pointer;
  padding: 10px 18px; border-radius: 999px; transition: all .15s ease; white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(43,89,255,.28); }
.btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-block { width: 100%; justify-content: center; display: flex; }
.btn-lg { padding: 13px 24px; font-size: 15px; }
.btn-link { background: none; border: 0; color: var(--brand); font-weight: 600; cursor: pointer; font-size: 14px; font-family: inherit; }
.btn-sm { padding: 7px 13px; font-size: 13px; }

/* ---------- User chip ---------- */
.user-chip { position: relative; }
.user-chip > span {
  width: 38px; height: 38px; border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; cursor: pointer;
}
.user-menu {
  position: absolute; right: 0; top: 46px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 12px; min-width: 160px;
  display: none; flex-direction: column; gap: 8px;
}
.user-chip:hover .user-menu { display: flex; }
.user-menu-name { font-size: 13px; color: var(--ink-soft); font-weight: 600; }

/* ---------- Hero / search ---------- */
.hero {
  background: linear-gradient(135deg, #223 0%, #2b59ff 100%);
  border-radius: 24px; padding: 48px 40px; color: #fff; margin: 28px 0 24px;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); border-radius: 50%;
}
.hero h1 { font-size: 36px; font-weight: 800; letter-spacing: -.03em; margin-bottom: 8px; }
.hero p { opacity: .9; font-size: 16px; max-width: 520px; }

.search-bar {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr auto; gap: 10px;
  margin-top: 26px; position: relative; z-index: 2;
}
.search-bar .field { display: flex; flex-direction: column; gap: 4px; }
.search-bar label { font-size: 11px; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; padding-left: 4px; }
.input, .select {
  font-family: inherit; font-size: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 12px; background: var(--surface); color: var(--ink); width: 100%;
}
.input:focus, .select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* ---------- Segmented toggle ---------- */
.seg { display: inline-flex; background: #eef0f6; border-radius: 999px; padding: 4px; gap: 4px; }
.seg button {
  border: 0; background: none; font-family: inherit; font-weight: 700; font-size: 13px; color: var(--ink-soft);
  padding: 8px 18px; border-radius: 999px; cursor: pointer; transition: all .15s;
}
.seg button.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }

/* ---------- Listing grid ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 16px; }
.section-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.muted { color: var(--ink-soft); font-size: 14px; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

.card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
  box-shadow: var(--shadow); cursor: pointer; transition: transform .16s ease, box-shadow .16s ease;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card-media { position: relative; aspect-ratio: 16/10; background: #e9ebf2; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-media .noimg { width: 100%; height: 100%; display: grid; place-items: center; color: var(--ink-faint); font-size: 13px; }
.badge {
  position: absolute; top: 12px; left: 12px; font-size: 12px; font-weight: 700; padding: 5px 11px;
  border-radius: 999px; backdrop-filter: blur(4px);
}
.badge.rent { background: var(--rent-soft); color: var(--rent); }
.badge.sale { background: var(--sale-soft); color: var(--sale); }
.fav-btn {
  position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.92); border: 0; cursor: pointer; display: grid; place-items: center;
  font-size: 16px; color: #e23; transition: transform .12s;
}
.fav-btn:hover { transform: scale(1.1); }
.card-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-price { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.card-price small { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.card-title { font-weight: 600; font-size: 15px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-loc { font-size: 13px; color: var(--ink-soft); display: flex; align-items: center; gap: 5px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.chip { font-size: 12px; font-weight: 600; color: var(--ink-soft); background: #f1f2f7; padding: 4px 10px; border-radius: 8px; }

/* ---------- Detail ---------- */
.detail { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin: 24px 0; }
.detail-hero { aspect-ratio: 21/9; background: #e9ebf2; }
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.detail-body { padding: 28px; display: grid; grid-template-columns: 1fr 320px; gap: 28px; }
.detail h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 6px; }
.detail .price-lg { font-size: 30px; font-weight: 800; color: var(--brand); margin: 10px 0; }
.specs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 20px 0; }
.spec { background: var(--bg); border-radius: var(--radius-sm); padding: 12px 14px; }
.spec b { display: block; font-size: 15px; }
.spec span { font-size: 12px; color: var(--ink-soft); }
.aside-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; position: sticky; top: 88px; }

/* ---------- Forms / auth ---------- */
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; margin: 24px auto; max-width: 560px; }
.panel.wide { max-width: 760px; }
.panel h2 { font-size: 22px; font-weight: 800; margin-bottom: 4px; letter-spacing: -.02em; }
.panel .sub { color: var(--ink-soft); margin-bottom: 20px; font-size: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row.full { grid-column: 1 / -1; }
.form-row label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
textarea.input { resize: vertical; min-height: 90px; }
.switch-line { text-align: center; margin-top: 16px; font-size: 14px; color: var(--ink-soft); }

/* ---------- Misc ---------- */
.hidden { display: none !important; }
.empty { text-align: center; padding: 60px 20px; color: var(--ink-soft); }
.empty .big { font-size: 42px; margin-bottom: 10px; }
.skeleton { background: linear-gradient(90deg,#edeef3 25%,#f6f7fb 50%,#edeef3 75%); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: var(--radius); height: 320px; }
@keyframes sk { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(120%);
  background: var(--ink); color: #fff; padding: 13px 22px; border-radius: 999px; font-weight: 600;
  font-size: 14px; box-shadow: var(--shadow-lg); transition: transform .25s ease; z-index: 100; max-width: 90vw;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: #c0392b; }
.toast.success { background: #0a8f5b; }

.modal-overlay { position: fixed; inset: 0; background: rgba(18,24,40,.5); display: grid; place-items: center; z-index: 90; padding: 20px; }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 28px; width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; }

.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); font-weight: 600; font-size: 14px; margin: 20px 0 0; cursor: pointer; }
.back-link:hover { color: var(--brand); }

.site-footer { border-top: 1px solid var(--border); margin-top: 48px; padding: 24px 0; color: var(--ink-faint); font-size: 13px; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .search-bar { grid-template-columns: 1fr 1fr; }
  .detail-body { grid-template-columns: 1fr; }
  .main-nav { display: none; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .search-bar { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .hero { padding: 32px 22px; }
  .hero h1 { font-size: 27px; }
}

/* ===================== v2 additions ===================== */

/* Layout with filter sidebar */
.layout { display: grid; grid-template-columns: 260px 1fr; gap: 24px; align-items: start; }
.filters {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; position: sticky; top: 88px;
}
.filters h3 { font-size: 16px; font-weight: 800; margin-bottom: 16px; }
.filter-group { margin-bottom: 16px; }
.filter-group > label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.filter-group .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink); text-transform: none; letter-spacing: 0; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-soft);
  font-family: inherit; font-weight: 600; font-size: 13px; padding: 7px 14px; border-radius: 999px; cursor: pointer; transition: all .14s;
}
.pill:hover { border-color: var(--brand); color: var(--brand); }
.pill.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.results-area { min-width: 0; }
.sort-wrap { display: flex; align-items: center; gap: 12px; }
.sort-select { width: auto; padding: 8px 12px; font-weight: 600; font-size: 13px; }
.load-more-wrap { display: flex; justify-content: center; margin: 28px 0; }

/* Status tag */
.status-tag {
  position: absolute; top: 12px; right: 12px; font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .04em; padding: 5px 10px; border-radius: 999px; color: #fff; background: #555;
}
.status-tag.rented { background: #0a8f5b; }
.status-tag.sold { background: #c2410c; }
.status-tag.inactive { background: #9aa0b4; }

/* Gallery */
.gallery-main { aspect-ratio: 21/9; background: #e9ebf2; }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-main .noimg { width: 100%; height: 100%; display: grid; place-items: center; color: var(--ink-faint); }
.gallery-thumbs { display: flex; gap: 8px; padding: 10px; overflow-x: auto; background: #fafbff; }
.gallery-thumbs img { width: 84px; height: 60px; object-fit: cover; border-radius: 8px; cursor: pointer; opacity: .7; border: 2px solid transparent; flex: 0 0 auto; }
.gallery-thumbs img.active, .gallery-thumbs img:hover { opacity: 1; border-color: var(--brand); }

/* Contact reveal box */
.contact-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-top: 12px; }
.contact-row { font-size: 14px; margin: 4px 0; }
.contact-row a { color: var(--brand); font-weight: 600; }
.mini-label { font-size: 12px; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; display: block; margin-bottom: 6px; }

/* Uploader */
.uploader { display: flex; align-items: center; gap: 12px; }
.thumb-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.thumb { position: relative; width: 92px; height: 70px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 15px; line-height: 1; }

/* Inbox */
.inbox-tabs { display: flex; gap: 8px; margin: 18px 0; }
.inbox-tab { border: 1px solid var(--border); background: var(--surface); font-family: inherit; font-weight: 700; font-size: 14px; color: var(--ink-soft); padding: 9px 18px; border-radius: 999px; cursor: pointer; }
.inbox-tab.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.inq-list { display: flex; flex-direction: column; gap: 12px; }
.inq-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.inq-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.inq-prop { font-weight: 700; color: var(--brand); cursor: pointer; }
.inq-prop:hover { text-decoration: underline; }
.inq-loc { font-size: 13px; margin: 2px 0 8px; }
.inq-msg { color: var(--ink); margin-bottom: 8px; }
.inq-contact { font-size: 13px; color: var(--ink-soft); border-top: 1px dashed var(--border); padding-top: 8px; }
.inq-contact a { color: var(--brand); font-weight: 600; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .filters { position: static; }
}

/* ===================== Chennai focus additions ===================== */
.hero-city {
  display: inline-block; background: rgba(255,255,255,.18); color: #fff; font-weight: 700;
  font-size: 13px; padding: 5px 14px; border-radius: 999px; margin-bottom: 12px; backdrop-filter: blur(4px);
}
.pop-localities { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; position: relative; z-index: 2; }
.pop-localities > span { color: rgba(255,255,255,.85); font-size: 13px; font-weight: 600; }
.loc-chip {
  border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12); color: #fff;
  font-family: inherit; font-weight: 600; font-size: 13px; padding: 6px 14px; border-radius: 999px; cursor: pointer; transition: all .14s;
}
.loc-chip:hover { background: rgba(255,255,255,.25); }
.loc-chip.on { background: #fff; color: var(--brand); border-color: #fff; }
/* On the empty-state (white bg), tint chips to brand so they're readable */
.empty .loc-chip { border-color: var(--border); background: var(--surface); color: var(--ink-soft); }
.empty .loc-chip:hover { border-color: var(--brand); color: var(--brand); }

.relax-banner {
  background: #fff8e6; border: 1px solid #ffe3a3; color: #8a6d1a; font-weight: 600;
  font-size: 14px; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 4px;
}

/* Suggested (non-exact) result cards get a subtle "suggestion" ribbon */
.card.suggested { position: relative; }
.card.suggested::before {
  content: "Suggested"; position: absolute; z-index: 4; top: 10px; left: 50%; transform: translateX(-50%);
  background: #8a6d1a; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; padding: 3px 10px; border-radius: 999px; opacity: .92;
}
