:root {
  --blue: #1a5fd0;
  --blue-dark: #134aa6;
  --ink: #1d2433;
  --muted: #5f6878;
  --line: #e2e5eb;
  --bg: #f6f7f9;
  --card: #fff;
  --heart: #e0245e;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 22px; color: var(--blue); text-decoration: none;
}
.brand svg { width: 28px; height: 28px; fill: var(--blue); }
.modes { display: flex; gap: 4px; }
.mode {
  border: 0; background: none; padding: 8px 14px; border-radius: 8px;
  font-weight: 600; cursor: pointer; color: var(--muted);
}
.mode:hover { background: var(--bg); }
.mode.active { color: var(--blue); background: #e8f0fd; }

/* Filters */
.filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--line);
}
.filters input, .filters select, .sort select {
  height: 38px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff;
}
.filters input { flex: 1 1 260px; min-width: 0; }
.link-btn { border: 0; background: none; color: var(--blue); font-weight: 600; cursor: pointer; padding: 8px; }

/* Map + results split */
.layout { flex: 1; display: grid; grid-template-columns: 1fr 1fr; min-height: 0; }
#map { height: 100%; min-height: 300px; }
.results { overflow-y: auto; padding: 16px 20px 40px; }
.results-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.results-head h1 { font-size: 20px; margin: 0; }
.results-head p { margin: 4px 0 0; font-size: 14px; }
.sort { font-size: 14px; color: var(--muted); display: flex; gap: 6px; align-items: center; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.12); cursor: pointer; position: relative;
  transition: box-shadow .15s, transform .15s;
}
.card:hover, .card.hl { box-shadow: 0 6px 18px rgba(0,0,0,.16); transform: translateY(-2px); }
.card .photo { aspect-ratio: 3 / 2; width: 100%; object-fit: cover; display: block; background: #dde3ec; }
.card .info { padding: 10px 12px 12px; }
.card .price { font-size: 20px; font-weight: 800; }
.card .facts { font-size: 14px; margin: 2px 0; }
.card .facts b { font-weight: 700; }
.card .addr { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge {
  position: absolute; top: 10px; left: 10px; background: rgba(255,255,255,.95);
  font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px;
}
.badge .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: #d93025; }
.badge.rent .dot { background: #7b3fe4; }
.fav {
  position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.25); cursor: pointer; display: grid; place-items: center;
}
.fav svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2; }
.fav.on svg { fill: var(--heart); stroke: var(--heart); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* Map price pins */
.pin {
  background: var(--blue); color: #fff; font-weight: 700; font-size: 12px;
  padding: 3px 7px; border-radius: 12px; white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,.3); border: 2px solid #fff;
  transform: translate(-50%, -50%); display: inline-block;
}
.pin.rent { background: #7b3fe4; }
.pin.hl { background: var(--ink); z-index: 1000; transform: translate(-50%, -50%) scale(1.15); }
.pin-wrap { background: none; border: 0; }

/* Detail dialog */
dialog {
  width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  border: 0; border-radius: 14px; padding: 0; overflow-y: auto;
}
dialog::backdrop { background: rgba(10,15,25,.55); }
.close {
  position: sticky; top: 10px; float: right; margin: 10px 10px 0 0; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25); font-size: 22px; cursor: pointer;
}
.d-photo { width: 100%; aspect-ratio: 16 / 8; object-fit: cover; display: block; background: #dde3ec; }
.d-body { padding: 20px 24px 28px; display: grid; grid-template-columns: 1.6fr 1fr; gap: 28px; }
.d-price { font-size: 30px; font-weight: 800; margin: 0; }
.d-facts { font-size: 17px; margin: 4px 0; }
.d-addr { color: var(--muted); margin: 0 0 16px; }
.d-features { list-style: none; padding: 0; margin: 4px 0 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; font-size: 15px; }
.d-features li { position: relative; padding-left: 28px; line-height: 1.4; }
.d-features li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; background: #e3f4ea; color: #1b7a43; font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; }
.d-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
.d-table td { padding: 8px 0; border-bottom: 1px solid var(--line); }
.d-table td:last-child { text-align: right; font-weight: 600; }
.panel { background: var(--bg); border-radius: var(--radius); padding: 16px; }
.panel h3 { margin: 0 0 10px; font-size: 16px; }
.panel label { display: block; font-size: 13px; color: var(--muted); margin-top: 8px; }
.panel input, .panel textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-top: 4px;
}
.panel textarea { min-height: 70px; resize: vertical; }
.btn {
  width: 100%; margin-top: 12px; height: 42px; border: 0; border-radius: 8px;
  background: var(--blue); color: #fff; font-weight: 700; cursor: pointer;
}
.btn:hover { background: var(--blue-dark); }
.est { font-size: 24px; font-weight: 800; }
.thanks { color: #137333; font-weight: 600; margin-top: 10px; }

/* Phones and small tablets: stack the map above the list */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  #map { height: 260px; }
  .results { overflow: visible; padding: 16px; }
  .filters, .topbar { padding-left: 16px; padding-right: 16px; }
  .d-body { grid-template-columns: 1fr; padding: 16px; }
}
@media (max-width: 480px) {
  .brand { font-size: 18px; }
  .mode { padding: 8px 10px; }
  .filters select { flex: 1 1 calc(50% - 4px); }
}

/* "Show all of Panay" map button */
.map-btn {
  background: #fff; border: 0; border-radius: 8px; padding: 8px 12px;
  font-weight: 600; font-size: 13px; color: var(--blue); cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.map-btn:hover { background: #f0f4fb; }

/* Listing titles, "Price on request" and the photo gallery in the details window */
.card .title { font-size: 14px; font-weight: 700; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .price.ask, .d-price.ask { font-size: 18px; color: var(--blue); }
.d-title { font-size: 20px; margin: 4px 0 2px; }
.d-gallery { position: relative; margin: 0; background: #0b1d33; }
.d-gallery .d-photo { object-fit: contain; background: #0b1d33; }
.d-gallery figcaption:not(:empty) {
  position: absolute; left: 12px; bottom: 12px; background: rgba(0,0,0,.65); color: #fff;
  font-size: 13px; padding: 4px 10px; border-radius: 6px;
}
.d-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.9); font-size: 24px; line-height: 1; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.d-nav.prev { left: 12px; }
.d-nav.next { right: 12px; }
.d-count { position: absolute; right: 12px; bottom: 12px; background: rgba(0,0,0,.65); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.d-thumbs { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px; background: #0b1d33; }
.d-thumbs button { flex: none; width: 76px; height: 52px; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; cursor: pointer; opacity: .6; background: #fff; }
.d-thumbs button[aria-current="true"] { border-color: #c8a45c; opacity: 1; }
.d-thumbs img { width: 100%; height: 100%; object-fit: cover; }

/* Inquiry form: spam trap, status message and privacy note */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.panel .form-msg:not(:empty) { font-size: 13px; font-weight: 600; color: var(--blue); margin: 10px 0 0; }
.panel .form-msg.error { color: #b3261e; }
.panel .privacy { font-size: 11.5px; color: var(--muted); line-height: 1.45; margin: 10px 0 0; }

/* Phones: logo on the first row, the menu on its own row that scrolls sideways if it's too long */
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 6px; padding-top: 8px; padding-bottom: 6px; }
  .modes { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .modes::-webkit-scrollbar { display: none; }
  .mode { flex: none; white-space: nowrap; }
}
