/* Pillan360 · barra móvil de monitores y visores territoriales. */
#map-monitor-canvas { position: relative; isolation: isolate; }
.map-monitor-toolbar {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 3000;
    max-width: calc(100% - 2rem);
    padding: .4rem;
    border: 1px solid rgba(100,116,139,.72);
    border-radius: .75rem;
    background: rgba(15,23,42,.93);
    box-shadow: 0 12px 30px rgba(0,0,0,.38);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    user-select: none;
    pointer-events: auto;
    transform: translateZ(0);
}
.map-monitor-toolbar.is-dragging { cursor: grabbing; box-shadow: 0 16px 38px rgba(0,0,0,.52); }
.map-monitor-toolbar-row { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; }
.map-monitor-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    min-height: 2rem;
    border: 1px solid rgba(100,116,139,.65);
    border-radius: .5rem;
    color: rgb(148,163,184);
    background: rgba(30,41,59,.86);
    cursor: grab;
    touch-action: none;
}
.map-monitor-drag-handle:active { cursor: grabbing; }
.map-monitor-drag-handle:hover { color: white; background: rgba(51,65,85,.95); }
.map-monitor-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 2rem;
    padding: .42rem .68rem;
    border-width: 1px;
    border-style: solid;
    border-radius: .5rem;
    font-size: .66rem;
    line-height: 1;
    font-weight: 800;
    letter-spacing: .035em;
    white-space: nowrap;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}
.map-monitor-btn:hover { transform: translateY(-1px); }
.map-monitor-btn-wikiloc { color: rgb(209,250,229); background: rgba(6,78,59,.78); border-color: rgba(52,211,153,.72); }
.map-monitor-btn-wikiloc:hover { background: rgba(5,150,105,.78); }
.map-monitor-layer-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .25rem;
    margin-top: .38rem;
    padding-top: .38rem;
    border-top: 1px solid rgba(100,116,139,.38);
}
.light-mode .map-monitor-toolbar { background: rgba(248,250,252,.94); border-color: rgba(100,116,139,.52); }
.light-mode .map-monitor-drag-handle { background: rgba(226,232,240,.9); color: rgb(51,65,85); }
@media (max-width: 640px) {
    .map-monitor-toolbar { top: .5rem; left: .5rem; max-width: calc(100% - 1rem); }
    .map-monitor-toolbar-row { gap: .25rem; }
    .map-monitor-btn { padding: .38rem .5rem; font-size: .58rem; }
    .map-monitor-btn span { max-width: 7.5rem; overflow: hidden; text-overflow: ellipsis; }
}

.map-monitor-surface {
    position: relative; z-index: 1; isolation: isolate;
    width: 100%; height: 100%; min-height: 0; border: 0; background: rgb(15,23,42);
}
.map-monitor-attribution {
    position: absolute; right: .5rem; bottom: .5rem; z-index: 2400;
    padding: .18rem .5rem; border-radius: .35rem;
    background: rgba(15,23,42,.78); color: rgb(148,163,184);
    font-size: .625rem; line-height: 1.2; pointer-events: none;
}
.map-monitor-external-note {
    position: absolute; left: .6rem; bottom: .6rem; z-index: 2500;
    display: flex; align-items: center; flex-wrap: wrap; gap: .45rem;
    max-width: min(72%, 44rem); padding: .42rem .58rem;
    border: 1px solid rgba(100,116,139,.62); border-radius: .55rem;
    background: rgba(15,23,42,.9); color: rgb(203,213,225);
    font-size: .64rem; line-height: 1.25; box-shadow: 0 8px 20px rgba(0,0,0,.32);
}
.map-monitor-external-note a {
    flex: 0 0 auto; color: rgb(125,211,252); font-weight: 800; text-decoration: underline;
    text-underline-offset: 2px;
}
.nasa-monitor-tool {
    display: inline-flex; align-items: center; justify-content: center; gap: .28rem;
    min-height: 1.8rem; padding: .32rem .48rem; border: 1px solid rgba(100,116,139,.62);
    border-radius: .45rem; background: rgba(30,41,59,.88); color: rgb(226,232,240);
    font-size: .6rem; line-height: 1; font-weight: 800; transition: .16s ease;
}
.nasa-monitor-tool:hover { background: rgba(51,65,85,.96); transform: translateY(-1px); }
.nasa-monitor-tool.is-active { background: rgba(185,28,28,.82); border-color: rgba(248,113,113,.88); color: white; }
#nasa-monitor-map { position: relative; z-index: 1; isolation: isolate; }
#nasa-monitor-map .leaflet-map-pane,
#nasa-monitor-map .leaflet-control-container { z-index: auto; }
.light-mode .map-monitor-external-note { background: rgba(248,250,252,.94); color: rgb(30,41,59); }
.light-mode .map-monitor-attribution { background: rgba(248,250,252,.82); color: rgb(51,65,85); }
@media (max-width: 640px) {
    .map-monitor-external-note { max-width: calc(100% - 1.2rem); right: .6rem; font-size: .58rem; }
    .nasa-monitor-tool span { display: none; }
}


/* Flood Hub no admite iframe (X-Frame-Options: DENY). */
.flood-hub-panel {
    display: flex; align-items: center; justify-content: center;
    padding: 1.25rem; overflow: auto;
    background:
      radial-gradient(circle at 50% 18%, rgba(14,165,233,.22), transparent 38%),
      linear-gradient(145deg, rgb(15,23,42), rgb(2,6,23));
}
.flood-hub-card {
    width: min(34rem, 100%); padding: 1.35rem 1.5rem; text-align: center;
    border: 1px solid rgba(56,189,248,.42); border-radius: 1rem;
    background: rgba(15,23,42,.9); color: rgb(226,232,240);
    box-shadow: 0 18px 48px rgba(0,0,0,.42);
}
.flood-hub-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 4rem; height: 4rem; margin-bottom: .8rem; border-radius: 999px;
    color: rgb(125,211,252); background: rgba(14,116,144,.28);
    border: 1px solid rgba(56,189,248,.42);
}
.flood-hub-card h3 { margin: 0 0 .55rem; font-size: 1.15rem; font-weight: 900; color: white; }
.flood-hub-card p { margin: .35rem 0; font-size: .78rem; line-height: 1.5; color: rgb(203,213,225); }
.flood-hub-card .flood-hub-coordinates { font-family: ui-monospace, monospace; color: rgb(125,211,252); }
.flood-hub-open {
    display: inline-flex; align-items: center; justify-content: center;
    margin: .8rem 0 .65rem; padding: .65rem 1rem; border-radius: .6rem;
    color: white; background: rgb(2,132,199); border: 1px solid rgb(56,189,248);
    font-size: .72rem; font-weight: 900; text-decoration: none;
}
.flood-hub-open:hover { background: rgb(3,105,161); }
.flood-hub-card small { display: block; font-size: .62rem; line-height: 1.4; color: rgb(148,163,184); }
.light-mode .flood-hub-panel { background: linear-gradient(145deg, rgb(241,245,249), rgb(224,242,254)); }
.light-mode .flood-hub-card { background: rgba(248,250,252,.94); color: rgb(30,41,59); }
.light-mode .flood-hub-card h3 { color: rgb(15,23,42); }
.light-mode .flood-hub-card p { color: rgb(51,65,85); }

/* Estado colapsado: la barra se reduce al asa cuadrada y sigue siendo móvil. */
.map-monitor-toolbar.is-collapsed {
    width: 2.8rem;
    height: 2.8rem;
    min-width: 2.8rem;
    max-width: 2.8rem;
    padding: .35rem;
    overflow: hidden;
    border-radius: .72rem;
}
.map-monitor-toolbar.is-collapsed .map-monitor-toolbar-row {
    display: block;
    width: 2rem;
    height: 2rem;
}
.map-monitor-toolbar.is-collapsed .map-monitor-toolbar-row > :not(.map-monitor-drag-handle),
.map-monitor-toolbar.is-collapsed .map-monitor-layer-controls {
    display: none !important;
}
.map-monitor-toolbar.is-collapsed .map-monitor-drag-handle {
    width: 2rem;
    height: 2rem;
    min-height: 2rem;
    cursor: grab;
}
.map-monitor-toolbar.is-collapsed.is-dragging .map-monitor-drag-handle { cursor: grabbing; }

/* Explorador OpenStreetMap con lectura y copia de coordenadas. */
#osm-monitor-map {
    position: relative;
    z-index: 1;
    isolation: isolate;
    cursor: crosshair;
}
#osm-monitor-map .leaflet-container { cursor: crosshair; }
#osm-monitor-map .leaflet-dragging .leaflet-grab,
#osm-monitor-map .leaflet-dragging .leaflet-grab .leaflet-interactive { cursor: grabbing; }
.osm-coordinate-panel {
    position: absolute;
    left: .65rem;
    bottom: .65rem;
    z-index: 2600;
    display: flex;
    align-items: center;
    gap: .55rem;
    max-width: calc(100% - 1.3rem);
    padding: .48rem .58rem;
    border: 1px solid rgba(74,222,128,.58);
    border-radius: .62rem;
    color: rgb(226,232,240);
    background: rgba(15,23,42,.92);
    box-shadow: 0 10px 26px rgba(0,0,0,.38);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.osm-coordinate-readout {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: .08rem;
}
.osm-coordinate-label {
    color: rgb(148,163,184);
    font-size: .55rem;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: .065em;
    text-transform: uppercase;
}
#osm-coordinate-value {
    overflow: hidden;
    color: rgb(187,247,208);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .72rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.osm-coordinate-copy {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    min-height: 1.85rem;
    padding: .35rem .55rem;
    border: 1px solid rgba(74,222,128,.68);
    border-radius: .48rem;
    color: white;
    background: rgba(21,128,61,.88);
    font-size: .62rem;
    font-weight: 900;
    transition: .16s ease;
}
.osm-coordinate-copy:hover:not(:disabled) { background: rgb(22,163,74); transform: translateY(-1px); }
.osm-coordinate-copy:disabled { cursor: not-allowed; opacity: .45; }
.light-mode .osm-coordinate-panel {
    color: rgb(15,23,42);
    background: rgba(248,250,252,.95);
    border-color: rgba(22,163,74,.48);
}
.light-mode .osm-coordinate-label { color: rgb(71,85,105); }
.light-mode #osm-coordinate-value { color: rgb(20,83,45); }
@media (max-width: 640px) {
    .osm-coordinate-panel { right: .65rem; gap: .4rem; }
    #osm-coordinate-value { font-size: .64rem; }
    .osm-coordinate-copy span { display: none; }
}

/* Selector de capas e intercambio de archivos OpenStreetMap. */
#osm-layer-controls .nasa-monitor-tool:disabled {
    cursor: not-allowed;
    opacity: .42;
    transform: none;
}
#osm-monitor-map .leaflet-control-layers {
    border: 1px solid rgba(56,189,248,.45);
    background: rgba(15,23,42,.94);
    color: rgb(226,232,240);
    box-shadow: 0 8px 24px rgba(0,0,0,.34);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
#osm-monitor-map .leaflet-control-layers-expanded {
    min-width: 14.2rem;
    max-height: min(72vh, 34rem);
    overflow-y: auto;
    padding: .55rem .65rem;
    font-size: .72rem;
    line-height: 1.45;
}
#osm-monitor-map .leaflet-control-layers-separator {
    border-top-color: rgba(148,163,184,.3);
}
#osm-monitor-map .leaflet-control-layers label {
    color: inherit;
}
.light-mode #osm-monitor-map .leaflet-control-layers {
    border-color: rgba(14,116,144,.35);
    background: rgba(248,250,252,.96);
    color: rgb(15,23,42);
}


/* Capas temáticas OSM y contraste de datos importados. */
#osm-layer-controls {
    align-items: flex-start;
    gap: .4rem;
}
.osm-control-group {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .25rem;
    padding: .24rem .3rem;
    border: 1px solid rgba(100,116,139,.38);
    border-radius: .5rem;
    background: rgba(15,23,42,.28);
}
.osm-control-group-label {
    padding: 0 .18rem;
    color: rgb(148,163,184);
    font-size: .5rem;
    font-weight: 900;
    letter-spacing: .07em;
    text-transform: uppercase;
}
.osm-theme-master.is-active,
#osm-layer-controls .nasa-monitor-tool.is-active {
    border-color: rgba(74,222,128,.85);
    color: white;
    background: rgba(21,128,61,.9);
}
#osm-layer-controls .nasa-monitor-tool.is-loading {
    cursor: wait;
    opacity: .72;
}
#osm-monitor-map .osm-import-popup .leaflet-popup-content-wrapper {
    border-color: rgba(74,222,128,.75) !important;
    background: rgba(6,78,59,.97) !important;
    color: white !important;
}
#osm-monitor-map .osm-import-popup .leaflet-popup-tip {
    background: rgba(6,78,59,.97) !important;
}
#osm-monitor-map .osm-import-popup-content {
    color: rgb(240,253,244) !important;
    line-height: 1.4;
}
#osm-monitor-map .osm-import-popup-content strong {
    color: rgb(253,186,116) !important;
    font-size: .78rem;
}
#osm-monitor-map .osm-import-popup-content p {
    color: rgb(220,252,231) !important;
}
#osm-monitor-map .osm-theme-popup .leaflet-popup-content-wrapper {
    border-color: rgba(56,189,248,.72) !important;
    background: rgba(15,23,42,.97) !important;
    color: white !important;
}
#osm-monitor-map .osm-theme-popup .leaflet-popup-tip {
    background: rgba(15,23,42,.97) !important;
}
.osm-theme-popup-content { color: rgb(226,232,240); font-size: .68rem; line-height: 1.42; }
.osm-theme-popup-content strong { color: rgb(125,211,252); font-size: .75rem; }
.osm-theme-popup-content .osm-theme-kind { color: rgb(253,186,116); font-weight: 800; }
.osm-theme-popup-content .osm-theme-source { color: rgb(148,163,184); font-size: .56rem; }
.light-mode .osm-control-group { background: rgba(226,232,240,.58); }
.light-mode #osm-monitor-map .osm-import-popup .leaflet-popup-content-wrapper,
.light-mode #osm-monitor-map .osm-import-popup .leaflet-popup-tip {
    background: rgba(20,83,45,.97) !important;
}
@media (max-width: 760px) {
    .osm-control-group-label { width: 100%; }
    #osm-layer-controls { max-height: 9.5rem; overflow-y: auto; }
}


/* Wikiloc controlado por el usuario y testigo pasivo de carga OSM. */
.wikiloc-panel {
    background:
      radial-gradient(circle at 50% 18%, rgba(34,197,94,.2), transparent 38%),
      linear-gradient(145deg, rgb(15,23,42), rgb(2,6,23));
}
.wikiloc-card { border-color: rgba(74,222,128,.46); }
.wikiloc-icon { color: rgb(134,239,172); background: rgba(21,128,61,.28); border-color: rgba(74,222,128,.44); }
.wikiloc-open { background: rgb(21,128,61); border-color: rgb(74,222,128); }
.wikiloc-open:hover { background: rgb(22,101,52); }
.light-mode .wikiloc-panel { background: linear-gradient(145deg, rgb(240,253,244), rgb(220,252,231)); }
.osm-load-indicator {
    width: 1.85rem; min-width: 1.85rem; height: 1.85rem; min-height: 1.85rem;
    padding: 0; border-radius: .45rem; pointer-events: none; cursor: default;
}
.osm-load-indicator.is-idle { background: rgba(30,41,59,.9); border-color: rgba(100,116,139,.65); color: rgb(148,163,184); }
.osm-load-indicator.is-loading { background: rgba(202,138,4,.94); border-color: rgba(253,224,71,.95); color: rgb(255,251,235); box-shadow: 0 0 0 2px rgba(250,204,21,.16); }
.osm-load-indicator.is-loaded { background: rgba(21,128,61,.94); border-color: rgba(74,222,128,.95); color: white; box-shadow: 0 0 0 2px rgba(34,197,94,.14); }
.osm-load-indicator.is-error { background: rgba(185,28,28,.94); border-color: rgba(248,113,113,.95); color: white; }
.osm-load-indicator.is-loading svg { animation: pillan-osm-spin .9s linear infinite; }
@keyframes pillan-osm-spin { to { transform: rotate(360deg); } }


/* Testigo gráfico de carga OSM. */
.osm-load-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
}
.osm-load-indicator .osm-load-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1.05rem;
  line-height: 1;
  font-weight: 950;
  color: #111827;
}
.osm-load-indicator.is-loading {
  background: #eded07 !important;
  border-color: #ffff70 !important;
  color: #111827 !important;
  box-shadow: 0 0 0 2px rgba(237, 237, 7, .22);
}
.osm-load-indicator.is-loaded {
  background: #0fd40f !important;
  border-color: #72ff72 !important;
  color: #052e05 !important;
  box-shadow: 0 0 0 2px rgba(15, 212, 15, .20);
}
.osm-load-indicator.is-error .osm-load-glyph { color: #ffffff; }
.osm-load-indicator.is-loading .osm-load-glyph { animation: pillan-osm-spin .9s linear infinite; }


/* Testigo OSM exclusivamente gráfico. */
#btn-osm-emergency-bundle {
  font-size: 0 !important;
  white-space: nowrap;
  text-indent: 0;
}
#btn-osm-emergency-bundle .osm-load-glyph {
  font-size: 1.12rem !important;
  font-family: Arial, Helvetica, sans-serif;
}
#btn-osm-emergency-bundle.is-loading {
  background: #eded07 !important;
}
#btn-osm-emergency-bundle.is-loaded {
  background: #0fd40f !important;
}
