/* ===== Base / iframe-friendly layout ===== */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f2f2f2;
  -webkit-text-size-adjust: 100%;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ===== Map stage ===== */
#stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;            /* we handle pan/zoom ourselves */
  cursor: grab;
  background: #f2f2f2;
}
#stage.is-panning { cursor: grabbing; }

#map-host,
#map-host svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Stands are invisible click targets (hotspot rects) overlaid on the map.
   They carry their category color as fill; we hide it but keep them clickable,
   then reveal a subtle category-colored tint on hover / selection. */
#map-host svg [id^="stand-"] {
  cursor: pointer;
  fill-opacity: 0;
  pointer-events: all;          /* clickable even though the fill is transparent */
  transition: fill-opacity .12s ease;
}
#map-host svg [id^="stand-"]:hover { fill-opacity: .3; }

/* Highlight the stands of the selected business */
#map-host svg [id^="stand-"].is-active {
  fill-opacity: .38;
  stroke: #111;
  stroke-width: 2.5px;
  paint-order: stroke;
}

/* ===== Zoom controls ===== */
#zoom-controls {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 20;
}
#zoom-controls button {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 10px;
  background: #fff;
  color: #222;
  font-size: 22px;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#zoom-controls button:hover { background: #f3f3f3; }
#zoom-controls button:active { transform: translateY(1px); }
#zoom-reset { font-size: 18px; }

/* ===== Legend ===== */
#legend-toggle {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 20;
  border: none;
  border-radius: 10px;
  background: #fff;
  color: #222;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  -webkit-tap-highlight-color: transparent;
}
#legend-toggle:hover { background: #f3f3f3; }

#legend-panel {
  position: absolute;
  left: 14px;
  bottom: 62px;
  z-index: 20;
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.22);
  max-width: min(92vw, 760px);
}
#legend-panel img {
  display: block;
  width: 100%;
  height: auto;
}

/* ===== Popup ===== */
.popup {
  position: absolute;
  z-index: 30;
  width: 280px;
  max-width: calc(100% - 28px);
  background: #fff;
  border-radius: 14px;
  padding: 16px 18px 18px;
  box-shadow: 0 10px 40px rgba(0,0,0,.28);
  animation: popIn .12s ease;
}
@keyframes popIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }

.popup__close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: #999;
  cursor: pointer;
  padding: 2px 6px;
}
.popup__close:hover { color: #333; }

.popup__cat {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: #fff;
  background: #888;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.popup__name {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.25;
  color: #161616;
}
.popup__stands {
  margin: 0;
  font-size: 14px;
  color: #444;
}
.popup__stands-label { color: #888; }

.popup.is-vacant .popup__cat { display: none; }

/* ===== Notice ===== */
#notice {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  background: #fff3cd;
  color: #7a5d00;
  border: 1px solid #ffe69c;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
  max-width: 90%;
  text-align: center;
}

/* ===== Mobile: popup becomes a bottom sheet ===== */
@media (max-width: 560px) {
  .popup {
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    padding-bottom: 22px;
    animation: sheetIn .16s ease;
  }
  @keyframes sheetIn { from { transform: translateY(100%); } to { transform: translateY(0); } }
  #legend-panel { bottom: 62px; max-width: calc(100% - 28px); }
}
