/* Bagyo Serye v1.3.3D1 — map presentation, marker scaling and radar-control fix */

.source-diagnostics-card {
  margin: 0 0 18px;
  overflow: hidden;
}

.source-diagnostics-intro {
  margin: 0 0 13px;
  color: #9fb6c8;
  font-size: .86rem;
  line-height: 1.5;
}

#viewSourceStatusBtn {
  padding-inline: 11px;
}

/* Dedicated map layer stack. Leaflet panes receive the same values in app.js. */
.leaflet-pane.bagyo-base-pane { z-index: 200; }
.leaflet-pane.bagyo-clouds-pane { z-index: 310; }
.leaflet-pane.bagyo-radar-pane { z-index: 320; }
.leaflet-pane.bagyo-wind-pane { z-index: 330; }
.leaflet-pane.bagyo-track-pane { z-index: 420; }
.leaflet-pane.bagyo-labels-pane { z-index: 440; }
.leaflet-pane.bagyo-forecast-pane { z-index: 450; }
.leaflet-pane.bagyo-current-label-pane { z-index: 480; }
.leaflet-pane.bagyo-current-center-pane { z-index: 500; }
.leaflet-pane.bagyo-interface-pane { z-index: 800; pointer-events: none; }

.bagyo-cyclone-map {
  --current-marker-size: 28px;
  --current-marker-font: 8px;
  --current-label-font: 8px;
  --current-label-offset: 19px;
  --forecast-dot-size: 7px;
  --historical-dot-size: 5px;
  --forecast-label-font: 8px;
}

.bagyo-cyclone-map[data-cyclone-zoom-tier="regional"] {
  --current-marker-size: 20px;
  --current-marker-font: 7px;
  --current-label-font: 7px;
  --current-label-offset: 15px;
  --forecast-dot-size: 5px;
  --historical-dot-size: 4px;
  --forecast-label-font: 7px;
}

.bagyo-cyclone-map[data-cyclone-zoom-tier="overview"] {
  --current-marker-size: 28px;
  --current-marker-font: 8px;
  --current-label-font: 8px;
  --current-label-offset: 20px;
  --forecast-dot-size: 7px;
  --historical-dot-size: 5px;
  --forecast-label-font: 8px;
}

.bagyo-cyclone-map[data-cyclone-zoom-tier="local"] {
  --current-marker-size: 36px;
  --current-marker-font: 9px;
  --current-label-font: 9px;
  --current-label-offset: 25px;
  --forecast-dot-size: 9px;
  --historical-dot-size: 7px;
  --forecast-label-font: 9px;
}

.bagyo-cyclone-map[data-cyclone-zoom-tier="detail"] {
  --current-marker-size: 48px;
  --current-marker-font: 11px;
  --current-label-font: 10px;
  --current-label-offset: 32px;
  --forecast-dot-size: 11px;
  --historical-dot-size: 8px;
  --forecast-label-font: 9px;
}

.bagyo-cyclone-map .bagyo-disturbance-divicon,
.bagyo-cyclone-map .current-position-label-divicon,
.bagyo-cyclone-map .track-dot-divicon,
.bagyo-cyclone-map .track-label-divicon {
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
  overflow: visible !important;
}

.bagyo-cyclone-map .disturbance-marker {
  width: var(--current-marker-size);
  height: var(--current-marker-size);
  transform: translate(-50%, -50%);
  filter:
    drop-shadow(0 calc(var(--current-marker-size) * .09) calc(var(--current-marker-size) * .22) rgba(0, 0, 0, .7))
    drop-shadow(0 0 calc(var(--current-marker-size) * .18) color-mix(in srgb, var(--disturbance-color) 56%, transparent));
}

.bagyo-cyclone-map .disturbance-marker__shield {
  inset: 11%;
  border-width: max(1px, calc(var(--current-marker-size) * .025));
  box-shadow:
    inset 0 0 0 max(1px, calc(var(--current-marker-size) * .055)) rgba(3, 12, 22, .74),
    inset 0 0 calc(var(--current-marker-size) * .2) color-mix(in srgb, var(--disturbance-color) 18%, transparent),
    0 0 calc(var(--current-marker-size) * .2) color-mix(in srgb, var(--disturbance-color) 52%, transparent);
}

.bagyo-cyclone-map .disturbance-marker__ring {
  inset: 1%;
}

.bagyo-cyclone-map .disturbance-marker__ring::after {
  inset: 10%;
}

.bagyo-cyclone-map .disturbance-marker__vortex {
  width: 55%;
  height: 55%;
  stroke-width: 4;
}

.bagyo-cyclone-map .disturbance-marker__badge {
  min-width: max(14px, calc(var(--current-marker-size) * .46));
  height: max(12px, calc(var(--current-marker-size) * .36));
  padding: 0 2px;
  border-radius: max(4px, calc(var(--current-marker-size) * .1));
  font-size: var(--current-marker-font);
  letter-spacing: .025em;
}

.bagyo-cyclone-map .disturbance-marker__position-label,
.bagyo-cyclone-map .disturbance-marker__source-badge {
  display: none !important;
}

.current-position-label {
  position: absolute;
  left: 0;
  top: 0;
  width: max-content;
  max-width: min(230px, 44vw);
  padding: 4px 7px;
  border: 1px solid color-mix(in srgb, var(--current-label-color, #49cfff) 55%, rgba(255, 255, 255, .22));
  border-radius: 7px;
  background: rgba(2, 10, 18, .94);
  box-shadow: 0 5px 16px rgba(0, 0, 0, .4);
  color: #f4fbff;
  font: 800 var(--current-label-font)/1.15 Inter, system-ui, sans-serif;
  letter-spacing: .035em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}

.current-position-label-divicon[data-anchor="bottom-right"] .current-position-label {
  transform: translate(var(--current-label-offset), var(--current-label-offset));
}

.current-position-label-divicon[data-anchor="top-right"] .current-position-label {
  transform: translate(var(--current-label-offset), calc(-100% - var(--current-label-offset)));
}

.current-position-label-divicon[data-anchor="bottom-left"] .current-position-label {
  transform: translate(calc(-100% - var(--current-label-offset)), var(--current-label-offset));
}

.current-position-label-divicon[data-anchor="top-left"] .current-position-label {
  transform: translate(calc(-100% - var(--current-label-offset)), calc(-100% - var(--current-label-offset)));
}

.bagyo-cyclone-map[data-cyclone-zoom-tier="regional"] .current-position-label-divicon {
  display: none !important;
}

.current-position-label__source,
.current-position-label__detail {
  color: #a9c9dc;
}

.bagyo-cyclone-map[data-cyclone-zoom-tier="overview"] .current-position-label__source,
.bagyo-cyclone-map[data-cyclone-zoom-tier="overview"] .current-position-label__detail,
.bagyo-cyclone-map[data-cyclone-zoom-tier="local"] .current-position-label__detail {
  display: none;
}

.track-dot {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--forecast-dot-size);
  height: var(--forecast-dot-size);
  transform: translate(-50%, -50%);
  border: 1.5px solid #f2eaff;
  border-radius: 50%;
  background: #9d7dff;
  box-shadow: 0 0 calc(var(--forecast-dot-size) * .9) rgba(184, 156, 255, .9);
}

.track-dot.historical {
  width: var(--historical-dot-size);
  height: var(--historical-dot-size);
  border-color: #d5e3ed;
  background: #6f8da8;
  box-shadow: none;
}

.track-label {
  position: absolute;
  left: 0;
  top: 0;
  width: max-content;
  padding: 3px 5px;
  border: 1px solid rgba(188, 168, 255, .62);
  border-radius: 5px;
  background: rgba(35, 27, 62, .92);
  color: #f4efff;
  font: 850 var(--forecast-label-font)/1 Inter, system-ui, sans-serif;
  letter-spacing: .025em;
  white-space: nowrap;
  pointer-events: none;
}

.track-label.historical {
  border-color: rgba(145, 174, 198, .52);
  background: rgba(24, 42, 58, .9);
  color: #dcebf5;
}

.track-label-divicon[data-anchor="top-right"] .track-label { transform: translate(8px, calc(-100% - 7px)); }
.track-label-divicon[data-anchor="bottom-right"] .track-label { transform: translate(8px, 7px); }
.track-label-divicon[data-anchor="top-left"] .track-label { transform: translate(calc(-100% - 8px), calc(-100% - 7px)); }
.track-label-divicon[data-anchor="bottom-left"] .track-label { transform: translate(calc(-100% - 8px), 7px); }
.track-label-divicon[data-collision-hidden="true"],
.track-label-divicon[data-zoom-hidden="true"] { display: none !important; }

.bagyo-cyclone-map[data-cyclone-zoom-tier="regional"] .track-label-divicon[data-relevance="minor"],
.bagyo-cyclone-map[data-cyclone-zoom-tier="overview"] .track-label-divicon[data-relevance="minor"] {
  display: none !important;
}

/* One contained, compact radar legend per map. */
.bagyo-operational-map .bagyo-radar-legend {
  position: absolute;
  z-index: 800;
  width: clamp(220px, 23vw, 270px);
  max-height: 150px;
  margin: 0;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(3, 13, 24, .91);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .42);
  overflow: hidden;
  pointer-events: auto;
}

.bagyo-operational-map .bagyo-radar-legend[data-position="bottom-right"] { right: 12px; bottom: 38px; left: auto; top: auto; }
.bagyo-operational-map .bagyo-radar-legend[data-position="bottom-left"] { left: 52px; bottom: 38px; right: auto; top: auto; }
.bagyo-operational-map .bagyo-radar-legend[data-position="top-right"] { right: 12px; top: 12px; left: auto; bottom: auto; }
.bagyo-operational-map .bagyo-radar-legend[data-position="top-left"] { left: 52px; top: 12px; right: auto; bottom: auto; }

.bagyo-operational-map .premium-map-legend {
  left: 12px;
  bottom: 12px;
  z-index: 790;
  max-width: min(60%, 310px);
}

.bagyo-operational-map .map-time-badge {
  position: absolute;
  z-index: 790;
  top: 12px;
  right: 12px;
  margin: 0;
  max-width: min(55%, 320px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.radar-legend-head,
.radar-legend-actions {
  display: flex;
  align-items: center;
}

.radar-legend-head {
  justify-content: space-between;
  gap: 8px;
}

.radar-legend-head > div:first-child {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.radar-legend-head b {
  color: #f2f9ff;
  font-size: 13px;
}

.radar-legend-head small {
  max-width: 118px;
  overflow: hidden;
  color: #94afc1;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.radar-legend-actions {
  flex: 0 0 auto;
  gap: 4px;
}

.radar-legend-actions button {
  min-height: 26px;
  padding: 4px 6px;
  border: 1px solid rgba(116, 190, 231, .24);
  border-radius: 7px;
  background: rgba(29, 91, 126, .22);
  color: #cceafa;
  font: 750 8px/1 system-ui, sans-serif;
  cursor: pointer;
}

.bagyo-radar-legend .radar-gradient {
  height: 8px;
  margin: 7px 0 3px;
}

.bagyo-radar-legend .radar-labels {
  font-size: 8px;
}

.radar-about {
  margin-top: 4px;
  color: #8fa9ba;
  font-size: 8px;
}

.radar-about summary {
  width: max-content;
  color: #9edfff;
  cursor: pointer;
}

.radar-about p {
  margin: 4px 0 0;
  line-height: 1.35;
}

.bagyo-radar-legend[data-collapsed="true"] {
  width: 132px;
  max-height: 38px;
  padding: 6px 7px;
  border-radius: 999px;
}

.bagyo-radar-legend[data-collapsed="true"] .radar-legend-body,
.bagyo-radar-legend[data-collapsed="true"] .radar-legend-head small,
.bagyo-radar-legend[data-collapsed="true"] #dashboardRadarLegendClose {
  display: none;
}

.bagyo-radar-legend[data-collapsed="true"] .radar-legend-head {
  gap: 5px;
}

.bagyo-radar-legend[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  .bagyo-operational-map .bagyo-radar-legend,
  .bagyo-operational-map .bagyo-radar-legend[data-position] {
    position: absolute;
    left: 50%;
    right: auto;
    top: auto;
    bottom: 34px;
    width: min(300px, calc(100% - 24px));
    max-height: 160px;
    transform: translateX(-50%);
  }

  .bagyo-operational-map .bagyo-radar-legend[data-collapsed="true"] {
    width: 144px;
  }

  .bagyo-operational-map .bagyo-radar-legend[data-mobile-position="top"] {
    top: 42px;
    bottom: auto;
  }

  .bagyo-cyclone-map[data-cyclone-zoom-tier="regional"] { --current-marker-size: 22px; --forecast-dot-size: 6px; }
  .bagyo-cyclone-map[data-cyclone-zoom-tier="overview"] { --current-marker-size: 28px; --forecast-dot-size: 7px; }
  .bagyo-cyclone-map[data-cyclone-zoom-tier="local"] { --current-marker-size: 36px; --forecast-dot-size: 9px; }
  .bagyo-cyclone-map[data-cyclone-zoom-tier="detail"] { --current-marker-size: 46px; --forecast-dot-size: 11px; }

  .bagyo-operational-map .premium-map-legend {
    left: 8px;
    bottom: 8px;
    max-width: 48%;
    padding: 7px 8px;
  }

  .bagyo-operational-map .map-time-badge {
    top: 8px;
    right: 8px;
    max-width: 58%;
    font-size: 8px;
  }
}

@media (max-width: 640px) {
  #cyclones-view .page-toolbar .toolbar-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .source-diagnostics-card {
    padding: 14px;
  }

  .current-position-label {
    max-width: min(190px, 50vw);
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bagyo-cyclone-map .disturbance-marker__ring,
  .bagyo-cyclone-map .disturbance-marker__vortex {
    animation: none !important;
  }
}
