/* JDServer-Webs — Mapa de estaciones (Leaflet) */

#jd-map-module { overflow: hidden; }

.jd-map-toolbar{
  display:flex;
  gap:10px;
  align-items:center;
  margin: 10px 0 12px;
}

.jd-map-search{
  flex:1;
  height: 40px;
  border-radius: 999px;
  padding: 0 14px;
  border: 1px solid var(--border, rgba(0,0,0,.12));
  background: var(--card, rgba(255,255,255,.7));
  color: var(--text, #111);
  font-weight: 600;
}

html[data-theme="dark"] .jd-map-search{
  border-color: var(--border, #2b2f36);
  background: var(--card, #111418);
  color: var(--text, #dfe7ef);
}

.jd-map-btn{
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border, rgba(0,0,0,.12));
  background: var(--card, rgba(255,255,255,.7));
  color: var(--text, #111);
  font-weight: 800;
  cursor: pointer;
}

html[data-theme="dark"] .jd-map-btn{
  border-color: var(--border, #2b2f36);
  background: var(--card, #111418);
  color: var(--text, #dfe7ef);
}

/* ✅ ALTURA DEL MAPA (blindada) */
.jd-stations-map,
#jdStationsMap,
#jdStationsMapLocal{
  height: clamp(560px, 78vh, 980px) !important;
  min-height: 560px !important;

  border-radius: 18px;
  border: 1px solid var(--border, rgba(0,0,0,.12));
  overflow:hidden;
  background: var(--card, #fff);
}

@media (max-width: 520px){
  .jd-stations-map,
  #jdStationsMap,
  #jdStationsMapLocal{
    height: clamp(620px, 82vh, 1100px) !important;
    min-height: 620px !important;
  }
}

html[data-theme="dark"] .jd-stations-map,
html[data-theme="dark"] #jdStationsMap,
html[data-theme="dark"] #jdStationsMapLocal{
  border-color: var(--border, #2b2f36);
  background: var(--card, #111418);
}

.leaflet-control-attribution{
  font-size: 11px;
  opacity: .85;
}

.leaflet-popup-content,
.leaflet-popup-content *{
  box-sizing: border-box;
}

.leaflet-popup-content{
  margin: 14px 14px 12px;
  min-width: 260px;
  max-width: 340px;
  width: auto;
}

@media (max-width: 380px){
  .leaflet-popup-content{ min-width: 240px; }
}

.jd-map-popup{ --st: #12bdb3; }

.jd-map-pop-top{
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--st), rgba(0,0,0,0));
  margin-bottom: 10px;
  opacity: .95;
}

.jd-map-popup .title{
  font-weight: 950;
  font-size: 18px;
  margin: 0 0 4px;
}

.jd-map-popup .meta{
  opacity: .85;
  font-weight: 750;
  margin: 0 0 10px;
}

.jd-map-loading{
  opacity:.7;
  font-weight:800;
}

.jd-map-open{
  display:inline-flex;
  gap:8px;
  align-items:center;
  text-decoration:none;
  font-weight: 900;
  color: var(--brand, #12bdb3);
  margin-top: 6px;
}

.jd-map-legend{
  margin-top: 10px;
  font-size: 13px;
  opacity: .85;
  font-weight: 700;
}

/* ===== Live mini-card dentro del popup ===== */
.jd-map-live{
  margin: 10px 0 10px;
  padding: 8px 8px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--st) 40%, rgba(0,0,0,.12));
  background: rgba(255,255,255,.92);
  box-shadow: 0 10px 24px rgba(0,0,0,.10);
  max-width: 100%;
  overflow: hidden;
}

html[data-theme="dark"] .jd-map-live{
  border-color: color-mix(in srgb, var(--st) 35%, rgba(255,255,255,.14));
  background: rgba(17,20,24,.78);
  box-shadow: 0 10px 26px rgba(0,0,0,.35);
}

.jd-map-live-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  width: 100%;
}

.jd-map-live-grid .jd-metric{
  min-width: 0;
  padding: 6px 6px;
  border-radius: 12px;
  background: rgba(0,0,0,.04);
  text-align: center;
  border: 1px solid rgba(0,0,0,.06);
}

html[data-theme="dark"] .jd-map-live-grid .jd-metric{
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.08);
}

.jd-map-live-grid .jd-metric .v{
  display:block;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: -.2px;
  line-height: 1.05;
  white-space: nowrap;
}

.jd-map-live-grid .jd-metric .k{
  display:block;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 850;
  opacity: .82;
  line-height: 1.1;
}

.jd-map-live-camwrap{
  margin-top: 8px;
}

.jd-map-cam{
  display:block;
  border-radius: 14px;
  overflow:hidden;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(0,0,0,.04);
  box-shadow: 0 10px 20px rgba(0,0,0,.10);
}

html[data-theme="dark"] .jd-map-cam{
  border-color: rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  box-shadow: 0 12px 22px rgba(0,0,0,.35);
}

.jd-map-cam-big{
  width: 100%;
  height: 92px;
}

/* ✅ Por defecto: cover (pano) */
.jd-map-cam-img{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
}

/* ✅ Ver completa (sin recortar) */
.jd-map-cam.jd-fit-contain{
  background: rgba(0,0,0,.06);
}
html[data-theme="dark"] .jd-map-cam.jd-fit-contain{
  background: rgba(255,255,255,.06);
}
.jd-map-cam.jd-fit-contain .jd-map-cam-img{
  object-fit: contain;
}

/* ✅ Un poco más alto solo para no panorámicas */
.jd-map-cam.jd-cam-tall{
  height: 112px;
}

.jd-map-live-upd{
  margin-top: 7px;
  font-size: 11px;
  font-weight: 850;
  opacity: .88;
  text-align: right;
}

@media (max-width: 360px){
  .jd-map-live-grid{ grid-template-columns: 1fr; }
  .jd-map-cam-big{ height: 88px; }
  .jd-map-cam.jd-cam-tall{ height: 106px; }
}
