/* 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);
}
