/*
 * map.css — Leaflet map overrides and popup styles
 * Gravity Projex | Copyright 2026
 */

/* ── MAP CONTAINER ─────────────────────────────────────────────────────────── */
.rwc-map {
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  z-index: 1;
}

/* ── MARKERS ───────────────────────────────────────────────────────────────── */
.rwc-marker { background: none !important; border: none !important; }
.rwc-marker--featured svg circle { filter: drop-shadow(0 2px 6px rgba(255,229,18,.5)); }

/* ── POPUPS ────────────────────────────────────────────────────────────────── */
.rwc-leaflet-popup .leaflet-popup-content-wrapper {
  border-radius: 6px !important;
  padding: 0 !important;
  overflow: hidden;
  box-shadow: var(--shadow-lg) !important;
  border: none !important;
}
.rwc-leaflet-popup .leaflet-popup-content { margin: 0 !important; width: auto !important; }
.rwc-leaflet-popup .leaflet-popup-tip-container { display: none; }
.rwc-leaflet-popup .leaflet-popup-close-button {
  top: 8px !important; right: 8px !important;
  color: rgba(255,255,255,.7) !important;
  font-size: 18px !important; font-weight: 400 !important;
  z-index: 10;
}
.rwc-leaflet-popup .leaflet-popup-close-button:hover { color: #fff !important; }

.rwc-popup { width: 280px; font-family: var(--font-sans); }
.rwc-popup__status {
  padding: .4rem 1rem;
  font-size: .65rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.rwc-popup__body { padding: 1rem; }
.rwc-popup__type {
  font-size: .65rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--concrete);
  margin-bottom: .3rem;
}
.rwc-popup__title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--steel);
  line-height: 1.2;
  margin-bottom: .4rem;
}
.rwc-popup__address {
  font-size: .8rem;
  color: var(--grit);
  margin-bottom: .75rem;
  line-height: 1.4;
}
.rwc-popup__details {
  display: flex;
  gap: .75rem;
  margin-bottom: .75rem;
  font-size: .8rem;
  color: var(--steel);
  flex-wrap: wrap;
}
.rwc-popup__agent {
  font-size: .75rem;
  color: var(--concrete);
  margin-bottom: .875rem;
}
.rwc-popup__cta {
  display: block;
  padding: .5rem 1rem;
  background: var(--yellow);
  color: var(--steel);
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 3px;
  text-align: center;
  transition: .15s;
}
.rwc-popup__cta:hover { background: var(--yellow-dk); }

/* ── POPUP DATE ────────────────────────────────────────────────────────────── */
.rwc-popup__date {
  display: block;
  font-size: .7rem;
  color: var(--concrete);
  margin-bottom: .5rem;
}

/* ── FILTER UI ─────────────────────────────────────────────────────────────── */
.map-filters {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  padding: .875rem 0 1rem;
}
.map-filter-group {
  display: flex;
  gap: .35rem;
}
.map-filter-btn {
  padding: .35rem .875rem;
  font-family: var(--font-sans);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
  border: 1px solid var(--clay);
  border-radius: 3px;
  background: var(--white);
  color: var(--grit);
  cursor: pointer;
  transition: var(--transition);
}
.map-filter-btn:hover { border-color: var(--steel); color: var(--steel); }
.map-filter-btn.active { background: var(--steel); color: var(--white); border-color: var(--steel); }
.map-filter-count {
  font-family: var(--font-sans);
  font-size: .75rem;
  color: var(--concrete);
  margin-left: auto;
}

/* ── LEAFLET ATTRIBUTION ───────────────────────────────────────────────────── */
.leaflet-control-attribution {
  font-size: .65rem !important;
  background: rgba(255,255,255,.8) !important;
}

/* ── POPUP IMAGE (single) ──────────────────────────────────────────────────── */
.rwc-popup--has-img { width: 300px; }
.rwc-popup__img {
  width: 100%;
  height: 160px;
  overflow: hidden;
}
.rwc-popup__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── BEFORE / AFTER SLIDER ─────────────────────────────────────────────────── */
.rwc-popup__ba {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  cursor: col-resize;
  user-select: none;
  -webkit-user-select: none;
}

/* Both layers fill the container */
.ba-before,
.ba-after {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

/* After layer is clipped from the left — JS drives the clip-path */
.ba-after {
  clip-path: inset(0 0 0 50%);
  transition: clip-path 0s; /* instant while dragging */
}

/* Drag handle — full-height bar, wide enough to grab easily */
.ba-slider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  background: var(--white);
  transform: translateX(-50%);
  cursor: col-resize;
  z-index: 20;
  touch-action: none;
  /* Extend hit area without affecting visual width */
  padding: 0 20px;
  box-sizing: content-box;
  margin-left: -20px;
}

.ba-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  background: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(65,64,66,.3);
  gap: 0;
  color: var(--steel);
}

.ba-handle svg { flex-shrink: 0; }

/* Before / After labels */
.ba-label {
  position: absolute;
  bottom: .5rem;
  font-family: var(--font-sans);
  font-size: .6rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--white);
  background: rgba(65,64,66,.65);
  padding: .2rem .5rem;
  border-radius: 2px;
  pointer-events: none;
}
.ba-label--before { left: .5rem; }
.ba-label--after  { right: .5rem; }

/* ── POPUP IMAGE — PLACEHOLDER ─────────────────────────────────────────────── */
/* When no property photo exists, the RWC logo shows on a neutral background   */
.rwc-popup__img--placeholder {
  background: var(--sand);
  display: flex;
  align-items: center;
  justify-content: center;
}
.rwc-popup__img--placeholder img {
  width: 60%;
  height: auto;
  object-fit: contain;
  opacity: .85;
}
