/* JDServer-Webs — modules/nearby_map/nearby_map.css */

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

.jd-nearby-map-head{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.jd-nearby-map-head h3{
  margin: 0;
}

.jd-nearby-map-help{
  margin: 5px 0 0;
  max-width: 780px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 650;
}

.jd-nearby-map-pill{
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(var(--brand-rgb, 56,189,248), .24);
  background: rgba(var(--brand-rgb, 56,189,248), .075);
  color: color-mix(in srgb, var(--text) 78%, rgb(var(--brand-rgb, 56,189,248)) 22%);
  font-size: 11px;
  line-height: 1;
  font-weight: 820;
  white-space: nowrap;
}

.jd-nearby-map-layout{
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  align-items: stretch;
}

#jdNearbyMap{
  height: clamp(560px, 76vh, 920px);
  min-height: 560px;
  border-radius: 22px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow-1);
}

.jd-nearby-map-side{
  min-width: 0;
  display: grid;
  gap: 12px;
  align-content: start;
}

.jd-nearby-map-summary,
.jd-nearby-map-list{
  border-radius: 22px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 0% 0%, rgba(var(--brand-rgb, 56,189,248), .10), transparent 34%),
    var(--card);
  box-shadow: var(--shadow-1);
  padding: 12px;
}

.jd-nearby-map-summary h4{
  margin: 0 0 8px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.15;
  font-weight: 850;
}

.jd-nearby-map-summary-text{
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 650;
}

.jd-nearby-map-kpis{
  display: grid;
  gap: 7px;
}

.jd-nearby-map-kpi{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 9px;
  border-radius: 15px;
  border: 1px solid rgba(var(--brand-rgb, 56,189,248), .14);
  background: rgba(var(--brand-rgb, 56,189,248), .045);
}

.jd-nearby-map-kpi b{
  min-width: 0;
  color: var(--text);
  font-size: 11px;
  line-height: 1.15;
  font-weight: 830;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jd-nearby-map-kpi span{
  color: color-mix(in srgb, var(--text) 78%, rgb(var(--brand-rgb, 56,189,248)) 22%);
  font-size: 12px;
  line-height: 1;
  font-weight: 850;
  white-space: nowrap;
}

.jd-nearby-map-list{
  max-height: 420px;
  overflow: auto;
  scrollbar-width: thin;
}

.jd-nearby-map-list-row{
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.jd-nearby-map-list-row:first-child{
  border-top: 0;
  padding-top: 0;
}

.jd-nearby-map-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--dot, #38bdf8);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot, #38bdf8) 20%, transparent);
}

.jd-nearby-map-list-name{
  min-width: 0;
}

.jd-nearby-map-list-name strong{
  display: block;
  color: var(--text);
  font-size: 11.5px;
  line-height: 1.15;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jd-nearby-map-list-name small{
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.1;
  font-weight: 650;
}

.jd-nearby-map-list-temp{
  color: var(--text);
  font-size: 13px;
  line-height: 1;
  font-weight: 900;
  white-space: nowrap;
}

.jd-nearby-map-popup{
  --st: #38bdf8;
  min-width: 230px;
}

.jd-nearby-map-popup .bar{
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--st), transparent);
  margin-bottom: 9px;
}

.jd-nearby-map-popup .title{
  color: #0f172a;
  font-size: 16px;
  line-height: 1.15;
  font-weight: 950;
  margin-bottom: 3px;
}

.jd-nearby-map-popup .meta{
  color: #475569;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 760;
  margin-bottom: 9px;
}

.jd-nearby-map-popup-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.jd-nearby-map-pop-kpi{
  padding: 7px;
  border-radius: 12px;
  background: rgba(15,23,42,.045);
  border: 1px solid rgba(15,23,42,.07);
  text-align: center;
}

.jd-nearby-map-pop-kpi b{
  display: block;
  color: #0f172a;
  font-size: 13px;
  line-height: 1;
  font-weight: 950;
}

.jd-nearby-map-pop-kpi span{
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 10px;
  line-height: 1.1;
  font-weight: 800;
}

.jd-nearby-map-popup-upd{
  margin-top: 8px;
  color: #64748b;
  font-size: 10.5px;
  line-height: 1.2;
  font-weight: 780;
  text-align: right;
}

.jd-nearby-map-state{
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.jd-nearby-map-legend{
  margin-top: 10px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.25;
  font-weight: 680;
}

.leaflet-popup-content{
  margin: 13px;
}

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

:root[data-theme="dark"] .jd-nearby-map-summary,
:root[data-theme="dark"] .jd-nearby-map-list{
  background:
    radial-gradient(circle at 0% 0%, rgba(var(--brand-rgb, 56,189,248), .15), transparent 36%),
    var(--card);
}

@media (max-width: 960px){
  .jd-nearby-map-layout{
    grid-template-columns: 1fr;
  }

  .jd-nearby-map-side{
    grid-template-columns: 1fr 1fr;
  }

  .jd-nearby-map-list{
    max-height: 320px;
  }
}

@media (max-width: 640px){
  .jd-nearby-map-head{
    display: block;
  }

  .jd-nearby-map-pill{
    margin-top: 9px;
  }

  #jdNearbyMap{
    height: clamp(620px, 82vh, 1080px);
    min-height: 620px;
    border-radius: 18px;
  }

  .jd-nearby-map-side{
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Nearby Map · selector de variable + marcadores con valor
   ========================================================= */

.jd-nearby-map-controls{
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0 12px;
}

.jd-nearby-map-mode{
  appearance: none;
  border: 1px solid rgba(var(--brand-rgb, 56,189,248), .22);
  background:
    linear-gradient(180deg, rgba(var(--brand-rgb, 56,189,248), .08), transparent 82%),
    var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 11.5px;
  line-height: 1;
  font-weight: 850;
  cursor: pointer;
  box-shadow:
    0 2px 8px rgba(15,23,42,.045),
    inset 0 1px 0 rgba(255,255,255,.36);
  transition:
    transform .14s ease,
    border-color .14s ease,
    background .14s ease,
    box-shadow .14s ease;
}

.jd-nearby-map-mode:hover{
  transform: translateY(-1px);
  border-color: rgba(var(--brand-rgb, 56,189,248), .38);
  box-shadow:
    0 5px 14px rgba(15,23,42,.075),
    inset 0 1px 0 rgba(255,255,255,.42);
}

.jd-nearby-map-mode.is-active{
  border-color: rgba(var(--brand-rgb, 56,189,248), .48);
  background:
    linear-gradient(180deg, rgba(var(--brand-rgb, 56,189,248), .16), rgba(var(--brand-rgb, 56,189,248), .055)),
    var(--card);
  color: color-mix(in srgb, var(--text) 78%, rgb(var(--brand-rgb, 56,189,248)) 22%);
}

.jd-nearby-value-marker{
  --mk: #38bdf8;
  position: relative;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.jd-nearby-value-bubble{
  min-width: 54px;
  height: 32px;
  padding: 0 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;

  color: #ffffff;
  font-size: 12px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: -.02em;
  text-shadow: 0 1px 2px rgba(0,0,0,.25);

  background:
    radial-gradient(circle at 30% 18%, rgba(255,255,255,.34), transparent 34%),
    linear-gradient(180deg, color-mix(in srgb, var(--mk) 88%, white 12%), var(--mk));
  border: 2px solid rgba(255,255,255,.92);
  box-shadow:
    0 9px 20px rgba(15,23,42,.24),
    0 0 0 1px color-mix(in srgb, var(--mk) 55%, rgba(15,23,42,.22)),
    inset 0 1px 0 rgba(255,255,255,.42);
  white-space: nowrap;
}

.jd-nearby-value-bubble small{
  font-size: 9px;
  font-weight: 850;
  opacity: .96;
  transform: translateY(.5px);
}

.jd-nearby-value-marker.is-current .jd-nearby-value-bubble{
  height: 36px;
  min-width: 62px;
  border-width: 3px;
  box-shadow:
    0 11px 24px rgba(15,23,42,.30),
    0 0 0 3px color-mix(in srgb, var(--mk) 26%, transparent),
    inset 0 1px 0 rgba(255,255,255,.48);
}

.jd-nearby-value-marker.is-stale .jd-nearby-value-bubble{
  opacity: .62;
  filter: saturate(.78);
}

:root[data-theme="dark"] .jd-nearby-map-mode{
  box-shadow:
    0 2px 10px rgba(0,0,0,.20),
    inset 0 1px 0 rgba(255,255,255,.06);
}

:root[data-theme="dark"] .jd-nearby-value-bubble{
  border-color: rgba(255,255,255,.82);
  box-shadow:
    0 10px 24px rgba(0,0,0,.38),
    0 0 0 1px color-mix(in srgb, var(--mk) 58%, rgba(255,255,255,.20)),
    inset 0 1px 0 rgba(255,255,255,.30);
}

@media (max-width: 640px){
  .jd-nearby-map-controls{
    gap: 6px;
  }

  .jd-nearby-map-mode{
    padding: 7px 10px;
    font-size: 11px;
  }

  .jd-nearby-value-bubble{
    min-width: 50px;
    height: 30px;
    padding: 0 8px;
    font-size: 11.5px;
  }
}

/* =========================================================
   Nearby Map · móvil: lista completa sin scroll interno
   ========================================================= */

@media (max-width: 640px){
  .jd-nearby-map-list{
    max-height: none !important;
    overflow: visible !important;
  }

  .jd-nearby-map-side{
    align-content: stretch;
  }
}

/* =========================================================
   Nearby Map · móvil: CMI Live solo bajo la lista
   ========================================================= */

.jd-nearby-map-pill-mobile{
  display: none;
}

@media (max-width: 640px){
  .jd-nearby-map-head .jd-nearby-map-pill:not(.jd-nearby-map-pill-mobile){
    display: none !important;
  }

  .jd-nearby-map-pill-mobile{
    display: inline-flex !important;
    justify-self: center;
    margin: 4px auto 0;
  }
}

/* =========================================================
   Nearby Map · flechas de dirección del viento
   ========================================================= */

.jd-nearby-value-bubble{
  position: relative;
}

.jd-nearby-value-bubble.has-wind-arrow{
  padding-left: 10px;
  padding-right: 10px;
}

.jd-nearby-wind-arrow{
  position: absolute;
  left: 50%;
  top: -20px;

  width: 0;
  height: 0;

  transform:
    translateX(-50%)
    rotate(var(--jd-wind-deg, 0deg));

  transform-origin: 50% 23px;

  z-index: 4;

  filter:
    drop-shadow(0 1px 2px rgba(2,6,23,.34))
    drop-shadow(0 0 5px rgba(255,255,255,.52));
}

/* Cabeza de flecha: apunta hacia arriba antes de rotar */
.jd-nearby-wind-arrow::before{
  content: "";
  position: absolute;
  left: -6px;
  top: 0;

  width: 0;
  height: 0;

  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 15px solid rgba(255,255,255,.97);
}

/* Cola de flecha */
.jd-nearby-wind-arrow::after{
  content: "";
  position: absolute;
  left: -1.5px;
  top: 13px;

  width: 3px;
  height: 13px;

  border-radius: 999px;
  background: rgba(255,255,255,.97);
}

:root[data-theme="dark"] .jd-nearby-wind-arrow{
  filter:
    drop-shadow(0 1px 2px rgba(0,0,0,.46))
    drop-shadow(0 0 5px rgba(255,255,255,.36));
}

@media (max-width: 640px){
  .jd-nearby-wind-arrow{
    top: -17px;
    transform:
      translateX(-50%)
      rotate(var(--jd-wind-deg, 0deg))
      scale(.88);
  }
}

/* =========================================================
   Nearby Map · modo Direcció del vent
   ========================================================= */

.jd-nearby-value-bubble.winddir-only{
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 999px;
}

.jd-nearby-value-bubble.winddir-only .jd-nearby-wind-arrow{
  position: absolute;
  left: 50%;
  top: 50%;

  width: 4px;
  height: 27px;

  border-radius: 999px;
  background: rgba(255,255,255,.98);

  transform:
    translate(-50%, -50%)
    rotate(var(--jd-wind-deg, 0deg));

  transform-origin: 50% 50%;

  z-index: 5;

  filter:
    drop-shadow(0 1px 2px rgba(2,6,23,.34))
    drop-shadow(0 0 5px rgba(255,255,255,.46));
}

.jd-nearby-value-bubble.winddir-only .jd-nearby-wind-arrow::before{
  content: "";
  position: absolute;
  left: 50%;
  top: -8px;

  width: 0;
  height: 0;

  transform: translateX(-50%);

  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 13px solid rgba(255,255,255,.98);
}

.jd-nearby-value-bubble.winddir-only .jd-nearby-wind-arrow::after{
  display: none !important;
  content: none !important;
}

.jd-nearby-value-marker.is-current .jd-nearby-value-bubble.winddir-only{
  width: 48px;
  min-width: 48px;
  height: 48px;
}

.jd-nearby-value-marker.is-current .jd-nearby-value-bubble.winddir-only .jd-nearby-wind-arrow{
  height: 31px;
}

@media (max-width: 640px){
  .jd-nearby-value-bubble.winddir-only{
    width: 38px;
    min-width: 38px;
    height: 38px;
  }

  .jd-nearby-value-bubble.winddir-only .jd-nearby-wind-arrow{
    height: 24px;
  }
}

/* =========================================================
   Nearby Map · Direcció: solo flechas coloreadas, sin círculos
   ========================================================= */

.jd-nearby-value-bubble.winddir-only{
  width: 46px !important;
  min-width: 46px !important;
  height: 46px !important;
  padding: 0 !important;

  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  text-shadow: none !important;
  filter: none !important;
}

.jd-nearby-value-marker.is-current .jd-nearby-value-bubble.winddir-only{
  width: 52px !important;
  min-width: 52px !important;
  height: 52px !important;

  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* Flecha grande coloreada por intensidad del viento */
.jd-nearby-value-bubble.winddir-only .jd-nearby-wind-arrow{
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;

  width: 6px !important;
  height: 34px !important;

  border-radius: 999px !important;
  background: var(--mk, #38bdf8) !important;

  transform:
    translate(-50%, -50%)
    rotate(var(--jd-wind-deg, 0deg)) !important;

  transform-origin: 50% 50% !important;
  z-index: 5 !important;

  box-shadow:
    0 0 0 2px rgba(255,255,255,.92),
    0 5px 12px rgba(15,23,42,.28),
    0 0 10px color-mix(in srgb, var(--mk, #38bdf8) 42%, transparent) !important;

  filter: none !important;
}

/* Punta de la flecha */
.jd-nearby-value-bubble.winddir-only .jd-nearby-wind-arrow::before{
  content: "" !important;
  position: absolute !important;
  left: 50% !important;
  top: -10px !important;

  width: 0 !important;
  height: 0 !important;

  transform: translateX(-50%) !important;

  border-left: 11px solid transparent !important;
  border-right: 11px solid transparent !important;
  border-bottom: 16px solid var(--mk, #38bdf8) !important;

  filter:
    drop-shadow(0 -1px 0 rgba(255,255,255,.88))
    drop-shadow(1px 0 0 rgba(255,255,255,.88))
    drop-shadow(-1px 0 0 rgba(255,255,255,.88))
    drop-shadow(0 4px 8px rgba(15,23,42,.24)) !important;
}

/* Sin cola extra heredada */
.jd-nearby-value-bubble.winddir-only .jd-nearby-wind-arrow::after{
  display: none !important;
  content: none !important;
}

/* Marcador actual: un pelín más protagonista, pero sin círculo */
.jd-nearby-value-marker.is-current .jd-nearby-value-bubble.winddir-only .jd-nearby-wind-arrow{
  width: 7px !important;
  height: 39px !important;

  box-shadow:
    0 0 0 2.5px rgba(255,255,255,.94),
    0 7px 16px rgba(15,23,42,.32),
    0 0 13px color-mix(in srgb, var(--mk, #38bdf8) 50%, transparent) !important;
}

.jd-nearby-value-marker.is-current .jd-nearby-value-bubble.winddir-only .jd-nearby-wind-arrow::before{
  top: -11px !important;
  border-left-width: 12px !important;
  border-right-width: 12px !important;
  border-bottom-width: 18px !important;
}

/* Móvil: algo más compacto */
@media (max-width: 640px){
  .jd-nearby-value-bubble.winddir-only{
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
  }

  .jd-nearby-value-bubble.winddir-only .jd-nearby-wind-arrow{
    width: 5px !important;
    height: 29px !important;
  }

  .jd-nearby-value-bubble.winddir-only .jd-nearby-wind-arrow::before{
    top: -9px !important;
    border-left-width: 9px !important;
    border-right-width: 9px !important;
    border-bottom-width: 14px !important;
  }
}

/* =========================================================
   Nearby Map · botón Radar RainViewer integrado
   ========================================================= */

.jd-nearby-map-radar-toggle{
  position: relative;
  border-color: rgba(56,189,248,.34) !important;
}

.jd-nearby-map-radar-toggle::before{
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 6px;
  background: rgba(56,189,248,.85);
  box-shadow: 0 0 0 3px rgba(56,189,248,.14);
  vertical-align: middle;
}

.jd-nearby-map-radar-toggle.is-active{
  color: #ffffff !important;
  border-color: rgba(14,165,233,.62) !important;
  background:
    linear-gradient(180deg, rgba(14,165,233,.92), rgba(37,99,235,.82)) !important;
  box-shadow:
    0 8px 20px rgba(14,165,233,.22),
    inset 0 1px 0 rgba(255,255,255,.30) !important;
}

.jd-nearby-map-radar-toggle.is-active::before{
  background: #ffffff;
  box-shadow:
    0 0 0 3px rgba(255,255,255,.18),
    0 0 12px rgba(255,255,255,.48);
}

/* =========================================================
   Nearby Map · Popup · extremos v2 (más grandes, flechas color)
   ========================================================= */

.jd-nearby-map-pop-kpi-extremes{
  padding: 8px 7px;
}

.jd-nearby-map-extremes-values{
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  margin-bottom: 5px;
}

.jd-nearby-map-extremes-values .is-max,
.jd-nearby-map-extremes-values .is-min{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 28px;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(15,23,42,.03);
  border: 1px solid rgba(15,23,42,.06);
}

.jd-nearby-map-extremes-values .arr{
  font-style: normal;
  font-size: 21px;
  line-height: 1;
  font-weight: 900;
  transform: translateY(-1px);
}

.jd-nearby-map-extremes-values .val{
  color: #0f172a;
  font-size: 18px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: -.02em;
}

.jd-nearby-map-extremes-values .is-max .arr{
  color: #dc2626;   /* rojo */
}

.jd-nearby-map-extremes-values .is-min .arr{
  color: #2563eb;   /* azul */
}

.jd-nearby-map-extremes-values .is-max{
  background: linear-gradient(180deg, rgba(254,242,242,.96), rgba(254,226,226,.92));
  border-color: rgba(220,38,38,.16);
}

.jd-nearby-map-extremes-values .is-min{
  background: linear-gradient(180deg, rgba(239,246,255,.96), rgba(219,234,254,.92));
  border-color: rgba(37,99,235,.16);
}

/* Etiqueta "Extrems avui" un pelín más compacta */
.jd-nearby-map-pop-kpi-extremes > span{
  margin-top: 1px;
  font-size: 10px;
  line-height: 1.05;
}

/* modo oscuro */
:root[data-theme="dark"] .jd-nearby-map-extremes-values .is-max{
  background: linear-gradient(180deg, rgba(127,29,29,.26), rgba(185,28,28,.18));
  border-color: rgba(248,113,113,.22);
}

:root[data-theme="dark"] .jd-nearby-map-extremes-values .is-min{
  background: linear-gradient(180deg, rgba(30,58,138,.24), rgba(37,99,235,.16));
  border-color: rgba(96,165,250,.24);
}

:root[data-theme="dark"] .jd-nearby-map-extremes-values .val{
  color: #e5eefc;
}

/* =========================================================
   Nearby Map · Popup · extremos v3 compacto
   Reduce el bloque sin perder flechas rojo/azul
   ========================================================= */

.jd-nearby-map-pop-kpi-extremes{
  padding: 6px 7px !important;
}

.jd-nearby-map-extremes-values{
  gap: 3px !important;
  margin-bottom: 4px !important;
}

.jd-nearby-map-extremes-values .is-max,
.jd-nearby-map-extremes-values .is-min{
  min-height: 23px !important;
  padding: 2px 7px !important;
  gap: 6px !important;
  border-radius: 9px !important;
}

.jd-nearby-map-extremes-values .arr{
  font-size: 17px !important;
  transform: translateY(-1px) !important;
}

.jd-nearby-map-extremes-values .val{
  font-size: 15.5px !important;
  letter-spacing: -.02em !important;
}

.jd-nearby-map-pop-kpi-extremes > span{
  font-size: 9.5px !important;
  line-height: 1 !important;
}

/* móvil: todavía un pelín más recogido */
@media (max-width: 640px){
  .jd-nearby-map-pop-kpi-extremes{
    padding: 5px 6px !important;
  }

  .jd-nearby-map-extremes-values{
    gap: 2px !important;
    margin-bottom: 3px !important;
  }

  .jd-nearby-map-extremes-values .is-max,
  .jd-nearby-map-extremes-values .is-min{
    min-height: 21px !important;
    padding: 2px 6px !important;
    gap: 5px !important;
  }

  .jd-nearby-map-extremes-values .arr{
    font-size: 15.5px !important;
  }

  .jd-nearby-map-extremes-values .val{
    font-size: 14px !important;
  }

  .jd-nearby-map-pop-kpi-extremes > span{
    font-size: 9px !important;
  }
}

/* ===== END Nearby Map · Popup · extremos v3 compacto ===== */

/* =========================================================
   Nearby Map · Popup · extremos v4 más compactos + distancia centrada
   ========================================================= */

/* Extremos todavía más recogidos */
.jd-nearby-map-pop-kpi-extremes{
  padding: 5px 6px !important;
}

.jd-nearby-map-extremes-values{
  gap: 2px !important;
  margin-bottom: 3px !important;
}

.jd-nearby-map-extremes-values .is-max,
.jd-nearby-map-extremes-values .is-min{
  min-height: 18px !important;
  padding: 1px 6px !important;
  gap: 5px !important;
  border-radius: 8px !important;
}

.jd-nearby-map-extremes-values .arr{
  font-size: 13.5px !important;
  line-height: 1 !important;
  transform: translateY(-1px) !important;
}

.jd-nearby-map-extremes-values .val{
  font-size: 13.5px !important;
  line-height: 1 !important;
  font-weight: 900 !important;
  letter-spacing: -.02em !important;
}

.jd-nearby-map-pop-kpi-extremes > span{
  font-size: 9px !important;
  line-height: 1 !important;
}

/* El bloque de distancia es el 6º KPI de la popup */
.jd-nearby-map-popup-grid .jd-nearby-map-pop-kpi:nth-child(6){
  height: 100%;
  min-height: 0;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.jd-nearby-map-popup-grid .jd-nearby-map-pop-kpi:nth-child(6) > b{
  margin-bottom: 4px;
}

/* Móvil: compactamos un puntito más */
@media (max-width: 640px){
  .jd-nearby-map-pop-kpi-extremes{
    padding: 4px 5px !important;
  }

  .jd-nearby-map-extremes-values{
    gap: 2px !important;
    margin-bottom: 2px !important;
  }

  .jd-nearby-map-extremes-values .is-max,
  .jd-nearby-map-extremes-values .is-min{
    min-height: 17px !important;
    padding: 1px 5px !important;
    gap: 4px !important;
  }

  .jd-nearby-map-extremes-values .arr{
    font-size: 12.5px !important;
  }

  .jd-nearby-map-extremes-values .val{
    font-size: 12.8px !important;
  }

  .jd-nearby-map-pop-kpi-extremes > span{
    font-size: 8.8px !important;
  }
}

/* ===== END Nearby Map · Popup · extremos v4 ===== */

/* =========================================================
   Regional Map · marcadores compactos por zoom
   ========================================================= */

.jd-regional-compact-marker{
  --mk: #38bdf8;
  position: relative;
  transform: translate(-50%, -50%);
}

.jd-regional-dot-marker{
  width: 16px;
  height: 16px;
  border-radius: 999px;

  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,.45), transparent 34%),
    var(--mk);

  border: 2px solid rgba(255,255,255,.94);

  box-shadow:
    0 4px 10px rgba(15,23,42,.28),
    0 0 0 1px color-mix(in srgb, var(--mk) 62%, rgba(15,23,42,.22)),
    0 0 10px color-mix(in srgb, var(--mk) 36%, transparent);
}

.jd-regional-compact-marker.is-current .jd-regional-dot-marker{
  width: 21px;
  height: 21px;
  border-width: 3px;
  box-shadow:
    0 6px 14px rgba(15,23,42,.32),
    0 0 0 3px color-mix(in srgb, var(--mk) 28%, transparent),
    0 0 14px color-mix(in srgb, var(--mk) 44%, transparent);
}

.jd-regional-compact-marker.is-stale .jd-regional-dot-marker{
  opacity: .58;
  filter: saturate(.72);
}

/* En regional, en móvil no queremos una lista infinita ocupando media vida */
@media (max-width: 640px){
  .jd-nearby-map-list{
    max-height: 360px !important;
    overflow: auto !important;
  }
}

/* ===== END Regional Map · marcadores compactos por zoom ===== */

/* =========================================================
   Regional Map · marcador compacto + expansión al pulsar
   ========================================================= */

.jd-regional-compact-marker{
  --mk: #38bdf8;
  position: relative;
  transform: translate(-50%, -50%);
}

.jd-regional-dot-marker{
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,.46), transparent 34%),
    var(--mk);
  border: 2px solid rgba(255,255,255,.94);
  box-shadow:
    0 4px 10px rgba(15,23,42,.26),
    0 0 0 1px color-mix(in srgb, var(--mk) 62%, rgba(15,23,42,.20)),
    0 0 10px color-mix(in srgb, var(--mk) 34%, transparent);
  transition:
    transform .14s ease,
    box-shadow .16s ease,
    opacity .16s ease;
}

.jd-regional-compact-marker.is-current .jd-regional-dot-marker{
  width: 21px;
  height: 21px;
  border-width: 3px;
  box-shadow:
    0 6px 14px rgba(15,23,42,.30),
    0 0 0 3px color-mix(in srgb, var(--mk) 28%, transparent),
    0 0 14px color-mix(in srgb, var(--mk) 42%, transparent);
}

.jd-regional-compact-marker.is-stale .jd-regional-dot-marker{
  opacity: .60;
  filter: saturate(.76);
}

.jd-nearby-value-marker.is-expanded{
  z-index: 9999;
}

.jd-nearby-value-marker.is-expanded .jd-nearby-value-bubble{
  animation: jdRegionalMarkerExpand .16s ease-out;
  box-shadow:
    0 12px 26px rgba(15,23,42,.34),
    0 0 0 4px color-mix(in srgb, var(--mk) 24%, transparent),
    inset 0 1px 0 rgba(255,255,255,.50);
}

@keyframes jdRegionalMarkerExpand{
  from{
    transform: scale(.86);
    opacity: .78;
  }
  to{
    transform: scale(1);
    opacity: 1;
  }
}

/* En regional, en móvil mantenemos lista con scroll para no alargar demasiado */
@media (max-width: 640px){
  .jd-nearby-map-list{
    max-height: 360px !important;
    overflow: auto !important;
  }
}

/* ===== END Regional Map · expansión marcador ===== */

/* =========================================================
   Regional Map · corrección ancla visual marker/popup
   Centra el contenido real del divIcon para que la flecha
   del popup apunte al marcador expandido
   ========================================================= */

/* El contenedor Leaflet del divIcon debe comportarse como caja centradora */
#jdNearbyMap .leaflet-marker-icon.jd-nearby-divicon{
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: visible !important;
}

/* Anulamos el translate heredado del mapa de proximidad.
   En regional usamos el iconAnchor de Leaflet como centro real. */
#jdNearbyMap .leaflet-marker-icon.jd-nearby-divicon .jd-nearby-value-marker,
#jdNearbyMap .leaflet-marker-icon.jd-regional-compact-divicon .jd-regional-compact-marker{
  transform: none !important;
  position: relative !important;
  left: auto !important;
  top: auto !important;
}

/* La píldora expandida queda centrada dentro de su caja Leaflet */
#jdNearbyMap .leaflet-marker-icon.jd-nearby-divicon .jd-nearby-value-marker{
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* El punto compacto también queda centrado exacto */
#jdNearbyMap .leaflet-marker-icon.jd-regional-compact-divicon{
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Evita pequeños desplazamientos visuales por márgenes/line-height */
#jdNearbyMap .leaflet-marker-icon.jd-nearby-divicon .jd-nearby-value-bubble,
#jdNearbyMap .leaflet-marker-icon.jd-regional-compact-divicon .jd-regional-dot-marker{
  margin: 0 !important;
}

/* Un pelín más de prioridad visual para el marcador seleccionado */
#jdNearbyMap .jd-nearby-value-marker.is-expanded{
  position: relative !important;
  z-index: 10000 !important;
}

/* ===== END Regional Map · corrección ancla visual marker/popup ===== */

/* =========================================================
   Regional Map · leyenda dinámica por variable
   ========================================================= */

.jd-regional-legend{
  margin-top: 10px;
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.jd-regional-legend-title{
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px 8px;
  font-size: 11.5px;
  line-height: 1.25;
  font-weight: 750;
}

.jd-regional-legend-title b{
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.jd-regional-legend-title span{
  color: var(--muted);
}

.jd-regional-legend-scale{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: stretch;
}

.jd-regional-legend-step{
  min-width: 74px;
  flex: 0 1 auto;
  display: grid;
  grid-template-columns: 12px minmax(0, auto);
  grid-template-areas:
    "sw label"
    "sw name";
  column-gap: 6px;
  align-items: center;

  padding: 6px 8px;
  border-radius: 13px;
  border: 1px solid rgba(var(--brand-rgb, 56,189,248), .13);
  background:
    linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,.08)),
    rgba(var(--brand-rgb, 56,189,248), .035);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.35),
    0 2px 7px rgba(15,23,42,.035);
}

.jd-regional-legend-step i{
  grid-area: sw;
  width: 12px;
  height: 28px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 35% 22%, rgba(255,255,255,.45), transparent 34%),
    var(--lg, #38bdf8);
  border: 1px solid rgba(255,255,255,.80);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--lg, #38bdf8) 55%, rgba(15,23,42,.16)),
    0 3px 7px rgba(15,23,42,.12);
}

.jd-regional-legend-step span{
  grid-area: label;
  color: var(--text);
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
  white-space: nowrap;
}

.jd-regional-legend-step small{
  grid-area: name;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.05;
  font-weight: 760;
  white-space: nowrap;
}

.jd-regional-legend-note{
  margin: 0;
  max-width: 860px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  font-weight: 680;
}

:root[data-theme="dark"] .jd-regional-legend-step,
html[data-theme="dark"] .jd-regional-legend-step,
html.dark .jd-regional-legend-step,
body.dark .jd-regional-legend-step{
  background:
    linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025)),
    rgba(var(--brand-rgb, 56,189,248), .05);
  border-color: rgba(255,255,255,.10);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.08),
    0 2px 8px rgba(0,0,0,.18);
}

@media (max-width: 640px){
  .jd-regional-legend{
    gap: 7px;
  }

  .jd-regional-legend-scale{
    gap: 5px;
  }

  .jd-regional-legend-step{
    min-width: 68px;
    padding: 5px 7px;
    border-radius: 12px;
  }

  .jd-regional-legend-step i{
    width: 11px;
    height: 25px;
  }

  .jd-regional-legend-step span{
    font-size: 10.5px;
  }

  .jd-regional-legend-step small{
    font-size: 9px;
  }

  .jd-regional-legend-note{
    font-size: 10.5px;
  }
}

/* ===== END Regional Map · leyenda dinámica por variable ===== */

/* =========================================================
   Regional Map · ajuste leyenda: sin nota + puntos redondos
   ========================================================= */

.jd-regional-legend-note{
  display: none !important;
}

.jd-regional-legend-scale{
  gap: 8px !important;
}

.jd-regional-legend-step{
  grid-template-columns: 18px minmax(0, auto) !important;
  column-gap: 8px !important;
  padding: 7px 10px !important;
}

.jd-regional-legend-step i{
  grid-area: sw !important;
  width: 18px !important;
  height: 18px !important;
  border-radius: 999px !important;

  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,.46), transparent 34%),
    var(--lg, #38bdf8) !important;

  border: 2px solid rgba(255,255,255,.94) !important;

  box-shadow:
    0 4px 10px rgba(15,23,42,.26),
    0 0 0 1px color-mix(in srgb, var(--lg, #38bdf8) 62%, rgba(15,23,42,.20)),
    0 0 10px color-mix(in srgb, var(--lg, #38bdf8) 34%, transparent) !important;

  align-self: center !important;
}

@media (max-width: 640px){
  .jd-regional-legend-step{
    grid-template-columns: 16px minmax(0, auto) !important;
    column-gap: 7px !important;
    padding: 6px 9px !important;
  }

  .jd-regional-legend-step i{
    width: 16px !important;
    height: 16px !important;
  }
}

/* ===== END ajuste leyenda redonda ===== */
