/* =====================================================================
   OrderStraight Stage 2.6b — inline map card + fullscreen Leaflet overlay.
   Loaded only when at least 1 tenant has lat+lng. Coastal Premium tokens
   come from index.php inline <style>.
   ===================================================================== */

/* ---------- INLINE CARD (between filter row and rails) ---------- */
.os-map-card {
  position: relative;
  max-width: 1280px;
  margin: 16px auto 4px;
  height: 160px;
  border-radius: 16px;
  overflow: hidden;
  background: #dde7d8;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(28,42,68,0.10);
  isolation: isolate;
}
@media (min-width: 600px) { .os-map-card { margin-left: 16px; margin-right: 16px; max-width: calc(1280px - 32px); } }

.os-map-card .map-skeleton,
.os-map-card .map-mini {
  position: absolute; inset: 0; z-index: 0;
}
.os-map-card .map-skeleton { transition: opacity .3s ease; }
.os-map-card.leaflet-ready .map-skeleton { opacity: 0; pointer-events: none; }
.os-map-card .map-mini {
  /* keep map purely decorative — taps go to the card itself */
  pointer-events: none;
  background: #dde7d8;
}
.os-map-card .map-mini .leaflet-container { background: #dde7d8; }

/* "View map" centered pill */
.os-map-card .view-map-btn {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; color: var(--os-text);
  border: 0; border-radius: 999px;
  padding: 12px 20px; font-size: 14.5px; font-weight: 700;
  font-family: inherit; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
  transition: transform .12s ease, box-shadow .12s ease;
}
.os-map-card:hover .view-map-btn { transform: translate(-50%, -50%) scale(1.04); box-shadow: 0 6px 18px rgba(0,0,0,.22); }
.os-map-card .view-map-btn svg { color: var(--os-primary); }

/* fav heart top-right */
.os-map-card .map-fav {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,0.92);
  display: flex; align-items: center; justify-content: center;
  border: 0; cursor: pointer; color: var(--os-text);
  box-shadow: 0 2px 8px rgba(0,0,0,.14);
  transition: background .15s ease, color .15s ease;
}
.os-map-card .map-fav:hover { background: #fff; color: var(--os-accent); }
.os-map-card .map-fav[aria-pressed="true"] { color: var(--os-accent); }
.os-map-card .map-fav svg { fill: currentColor; }
[dir="rtl"] .os-map-card .map-fav { right: auto; left: 10px; }

/* ---------- FULLSCREEN OVERLAY ---------- */
.os-map-fullscreen {
  position: fixed; inset: 0;
  background: var(--os-bg);
  z-index: 200;
  display: flex; flex-direction: column;
}
.os-map-fullscreen[hidden] { display: none; }

.os-map-fs-bar {
  background: var(--os-primary); color: #fff;
  padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 2px 10px rgba(15,27,48,0.18);
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
}
.os-map-fs-close {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.12); color: #fff;
  border: 1px solid rgba(255,255,255,0.18); border-radius: 50%;
  cursor: pointer; font-family: inherit;
  transition: background .15s ease;
}
.os-map-fs-close:hover { background: rgba(255,255,255,0.22); }
.os-map-fs-bar .title {
  font-size: 16px; font-weight: 700; letter-spacing: -.2px;
}

.os-map-fullscreen .map-full {
  flex: 1 1 auto; min-height: 0;
  background: #dde7d8;
}
.os-map-fullscreen .map-full .leaflet-container { width: 100%; height: 100%; background: #dde7d8; }

/* ---------- CUSTOM MARKER (used in both mini + fullscreen) ---------- */
.os-pin {
  width: 28px; height: 36px;
  display: flex; align-items: flex-start; justify-content: center;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.28));
}
.os-pin .pin-body {
  width: 26px; height: 26px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 12px;
  border: 2px solid #fff;
}
.os-pin .pin-body span { transform: rotate(45deg); line-height: 1; }

/* leaflet popup theming to match Coastal Premium */
.leaflet-popup-content-wrapper {
  border-radius: 12px !important;
  box-shadow: 0 6px 20px rgba(15,27,48,0.20) !important;
}
.leaflet-popup-content { margin: 10px 14px !important; font-family: inherit; }
.os-popup-name {
  font-weight: 700; color: var(--os-text); font-size: 14.5px; margin-bottom: 4px;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.os-popup-city { font-size: 12px; color: var(--os-muted); margin-bottom: 8px; }
.os-popup-cta {
  display: inline-block; background: var(--os-accent); color: #fff;
  padding: 6px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  text-decoration: none;
}
.os-popup-cta:hover { background: var(--os-accent-d); }

/* ---------- MOBILE TWEAKS ---------- */
@media (max-width: 599px) {
  .os-map-card { height: 150px; margin: 14px 12px 0; border-radius: 14px; }
  .os-map-card .view-map-btn { padding: 10px 16px; font-size: 13.5px; }
}

/* ===== A2d: Pickup-mode toggle (Uber parity) =====
   Map card stays hidden until user clicks the Pickup filter pill.
   Body class `os-mode-pickup` is toggled by the inline script in index.php. */
body:not(.os-mode-pickup) .os-map-card { display: none !important; }
