/* Dashboard map (map.js): pins, legend, watch list, occupancy switch, front-desk settings */
:root { --pin-alert: #c62828; --pin-issue: #e8590c; --pin-occupied: #1b8a52; --pin-vacant: #2563c9; --pin-desk: #17202a; }

.mapbar { margin-bottom: 12px; }
.mapwrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: stretch; }
#dashMap { height: calc(100vh - 200px); min-height: 460px; padding: 0; overflow: hidden; z-index: 0; }
.watch { padding: 14px; display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 200px); min-height: 460px; overflow: auto; }
.watch .section-title { margin: 0; }
.watch p { margin: 0 0 6px; }
#watchList { display: flex; flex-direction: column; gap: 8px; }
.witem { display: flex; align-items: flex-start; gap: 10px; text-align: left; white-space: normal; width: 100%; padding: 10px; }
.witem .wbody { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.witem .wbody b { overflow-wrap: anywhere; }
.witem .wpin { flex: none; padding-top: 2px; }
.wempty { padding: 14px 4px; }

@media (max-width: 860px) {
  .mapwrap { grid-template-columns: 1fr; }
  #dashMap { height: 62vh; min-height: 320px; }
  .watch { max-height: none; min-height: 0; }
}

/* pins: shape + glyph + colour; red/orange carry a green/blue occupancy dot */
.mpin-wrap { background: none; border: 0; }
.mpin { position: relative; display: block; width: 36px; height: 36px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.45)); }
.mpin svg { width: 100%; height: 100%; display: block; overflow: visible; }
.mpin svg > :first-child { stroke: #fff; stroke-width: 2.5; }
/* mp- prefix: reception.css already styles .alert (feed items) and .small */
.mpin.mp-alert svg > :first-child { fill: var(--pin-alert); }
.mpin.mp-issue svg > :first-child { fill: var(--pin-issue); }
.mpin.mp-occupied svg > :first-child { fill: var(--pin-occupied); }
.mpin.mp-vacant svg > :first-child { fill: var(--pin-vacant); }
.mpin.mp-alert { animation: mpin-pulse 1.6s ease-in-out infinite; }
@keyframes mpin-pulse { 50% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .mpin.mp-alert { animation: none; } }
.mpin-badge { position: absolute; right: -3px; bottom: -3px; width: 13px; height: 13px; border-radius: 50%; border: 2px solid #fff; }
.mpin-badge.mp-occupied { background: var(--pin-occupied); }
.mpin-badge.mp-vacant { background: var(--pin-vacant); }
.mpin.mp-small { width: 22px; height: 22px; display: inline-block; vertical-align: middle; filter: none; animation: none; }
.mpin.mp-small .mpin-badge { width: 9px; height: 9px; border-width: 1.5px; right: -2px; bottom: -2px; }
.mdesk { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--pin-desk); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5); }
.mdesk svg { width: 20px; height: 20px; }
.leaflet-marker-icon:focus-visible .mpin, .leaflet-marker-icon:focus-visible .mdesk { outline: 3px solid #111; outline-offset: 2px; border-radius: 6px; }

.mring { background: rgba(255,255,255,.85); border: 0; box-shadow: none; color: #17202a; font-weight: 600; font-size: 11px; padding: 0 4px; }
.mring::before { display: none; }

.mlegend { background: rgba(255,255,255,.95); border-radius: 10px; padding: 8px 10px; box-shadow: 0 1px 4px rgba(0,0,0,.25); font-size: 12px; max-width: 260px; }
.mlegend summary { font-weight: 700; cursor: pointer; }
.mlegend[open] summary { margin-bottom: 4px; }
.mlegend .lrow { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.mlegend .mpin { flex: none; }
@media (max-width: 860px) { .mlegend { max-width: 190px; font-size: 11px; } }
.mfit { font: inherit; font-size: 12px; background: #fff; border: 1px solid rgba(0,0,0,.2); border-radius: 8px; padding: 5px 10px; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.2); }

/* popup */
.mpop { display: flex; flex-direction: column; gap: 6px; font: 13px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.mpop-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.mpop-now { color: var(--bad); font-weight: 600; font-size: 12px; }
.mpop-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.mpop-actions .btn, .mpop-actions button { font-size: 12px; padding: 4px 9px; text-decoration: none; }
.mpop-occ { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.leaflet-popup-content { margin: 12px 14px; }

/* occupancy switch */
.occsw { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; user-select: none; white-space: nowrap; }
.occsw input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.occsw .track { width: 34px; height: 20px; border-radius: 99px; background: var(--pin-vacant); position: relative; transition: background .15s; flex: none; }
.occsw .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.occsw.on .track, .occsw input:checked + .track { background: var(--pin-occupied); }
.occsw input:checked + .track::after { transform: translateX(14px); }
.occsw input:focus-visible + .track { outline: 3px solid var(--primary); outline-offset: 2px; }
.occsw input:disabled + .track { opacity: .5; }
.occwho { display: block; }
.prop .head .occ { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }

/* Properties page: flash the card opened from the map */
.prop.flash { box-shadow: 0 0 0 3px var(--primary); transition: box-shadow .3s; }

/* settings: front desk location */
#deskForm .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#deskForm .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
#deskResults button { text-align: left; border-radius: 8px; }
