/* Novamira Estate Map v3 — InSite-style. Class-first BEM, no #id selectors.
   Brand color pulled from ACSS --primary; peach/cream surfaces match the reference. */

.nem {
  --nem-primary: var(--primary, #00431E);
  --nem-primary-h: var(--primary-hover, #00351a);
  /* Surface tints — shades of green derived from the primary */
  --nem-peach:   #cfe0c4;
  --nem-peach-d: #bcd2ae;
  --nem-cream:   #eef3e9;
  --nem-surface: #ffffff;
  --nem-border:  rgba(0, 0, 0, 0.1);
  --nem-muted:   rgba(0, 0, 0, 0.5);
  --nem-accent:  var(--accent, #E58A2D);

  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  min-height: 520px;
  position: relative;
  font-family: inherit;
  overflow: hidden;
  background: var(--nem-cream);
}

/* ---- Filter bar (top, peach) ---- */
.nem__filterbar {
  flex-shrink: 0;
  background: var(--nem-peach);
  padding: 22px 28px 20px;
}
.nem__filters { display: flex; flex-direction: column; gap: 16px; }
.nem__filters-sliders {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 36px;
}
.nem__filter { min-width: 0; }
.nem__filter-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.nem__filter-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--nem-primary);
}
.nem__filter-val { font-size: 12px; color: var(--nem-primary); opacity: 0.7; white-space: nowrap; }
.nem__filter-track { position: relative; height: 18px; }
.nem__filter-range {
  position: absolute; left: 0; right: 0; top: 4px; width: 100%; margin: 0;
  pointer-events: none; -webkit-appearance: none; appearance: none; background: transparent;
}
.nem__filter-range::-webkit-slider-thumb {
  pointer-events: auto; -webkit-appearance: none;
  height: 16px; width: 16px; border-radius: 50%; background: var(--nem-primary);
  cursor: pointer; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.nem__filter-range::-moz-range-thumb {
  pointer-events: auto; height: 16px; width: 16px; border-radius: 50%;
  background: var(--nem-primary); cursor: pointer; border: 2px solid #fff;
}
.nem__filter-rail { position: absolute; left: 0; right: 0; top: 9px; height: 4px; background: rgba(0,0,0,0.18); border-radius: 2px; }
.nem__filter-fill { position: absolute; top: 9px; height: 4px; background: var(--nem-primary); border-radius: 2px; }

.nem__filters-actions { display: flex; gap: 12px; }
.nem__filter-search, .nem__filter-reset {
  padding: 10px 28px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
  line-height: 1;
}
.nem__filter-search { background: var(--nem-primary); color: #fff; border: 1px solid var(--nem-primary); }
.nem__filter-search:hover { background: var(--nem-primary-h); }
.nem__filter-reset { background: transparent; color: var(--nem-primary); border: 1px solid var(--nem-primary); }
.nem__filter-reset:hover { background: rgba(0,0,0,0.05); }

/* ---- Body grid (map + panel) ---- */
.nem__body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.nem--masterplan .nem__body { grid-template-columns: 1fr; }
.nem--masterplan .nem__panel { display: none; }

/* ---- Map panel (left) ---- */
.nem__map-panel { position: relative; overflow: hidden; min-width: 0; background: var(--nem-cream); }
.nem__viewport { position: absolute; inset: 0; overflow: hidden; touch-action: none; }
.nem__canvas { width: 100%; height: 100%; }
.nem__canvas svg { width: 100%; height: 100%; display: block; cursor: grab; }
.nem__canvas svg.is-panning { cursor: grabbing; }

/* SVG zones */
.nem__zone { cursor: pointer; transition: fill-opacity 0.15s, stroke 0.15s; fill-opacity: 0.55; stroke: rgba(255,255,255,0.85); stroke-width: 2; }
.nem__zone:hover { fill-opacity: 0.8; }
.nem__zone.is-hidden { display: none; }
.nem__zone.is-dim { fill-opacity: 0.1; pointer-events: none; }
.nem__zone.is-hl  { fill-opacity: 1; stroke: #fff; stroke-width: 3; }
.nem__zone-label {
  font-size: 28px; font-weight: 700; fill: #fff; text-anchor: middle;
  dominant-baseline: middle; pointer-events: none;
  paint-order: stroke; stroke: rgba(0,0,0,0.35); stroke-width: 3px;
}
.nem__poi { cursor: pointer; }
.nem__poi-dot { fill: #fff; stroke: var(--nem-primary); stroke-width: 3; }

/* Map legend overlay (stage names on masterplan) */
.nem__legend {
  position: absolute; top: 14px; left: 14px;
  background: rgba(255,255,255,0.93); backdrop-filter: blur(4px);
  padding: 10px 14px; display: flex; flex-direction: column; gap: 7px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18); pointer-events: auto; max-width: 220px;
}
.nem__legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: var(--nem-primary); cursor: pointer; user-select: none; white-space: nowrap; }
.nem__legend-item.is-off { opacity: 0.38; text-decoration: line-through; }
.nem__legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Back button */
.nem__back {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--nem-primary); color: #fff; border: 0; padding: 9px 18px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.25); white-space: nowrap;
}
.nem__back:hover { background: var(--nem-primary-h); }

/* Zoom controls */
.nem__controls { position: absolute; bottom: 20px; right: 16px; display: flex; flex-direction: column; box-shadow: 0 2px 8px rgba(0,0,0,0.18); }
.nem__ctrl {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border: 0; border-bottom: 1px solid var(--nem-border); background: #fff; cursor: pointer;
  color: var(--nem-primary); font-size: 16px; font-weight: 700; line-height: 1;
}
.nem__ctrl:last-child { border-bottom: 0; }
.nem__ctrl--fit::after { content: "\26F6"; font-size: 14px; font-weight: 400; }
.nem__ctrl:hover { background: var(--nem-cream); }

/* ---- Right panel ---- */
.nem__panel {
  min-width: 0; display: flex; flex-direction: column;
  background: var(--nem-cream); overflow: hidden;
}

/* Panel head: "Land for sale" + status legend + download buttons */
.nem__panel-head { flex-shrink: 0; padding: 22px 28px 18px; }
.nem__panel-title { font-size: 26px; font-weight: 500; color: var(--nem-primary); margin: 0 0 12px; }
.nem__statuslegend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 16px; }
.nem__statuslegend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--nem-primary); }
.nem__statuslegend-dot { width: 9px; height: 9px; border-radius: 50%; }
.nem__downloads { display: flex; flex-wrap: wrap; gap: 10px; }
.nem__download-btn {
  padding: 9px 16px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; text-decoration: none; cursor: pointer;
  color: var(--nem-primary); background: transparent; border: 1px solid var(--nem-primary);
  border-radius: 2px; white-space: nowrap;
}
.nem__download-btn:hover { background: var(--nem-primary); color: #fff; }
.nem__download-btn.is-disabled { opacity: 0.4; pointer-events: none; }

/* ---- Lot list (accordion of stages) ---- */
.nem__list { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 0 28px 28px; }
.nem__group { margin-bottom: 14px; }

.nem__group-header {
  display: flex; align-items: stretch; gap: 0;
  background: var(--nem-peach); cursor: pointer; user-select: none;
  overflow: hidden;
}
.nem__group-titles { flex: 1; min-width: 0; padding: 14px 18px; display: flex; flex-direction: column; gap: 2px; }
.nem__group-name { font-size: 16px; font-weight: 600; color: var(--nem-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nem__group-avail { font-size: 12px; color: var(--nem-primary); opacity: 0.7; }
.nem__group-flyer {
  align-self: center; font-size: 12px; font-weight: 500; color: var(--nem-primary);
  text-decoration: none; white-space: nowrap; padding: 0 16px; flex-shrink: 0;
}
.nem__group-flyer:hover { text-decoration: underline; }
.nem__group-toggle {
  flex-shrink: 0; width: 48px; background: var(--nem-primary); color: #fff;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.nem__group-toggle::after { content: "+"; font-size: 24px; font-weight: 300; line-height: 1; }
.nem__group.is-open .nem__group-toggle::after { content: "\2212"; }

/* Accordion body */
.nem__group:not(.is-open) .nem__group-body { display: none; }
.nem__group-body { background: var(--nem-surface); }

.nem__group-results {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--nem-border);
}
.nem__group-count { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--nem-primary); }
.nem__group-reset {
  background: var(--nem-peach); color: var(--nem-primary); border: 0; border-radius: 2px;
  padding: 6px 16px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; cursor: pointer;
}
.nem__group-reset:hover { background: var(--nem-peach-d); }

/* ---- Lot table ---- */
.nem__table { width: 100%; border-collapse: collapse; font-size: 13px; }
.nem__table th {
  text-align: left; font-size: 11px; font-weight: 600; color: var(--nem-muted);
  padding: 10px 12px; border-bottom: 1px solid var(--nem-border); white-space: nowrap;
}
.nem__table td { padding: 11px 12px; border-bottom: 1px solid rgba(0,0,0,0.06); color: var(--nem-primary); vertical-align: middle; }
.nem__trow { cursor: pointer; }
.nem__trow:hover { background: var(--nem-cream); }
.nem__trow.is-sel { background: rgba(0,0,0,0.05); }
.nem__trow.is-hidden { display: none; }
.nem__td-lot { display: flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.nem__lot-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.nem__td-price { font-weight: 600; white-space: nowrap; }
.nem__td-view { text-align: right; }
.nem__lot-view {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; border: 0; cursor: pointer;
  color: var(--nem-accent); font-size: 12px; font-weight: 600; white-space: nowrap; padding: 0;
}
.nem__lot-view:hover { text-decoration: underline; }
.nem__lot-view-pin { width: 12px; height: 12px; display: inline-block; }
.nem__lot-view-pin::before { content: "\1F4CD"; font-size: 12px; }

/* ---- Popup overlay ---- */
.nem__popup { position: absolute; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 20; }
.nem__popup-inner { background: #fff; max-width: 380px; width: calc(100% - 32px); max-height: 90%; overflow: auto; }
.nem__popup-close {
  position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border: 0;
  background: rgba(255,255,255,0.9); font-size: 22px; cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}

/* Enquiry modal (WS Form) — dark green theme, white underline fields, orange submit */
.nem__enquiry-inner {
  max-width: 640px; padding: 36px 40px 40px;
  background: var(--nem-primary); color: #fff;
}
.nem__popup--enquiry .nem__popup-close { color: #fff; background: transparent; }
.nem__enquiry-title { font-size: 26px; font-weight: 500; margin: 0 0 4px; color: #fff; text-align: left; }
.nem__enquiry-lot { display: block; font-weight: 400; color: rgba(255,255,255,0.75); font-size: 14px; margin: 4px 0 20px; text-align: left; }

/* WS Form field styling scoped to the modal — !important to win over WS Form's own CSS */
.nem__enquiry-inner .wsf-label { color: #fff !important; font-weight: 600 !important; font-size: 14px !important; }
.nem__enquiry-inner .wsf-label .wsf-required,
.nem__enquiry-inner .wsf-required { color: #fff !important; }
.nem__enquiry-inner input.wsf-field,
.nem__enquiry-inner select.wsf-field,
.nem__enquiry-inner textarea.wsf-field {
  background: transparent !important; color: #fff !important;
  border: 0 !important; border-bottom: 1px solid rgba(255,255,255,0.55) !important;
  border-radius: 0 !important; padding: 6px 0 !important; box-shadow: none !important;
}
.nem__enquiry-inner .wsf-field::placeholder { color: rgba(255,255,255,0.6) !important; }
.nem__enquiry-inner .wsf-field:focus { border-bottom-color: #fff !important; outline: none !important; box-shadow: none !important; }
.nem__enquiry-inner select.wsf-field { -webkit-appearance: none; appearance: none; }
.nem__enquiry-inner option { color: #222 !important; background: #fff !important; }
.nem__enquiry-inner .wsf-checkbox-label,
.nem__enquiry-inner .wsf-legend { color: #fff !important; }
.nem__enquiry-inner a { color: #fff !important; text-decoration: underline; }
.nem__enquiry-inner .wsf-button {
  background: var(--nem-accent) !important; color: #fff !important; border: 0 !important;
  border-radius: 3px !important; padding: 11px 26px !important; font-size: 14px !important;
  font-weight: 600 !important; cursor: pointer; text-transform: none !important;
  letter-spacing: 0 !important; box-shadow: none !important; width: auto !important;
}
.nem__enquiry-inner .wsf-button:hover { filter: brightness(1.08); }

/* ---- Lot drawer (slides in from right) ---- */
.nem__popup--drawer { background: rgba(0,0,0,0.35); justify-content: flex-end; align-items: stretch; }
.nem__popup--drawer .nem__popup-inner {
  max-width: 460px; width: 92%; height: 100%; max-height: 100%;
  background: #fff; overflow-y: auto; margin: 0;
  transform: translateX(100%); transition: transform 0.32s ease;
}
.nem__popup--drawer.is-open .nem__popup-inner { transform: translateX(0); }
.nem__popup--drawer .nem__popup-close {
  background: transparent; color: var(--nem-primary); font-size: 26px; top: 18px; right: 18px;
}

.nem__drawer { padding: 64px 32px 32px; }
.nem__drawer-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.nem__drawer-titlewrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nem__drawer-title { font-size: 26px; font-weight: 500; color: var(--nem-primary); margin: 0; }
.nem__drawer-price { font-size: 22px; font-weight: 500; color: var(--nem-primary); white-space: nowrap; }
.nem__drawer-acts { display: flex; gap: 12px; margin-bottom: 22px; }
.nem__drawer-btn {
  flex: 1; text-align: center; padding: 13px 14px; font-size: 12px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none; cursor: pointer;
  border-radius: 2px; border: 1px solid var(--nem-primary); white-space: nowrap;
}
.nem__drawer-btn--ghost { background: #fff; color: var(--nem-primary); }
.nem__drawer-btn--primary { background: var(--nem-primary); color: #fff; }
.nem__drawer-btn:hover { opacity: 0.88; }
.nem__drawer-img { width: 100%; height: auto; display: block; border-radius: 4px; margin-bottom: 24px; }
.nem__drawer-specs { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 18px; }
.nem__drawer-spec { display: flex; align-items: flex-start; gap: 10px; padding-top: 14px; border-top: 1px solid var(--nem-border); }
.nem__drawer-spec-icon { color: var(--nem-primary); flex-shrink: 0; line-height: 0; margin-top: 2px; }
.nem__drawer-spec-label { font-size: 14px; font-weight: 600; color: var(--nem-primary); }
.nem__drawer-spec-val { font-size: 14px; color: var(--nem-muted); margin-top: 2px; }
.nem__badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; color: #fff; vertical-align: middle; }

@media (max-width: 520px) {
  .nem__popup--drawer .nem__popup-inner { width: 100%; max-width: none; }
}

/* POI popup */
.nem__lot-img { width: 100%; height: auto; display: block; }
.nem__poi-body { padding: 24px; }
.nem__poi-title { font-size: 20px; margin: 0 0 12px; color: var(--nem-primary); }
.nem__poi-text { font-size: 14px; line-height: 1.5; color: var(--nem-muted); margin: 0; }

/* ---- Loading overlay ---- */
.nem__loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.88); font-size: 14px; color: var(--nem-muted); z-index: 30; }
.nem__loading.is-done { display: none; }
.nem.is-error .nem__loading { color: #b00; }

[hidden] { display: none !important; }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .nem { height: auto; }
  .nem__filterbar { padding: 16px; }
  .nem__filters-sliders { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .nem__body { grid-template-columns: 1fr; grid-template-rows: auto auto; }
  .nem--masterplan .nem__body { grid-template-rows: auto; }
  .nem__map-panel { height: 60vw; min-height: 280px; }
  .nem__panel { width: 100%; max-height: 70vh; }
}
@media (max-width: 520px) {
  .nem__filters-sliders { grid-template-columns: 1fr; }
}
