/* Nearby amenities, nearby tabs, and amenity popup specialisations. */

.school-near-zone-divider {
  margin: 4px 16px;
  border-top: 2px solid var(--border);
}
.school-near-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}
.school-near-chip {
  font-size: 12px;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  cursor: help;
  user-select: none;
  line-height: 18px;
}
.cc-near-lang {
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface-2) 82%, var(--accent-soft));
  border: 1px solid color-mix(in srgb, var(--border-soft) 78%, var(--accent-soft));
  color: var(--text-secondary);
}
.childcare-inline-meta {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.2;
  margin-left: 4px;
}
.school-near-row .cc-near-name { font-size: 15px; }
.school-near-cca-row { gap: 0; }
.school-near-cca-row .school-near-chip {
  padding: 0 1px;
  background: none;
  border: none;
  line-height: 1.4;
}
.school-badge-chip { font-size: 10px; padding: 0 3px; vertical-align: middle; line-height: 16px; }
.school-near-prog {
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
}
.school-near-dist-prog { cursor: help; }
.school-near-prog-row { gap: 4px; }
.school-near-cca-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: .02em;
  margin-right: 2px;
}
.school-level-tag {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--border-soft) 88%, transparent);
  border-radius: 4px;
  padding: 2px 7px;
  line-height: 1.2;
}
.school-level-tag-secondary {
  background: linear-gradient(135deg, rgba(14,165,233,.22), rgba(37,99,235,.18));
  border-color: rgba(96,165,250,.28);
  color: #93c5fd;
}
.school-level-tag-ip {
  background: linear-gradient(135deg, rgba(244,114,182,.18), rgba(168,85,247,.22));
  border-color: rgba(217,70,239,.28);
  color: #f5b4fc;
}
:root[data-theme="light"] .school-level-tag-secondary { color: #1d4ed8; }
:root[data-theme="light"] .school-level-tag-ip { color: #a21caf; }
.school-near-row .nearby-facts-line {
  gap: 6px;
}
.school-near-row .nearby-paired-row-summary .nearby-paired-right .cc-contact-icon,
.school-near-row .nearby-paired-row-summary .nearby-paired-right .cc-near-link {
  opacity: .82;
}

.amenity-marker-wrap {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.amenity-marker {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 1.5px solid rgba(255,255,255,.92);
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  color: #fff;
}
.amenity-marker svg {
  width: 15px;
  height: 15px;
  display: block;
}
/* Entry zoom holds hundreds of markers; collapse to dots where SHAPE encodes
   the amenity type and COLOUR its sub-state (.amenity-dot-zoom is set by
   amenity-markers.ts): circle childcare, diamond school, plus healthcare,
   square carpark/supermarket, triangle hawker. Dark border, not the disc's
   white ring: white edges halo on the light basemap. */
.amenity-dot-zoom .amenity-marker {
  width: 10px;
  height: 10px;
  border: 1.5px solid rgba(0,0,0,.35);
  box-shadow: none;
}
.amenity-dot-zoom .amenity-marker svg {
  display: none;
}
.amenity-dot-zoom .amenity-marker-school {
  border-radius: 1px;
  transform: rotate(45deg);
}
/* clip-path shapes (hawker, healthcare) can't keep a border — it would be
   clipped unevenly — so a tight drop-shadow draws the edge instead. */
.amenity-dot-zoom .amenity-marker-hawker {
  width: 13px;
  height: 11px;
  border: none;
  border-radius: 0;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  filter: drop-shadow(0 0 1px rgba(0,0,0,.45));
}
/* Civic amenities keep the old white-ring look and larger footprint */
.amenity-dot-zoom .amenity-marker-carpark,
.amenity-dot-zoom .amenity-marker-supermarket {
  border: 2px solid rgba(255,255,255,.92);
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.amenity-dot-zoom .amenity-marker-healthcare {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 0;
  clip-path: polygon(35% 0, 65% 0, 65% 35%, 100% 35%, 100% 65%, 65% 65%, 65% 100%, 35% 100%, 35% 65%, 0 65%, 0 35%, 35% 35%);
  filter: drop-shadow(0 0 1px rgba(0,0,0,.45));
}
.amenity-dot-zoom .amenity-marker-carpark { width: 12px; height: 12px; border-radius: 3px; }
.amenity-dot-zoom .amenity-marker-supermarket { width: 14px; height: 14px; border-radius: 4px; }
.amenity-marker-school-primary { background: #3b82f6; }
.amenity-marker-school-secondary { background: #8b5cf6; }
.amenity-marker-school-jc { background: #f59e0b; }
.amenity-marker-school-ip { background: #ec4899; }
.amenity-marker-school-mixed { background: #06b6d4; }
.amenity-marker-childcare-open { background: #22c55e; }
.amenity-marker-childcare-limited { background: #f59e0b; }
.amenity-marker-childcare-full { background: #ef4444; }
.amenity-marker-childcare-unknown { background: #94a3b8; }
.amenity-marker-healthcare-polyclinic { background: #dc2626; }
.amenity-marker-healthcare-chas-clinic { background: #2563eb; }
.amenity-marker-healthcare-eldercare { background: #d97706; }
.amenity-marker-healthcare-screening { background: #db2777; }
/* Carpark and supermarket keep their square through the glyph zoom — white P
   on a coloured square is literal parking signage. Other shapes would cramp the
   glyph, so those types collapse to circles once the glyph carries the type.
   The square's hue encodes the car park type (set by _carparkTone); the dot-zoom
   rules above only resize, so the modifier colours both the glyph and the dot. */
.amenity-marker-supermarket { background: #f97316; border-radius: 6px; }
.amenity-marker-carpark { border-radius: 6px; }
.amenity-marker-carpark-multi-storey { background: #2563eb; }
.amenity-marker-carpark-surface { background: #16a34a; }
.amenity-marker-carpark-basement { background: #c026d3; }
.amenity-marker-carpark-other { background: #6b7280; }
.amenity-marker-hawker { background: #ca8a04; }

/* P1 radius legend — under the filter bar, one slot below the first-visit
   banner (80px) so the two never cover each other. z-index clears the map and
   topbar only; every interactive overlay (search dropdown 20, filter scrim
   100, slide-in panels 1000) must paint over this passive label. */
#p1-legend {
  position: fixed;
  top: calc(132px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100dvw - 120px);
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-overlay);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft);
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
  cursor: pointer; /* tap recentres the rings */
}
#p1-legend-school {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 38vw;
  font-weight: 600;
  color: var(--text);
}
.p1-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.p1-legend-swatch { width: 16px; border-top: 3px solid #16a34a; border-radius: 2px; }
.p1-legend-swatch-2km { border-top: 3px dashed #d97706; }
#p1-legend-close {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
}
/* expands the tap target to 44px without growing the pill */
#p1-legend-close::before { content: ""; position: absolute; inset: -8px; }
#p1-legend-close:hover { color: var(--text); }

.amenity-badge-healthcare-polyclinic { background: rgba(220,38,38,.18); color: #ef4444; }
.amenity-badge-healthcare-chas-clinic { background: rgba(37,99,235,.18); color: #60a5fa; }
.amenity-badge-healthcare-eldercare { background: rgba(217,119,6,.18); color: #f59e0b; }
.location-suite-chip { background: var(--chip); color: var(--text-dim); }
.amenity-badge-healthcare-screening { background: rgba(236,72,153,.18); color: #f472b6; }
:root[data-theme="light"] .amenity-badge-healthcare-polyclinic { color: #b91c1c; }
:root[data-theme="light"] .amenity-badge-healthcare-chas-clinic { color: #1d4ed8; }
:root[data-theme="light"] .amenity-badge-healthcare-eldercare { color: #b45309; }
:root[data-theme="light"] .location-suite-chip { color: var(--text-dim); }
:root[data-theme="light"] .amenity-badge-healthcare-screening { color: #be185d; }

.amenity-badge-hawker { background: rgba(234,179,8,.2); color: #fcd34d; }
:root[data-theme="light"] .amenity-badge-hawker { color: #a16207; }

.amenity-badge-carpark { background: rgba(37,99,235,.18); color: #93c5fd; }
:root[data-theme="light"] .amenity-badge-carpark { color: #1d4ed8; }
.amenity-badge-supermarket { background: rgba(249,115,22,.18); color: #fb923c; }
:root[data-theme="light"] .amenity-badge-supermarket { color: #c2410c; }
.cc-stall-carpark { background: rgba(37,99,235,.18); color: #93c5fd; }
.cc-stall-linked { background: rgba(16,185,129,.18); color: #6ee7b7; }
.cc-stall-night { background: rgba(249,115,22,.18); color: #fdba74; }
.cc-stall-basement { background: rgba(168,85,247,.18); color: #d8b4fe; }
.cc-stall-carpark-meta { border: 1px solid color-mix(in srgb, var(--border-soft) 74%, transparent); }
.cc-stall-carpark-meta-type { background: rgba(37,99,235,.18); color: #93c5fd; }
.cc-stall-carpark-meta-linked { background: rgba(16,185,129,.18); color: #6ee7b7; }
.cc-stall-carpark-meta-night { background: rgba(244,63,94,.24); color: #fda4af; border-color: rgba(244,63,94,.34); }
.cc-stall-carpark-meta-basement { background: rgba(168,85,247,.18); color: #d8b4fe; }
.cc-stall-carpark-meta-short-term { background: rgba(14,165,233,.18); color: #7dd3fc; }
.cc-stall-carpark-meta-gantry { background: rgba(168,85,247,.18); color: #d8b4fe; }
.cc-stall-carpark-meta-decks { background: rgba(100,116,139,.22); color: #cbd5e1; }
.cc-stall-carpark-meta-free { background: rgba(16,185,129,.18); color: #6ee7b7; }
.carpark-gantry-icon {
  display: inline-flex;
  width: 1.05em;
  height: 1.05em;
  vertical-align: -0.08em;
}
.carpark-gantry-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  stroke-width: 1.35;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.carpark-decks-icon {
  display: inline-block;
  font-size: 1.4em;
}
:root[data-theme="light"] .cc-stall-carpark { color: #1d4ed8; }
:root[data-theme="light"] .cc-stall-linked { color: #047857; }
:root[data-theme="light"] .cc-stall-night { color: #c2410c; }
:root[data-theme="light"] .cc-stall-basement { color: #7e22ce; }
:root[data-theme="light"] .cc-stall-carpark-meta-type { color: #1d4ed8; }
:root[data-theme="light"] .cc-stall-carpark-meta-linked { color: #047857; }
:root[data-theme="light"] .cc-stall-carpark-meta-night { color: #be123c; }
:root[data-theme="light"] .cc-stall-carpark-meta-basement { color: #7e22ce; }
:root[data-theme="light"] .cc-stall-carpark-meta-short-term { color: #0f766e; }
:root[data-theme="light"] .cc-stall-carpark-meta-gantry { color: #7e22ce; }
:root[data-theme="light"] .cc-stall-carpark-meta-decks { color: #334155; }
:root[data-theme="light"] .cc-stall-carpark-meta-free { color: #047857; }
.carpark-system-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  font-size: 12px;
  line-height: 1;
  vertical-align: middle;
  cursor: help;
}

.hawker-desc { font-size: 12px; color: var(--text-dim); margin-top: 3px; line-height: 1.4; }
.hawker-closure-line { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.hawker-closure-line.hawker-closed { color: #dc2626; }
.hawker-stall-line { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.hawker-closed-chip,
.hawker-closing-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-block;
}
.hawker-closed-chip  { background: #fee2e2; color: #dc2626; }
.hawker-closing-chip { background: #fef9c3; color: #92400e; }
:root[data-theme="light"] .hawker-closing-chip { color: #78350f; }
.hawker-near-row .hawker-closed-chip,
.hawker-near-row .hawker-closing-chip {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 999px;
}
.hawker-near-row .hawker-closed-chip {
  background: color-mix(in srgb, #fee2e2 72%, var(--surface-2));
}
.hawker-near-row .hawker-closing-chip {
  background: color-mix(in srgb, #fef9c3 72%, var(--surface-2));
}

.cc-near-sub { font-size: 12px; color: var(--text-dim); margin-top: 4px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.cc-name-sub { font-size: 0.88em; opacity: 0.65; }
.cc-stall-chip { display: inline-flex; align-items: center; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 500; line-height: 18px; }
.cc-stall-chip[data-tip] { cursor: help; }
.cc-stall-food   { background: rgba(34,197,94,.18); color: #4ade80; }
.cc-stall-market { background: rgba(59,130,246,.18); color: #93c5fd; }
:root[data-theme="light"] .cc-stall-food   { color: #15803d; }
:root[data-theme="light"] .cc-stall-market { color: #1d4ed8; }

#detail-childcare { border-bottom: 1px solid var(--border-soft); }
#detail-childcare:empty { display: none; }
.cc-near-section { padding: 10px 16px 12px; }
.cc-near-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background .12s;
}
.cc-near-row:hover { background: var(--hover-tint); margin: 0 -16px; padding: 10px 16px; }
.cc-near-row.active { background: var(--chip-active); margin: 0 -16px; padding: 10px 16px; box-shadow: inset 3px 0 0 var(--accent); }
.cc-near-row:last-child { border-bottom: none; padding-bottom: 0; }
.nearby-shell { display: flex; align-items: stretch; gap: 12px; }
.nearby-rank-col { width: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nearby-rank-num { align-self: center; }
.nearby-body { flex: 1; min-width: 0; }
.nearby-row-head-icons {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.nearby-row-head-icons .cc-meta-line {
  display: inline-flex;
  align-items: center;
}
.nearby-row-head-icons-wrap {
  flex-wrap: wrap;
  justify-content: flex-end;
  row-gap: 2px;
}
.nearby-paired-layout {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nearby-paired-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.nearby-paired-row-header {
  margin-bottom: 2px;
}
.nearby-paired-row-full .nearby-paired-left {
  flex: 1 1 100%;
}
.nearby-paired-row-full .nearby-paired-right {
  display: none;
}
.nearby-paired-row-distance {
  align-items: flex-start;
}
.nearby-paired-row-distance .nearby-paired-right {
  align-self: flex-start;
  white-space: nowrap;
}
.nearby-paired-left {
  min-width: 0;
  flex: 1;
}
.nearby-paired-right {
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
  min-width: 0;
}
.nearby-paired-right-empty {
  display: none;
}
.nearby-facts-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-items: center;
  min-width: 0;
}
.nearby-summary-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-dim);
}
.nearby-summary-line strong {
  color: var(--text-secondary);
}
.nearby-paired-row-summary {
  margin-top: 2px;
}
.nearby-summary-actions-only {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}
.nearby-action-line {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  max-width: 100%;
  text-align: right;
  white-space: nowrap;
}
.nearby-shell-card .school-near-cca-row { gap: 6px; }
.nearby-shell-card .cc-near-sub { margin-top: 0; }
.nearby-shell-card .nearby-row-head-icons-wrap { row-gap: 0; }
.nearby-shell-card .nearby-action-line { gap: 6px; }
.nearby-action-line-wrap {
  white-space: normal;
}
.nearby-action-line-distance {
  gap: 6px;
}
.nearby-action-line-distance .cc-near-dist {
  align-items: flex-start;
}
.cc-near-name { font-size: 14px; font-weight: 600; color: var(--text); flex: 1; min-width: 0; }
.cc-near-link { font-size: 11px; color: var(--text-dim); text-decoration: none; margin-left: 4px; vertical-align: middle; }
.cc-near-link:hover { color: var(--accent); }
/* Base rank-circle styles shared with .list-row-rank live in style.css. */
.cc-near-num {
  width: 20px;
  height: 20px;
  font-size: 11px;
}
.cc-near-row.active .cc-near-num { background: var(--accent); color: var(--text-on-primary); }
.cc-near-dist { display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; color: var(--text-dim); white-space: nowrap; flex-shrink: 0; }
@media (max-width: 640px) {
  .nearby-facts-line {
    gap: 5px 6px;
  }

  .nearby-summary-line {
    font-size: 11px;
  }
}
.cc-spark-small { font-size: 10px; color: #7c3aed; background: #ede9fe; padding: 1px 4px; border-radius: 3px; vertical-align: middle; }

.cc-legend { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 8px 16px 4px; flex-wrap: wrap; }
.cc-legend-left { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cc-legend-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.cc-vac-chips { display: contents; }
.cc-school-note { font-size: 11px; color: var(--text-dim); margin-left: auto; }
.cc-school-note a { color: var(--text-dim); text-decoration: underline; }
.cc-meta-line { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.cc-contact-icon { font-size: 14px; color: var(--text-dim); padding: 2px; background: none; border: none; cursor: copy; line-height: 1; text-decoration: none; display: inline-flex; align-items: center; }
.cc-contact-icon:hover { color: var(--accent); }
.amenity-popup-tags { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.amenity-location-group { display: flex; flex-direction: column; gap: 8px; }
.amenity-location-sub { margin-top: 0; }
.amenity-address-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-soft) 28%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--accent-soft) 42%, var(--border-soft));
  color: var(--text-dim);
  line-height: 1.45;
}
.amenity-popup-group { display: flex; flex-direction: column; gap: 10px; }
.amenity-popup-entry { display: flex; flex-direction: column; gap: 4px; }
.amenity-popup-entry + .amenity-popup-entry {
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--border-soft) 75%, transparent);
}
.amenity-popup-address {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--border-soft) 55%, transparent);
}
.amenity-location-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.amenity-location-main { min-width: 0; flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.amenity-location-side { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }
.amenity-popup-entry-head { align-items: flex-start; gap: 10px; }
.amenity-popup-entry-head .amenity-location-main { min-width: 0; }
.amenity-popup-entry-head .sp-name { min-width: 0; }
.healthcare-inline-phone {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  white-space: nowrap;
}
.amenity-location-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}
.amenity-location-tags { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.amenity-location-actions { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.amenity-location-tags .school-level-chip {
  font-size: 12px;
  padding: 2px 7px;
  line-height: 1.2;
  opacity: 0.92;
}
.cc-info-lines { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.cc-info-line { font-size: 12px; color: var(--text-dim); }
.cc-info-line-inline {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.cc-info-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cc-info-line-icons {
  gap: 10px;
  margin-top: 6px;
}
.cc-contact-link-popup { color: var(--accent-fg); text-decoration: none; }
.cc-contact-link-popup:hover { text-decoration: underline; }
.cc-contact-icon-inline {
  width: 24px;
  height: 24px;
  justify-content: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-soft) 34%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--accent-soft) 46%, var(--border-soft));
  color: var(--accent-fg);
}
.cc-contact-icon-inline:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border-soft));
}

#detail-nearby-section {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.nearby-pills { position: sticky; top: 0; z-index: 2; }

.cc-near-row:hover .list-row-arrow,
.cc-near-row.active .list-row-arrow {
  color: var(--accent);
  transform: translateX(2px);
}
