:root {
  --bg1: #f4f7f9;
  --bg2: #e8eef2;
  --bg3: #dce8ec;
  --teal: #0d9488;
  --teal-d: #0f766e;
  --yellow: #facc15;
  --blue: #38bdf8;
  --ink: #0f172a;
  --muted: #64748b;
  --card: rgba(255, 255, 255, 0.92);
  font-family: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  min-height: 100vh;
  background: linear-gradient(
    165deg,
    var(--bg1) 0%,
    var(--bg2) 40%,
    #d5e8ea 70%,
    var(--bg3) 100%
  );
  background-attachment: fixed;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
  text-align: center;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 3.5rem 0.75rem 1rem;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.97), rgba(240, 253, 250, 0.95));
  border-bottom: 1px solid rgba(13, 148, 136, 0.15);
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
}

.logo {
  margin: 0;
  font-size: clamp(1.25rem, 4vw, 1.65rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink);
  font-variant: small-caps;
}

/* Hamburger */
.nav-toggle {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 10px;
  background: rgba(13, 148, 136, 0.12);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
}

.nav-toggle span {
  display: block;
  width: 1.25rem;
  height: 2px;
  background: var(--teal-d);
  border-radius: 1px;
}

.nav-toggle:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.nav-panel {
  display: none;
  position: absolute;
  right: 1rem;
  top: calc(100% + 6px);
  min-width: 220px;
  padding: 0.5rem 0;
  background: var(--card);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
  text-align: left;
  z-index: 200;
}

.nav-panel.open {
  display: block;
}

.nav-panel a {
  display: block;
  padding: 0.65rem 1.1rem;
  color: var(--teal-d);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.nav-panel a:hover {
  background: rgba(56, 189, 248, 0.12);
}

/* Map — mobile: full width; desktop: 12-col style 3-6-3 (25% / 50% / 25%), full-bleed row */
.map-wrap.map-layout-363 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 1.25rem 0 0;
  width: 100%;
}

.map-col-main {
  min-width: 0;
}

.map-col-side {
  display: none;
}

@media (min-width: 900px) {
  .map-wrap.map-layout-363 {
    grid-template-columns: 3fr 6fr 3fr;
    align-items: start;
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    column-gap: clamp(0.75rem, 2vw, 1.5rem);
  }

  .map-col-side {
    display: block;
  }
}

#map {
  width: 100%;
  height: min(52vh, 400px);
  min-height: 280px;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 12px 40px rgba(13, 148, 136, 0.1), 0 4px 12px rgba(15, 23, 42, 0.06);
  background: #dfe8ea;
}

@media (min-width: 900px) {
  #map {
    height: min(56vh, 520px);
    min-height: 320px;
  }
}

#map-status {
  margin-top: 0.6rem;
  font-size: 0.88rem;
  color: var(--muted);
  min-height: 1.4em;
}

#map-status.error {
  color: #b45309;
}

/* Google Maps InfoWindow content (built in app.js) */
.gm-info-bubble .gm-info-grid {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 0.45rem;
  row-gap: 0.1rem;
  margin: 0;
  font-size: 11px;
  line-height: 1.28;
  text-align: left;
}

.gm-info-bubble .gm-info-label {
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}

.gm-info-bubble .gm-info-value {
  color: #334155;
  word-break: break-word;
}

/* Custom map labels (injected into map pane) */
.pin-hit {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 14px 10px 10px;
  cursor: pointer;
  z-index: 1;
}

.pin-label {
  position: relative;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 8px 8px;
  border-radius: 6px;
  border: 1px solid #1e293b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  line-height: 1.2;
}

.pin-label::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  margin-left: -6px;
  border: 6px solid transparent;
  border-top-color: #1e293b;
}

.pin-label .sep {
  color: var(--muted);
  font-weight: 600;
  margin: 0 1px;
}

/* Table */
.table-section {
  margin-top: 2rem;
  width: 100%;
  max-width: 100%;
  max-height: min(70vh, 560px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: var(--card);
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.06);
}

.data-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.data-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, #f8fafc, #eef2f7);
  padding: 0.55rem 0.35rem;
  border-bottom: 2px solid var(--teal);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.data-grid thead th:hover {
  background: #e0f2fe;
}

.data-grid tbody td {
  padding: 0.45rem 0.35rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  vertical-align: middle;
}

.data-grid tbody tr:hover {
  background: rgba(250, 204, 21, 0.12);
}

.thumb {
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  margin: 0 auto 4px;
  background: #e2e8f0;
}

.addr-link {
  color: var(--teal-d);
  font-weight: 600;
  word-break: break-word;
}

.btn-icon {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  color: #94a3b8;
}

.btn-icon:hover {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
}

.btn-icon:focus-visible {
  outline: 2px solid var(--blue);
}

.btn-row {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
}

.btn-compare {
  margin-top: 0;
  padding: 0.65rem 1.75rem;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--teal-d));
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(13, 148, 136, 0.35);
}

.btn-compare:hover {
  filter: brightness(1.05);
}

.btn-compare:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 3px;
}

.btn-compare:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}

/* Add Property modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-dialog {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 16px;
  padding: 1.25rem 1.35rem 1.1rem;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(15, 23, 42, 0.08);
  text-align: left;
}

.modal-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

.modal-desc {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.modal-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.35rem;
}

.modal-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.modal-input {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.65rem;
  font-size: 0.9rem;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  background: #fff;
}

.modal-input:focus {
  outline: 2px solid rgba(13, 148, 136, 0.35);
  border-color: var(--teal);
}

.url-check {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  background: #16a34a;
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}

.url-check.is-visible {
  opacity: 1;
  transform: scale(1);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.15rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.btn-modal {
  padding: 0.5rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 999px;
  border: none;
  cursor: pointer;
}

.btn-modal-secondary {
  background: rgba(15, 23, 42, 0.06);
  color: var(--ink);
}

.btn-modal-secondary:hover {
  background: rgba(15, 23, 42, 0.1);
}

.btn-modal-primary {
  background: linear-gradient(135deg, var(--teal), var(--teal-d));
  color: #fff;
  box-shadow: 0 2px 10px rgba(13, 148, 136, 0.3);
}

.btn-modal-primary:hover:not(:disabled) {
  filter: brightness(1.05);
}

.btn-modal-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .data-grid {
    font-size: 0.7rem;
  }
  .thumb {
    width: 56px;
    height: 42px;
  }
}
