/* =============================================================
   RMR MAP LAYERS
   Overlay stack + the control that switches it on and off.
   Tokens (--surface, --accent, --border, --text, --text-muted)
   come from map.css. Nothing here redefines them.
   ============================================================= */

/* ── The overlay stack, inside #zoom-container ─────────────── */


/* Dimmer above aerial */
#rmr-layer-scrim {
  position: absolute;
  inset: 0;
  background: var(--bg, #0a0c0f);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.35s ease;
}

/* Map overlays above aerial + scrim */
#rmr-layer-stack {
  position: absolute;
  transform-origin: 0 0;
  pointer-events: none;
  z-index: 0;
}

#rmr-layer-stack img {
  position: absolute;
  max-width: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  image-rendering: auto;
  transition: opacity 0.28s ease;
}

#rmr-layer-stack img.is-on {
  visibility: visible;
  opacity: var(--rmr-layer-opacity, 1);
}

/* Property / amenity pins above map overlays */
#hotspots {
  position: absolute;
  z-index: 2;
}

/* ── Trigger button ────────────────────────────────────────── */

#rmr-layers-btn {
  position: fixed;
  top: 120px;
  right: 24px;
  z-index: 9999;

  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;

  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 9999px;
  background: var(--surface, #13161c);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

  color: var(--text-muted, #9ca3af);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.25s ease, background 0.25s ease;
}

#rmr-layers-btn:hover {
  color: var(--text, #f4f4f5);
}

#rmr-layers-btn.is-open {
  background: var(--accent, #c9a962);
  color: var(--bg, #0a0c0f);
}

#rmr-layers-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

#rmr-layers-btn .rmr-layers-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9999px;
  background: var(--accent, #c9a962);
  color: var(--bg, #0a0c0f);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

#rmr-layers-btn.is-open .rmr-layers-count {
  background: var(--bg, #0a0c0f);
  color: var(--accent, #c9a962);
}

#rmr-layers-btn .rmr-layers-count:empty {
  display: none;
}

/* ── Panel ─────────────────────────────────────────────────── */

#rmr-layers-panel {
  position: fixed;
  top: 185px;
  right: 24px;
  z-index: 9999;
  width: 268px;

  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 16px;
  background: var(--surface, #13161c);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);

  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}

#rmr-layers-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.rmr-layers-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
}

.rmr-layers-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text, #f4f4f5);
}

.rmr-layers-clear {
  border: none;
  background: none;
  padding: 0;
  color: var(--text-muted, #9ca3af);
  font-family: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.rmr-layers-clear:hover {
  color: var(--accent, #c9a962);
}

.rmr-layers-clear[disabled] {
  opacity: 0.3;
  cursor: default;
}

.rmr-layers-list {
  padding: 0 8px 6px;
  max-height: min(48vh, 380px);
  overflow-y: auto;
}

.rmr-layer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 8px;

  border: none;
  border-radius: 10px;
  background: none;

  color: var(--text-muted, #9ca3af);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.rmr-layer-row:hover {
  background: var(--surface-alt, #1a1e26);
  color: var(--text, #f4f4f5);
}

.rmr-layer-row[aria-pressed="true"] {
  color: var(--text, #f4f4f5);
}

/* The swatch is the map key: it carries the colour the layer
   actually draws with, so the panel doubles as a legend. */
.rmr-layer-swatch {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background: var(--swatch, #c9a962);
  opacity: 0.4;
  transition: opacity 0.18s ease, box-shadow 0.18s ease;
}

.rmr-layer-row[aria-pressed="true"] .rmr-layer-swatch {
  opacity: 1;
  box-shadow: 0 0 0 1px var(--swatch, #c9a962);
}

.rmr-layer-name {
  flex: 1 1 auto;
  min-width: 0;
}

.rmr-layer-check {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  stroke: var(--accent, #c9a962);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.rmr-layer-row[aria-pressed="true"] .rmr-layer-check {
  opacity: 1;
}

.rmr-layers-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px 14px;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  font-size: 0.72rem;
  color: var(--text-muted, #9ca3af);
}

.rmr-layers-foot label {
  flex: 0 0 auto;
}

#rmr-layers-opacity {
  flex: 1 1 auto;
  min-width: 0;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 9999px;
  background: var(--surface-alt, #1a1e26);
  cursor: pointer;
}

#rmr-layers-opacity::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border: none;
  border-radius: 50%;
  background: var(--accent, #c9a962);
}

#rmr-layers-opacity::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: none;
  border-radius: 50%;
  background: var(--accent, #c9a962);
}

#rmr-layers-btn:focus-visible,
.rmr-layer-row:focus-visible,
.rmr-layers-clear:focus-visible,
#rmr-layers-opacity:focus-visible {
  outline: 2px solid var(--accent, #c9a962);
  outline-offset: 2px;
}


/* =============================================================
LAYER GROUPS
============================================================= */

.rmr-layer-group {
    display: flex;
    flex-direction: column;
}

.rmr-layer-children {
    position: relative;

    display: flex;
    flex-direction: column;

    margin: 2px 0 6px 18px;
    padding-left: 12px;

    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.rmr-layer-row-child {
    min-height: 36px;
    padding-left: 8px;

    font-size: 0.8rem;
}

.rmr-layer-row-child .rmr-layer-swatch {
    width: 14px;
    height: 14px;
}

.rmr-layer-row-parent {
    font-weight: 600;
}

/* Parent has some, but not all, children enabled */
.rmr-layer-row-parent.is-partial .rmr-layer-check {
    opacity: 0.45;
}
/* ── Mobile ────────────────────────────────────────────────── */

@media (max-width: 680px) {
  #rmr-layers-btn {
    top: 72px;
    right: 16px;
    padding: 8px 13px;
  }

  #rmr-layers-panel {
    top: 116px;
    right: 16px;
    left: 16px;
    width: auto;
  }

  .rmr-layers-list {
    max-height: 46vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  #rmr-layer-stack img,
  #rmr-layer-scrim,
  #rmr-layers-panel {
    transition-duration: 0.01ms;
  }
}
