/* Mapa interactivo: nubosidad prevista, relieve y visibilidad del eclipse
   por municipio. Petrona/Open Sans ya se cargan desde style.css, no hace
   falta repetirlo. */

/* Contenedor del mapa: a pantalla completa */
#map {
  width: 100%;
  height: 100vh;
}

/* ── Panel (buscador, variable a colorear, leyenda, capas): en escritorio
   flota por encima del mapa (posición original); en móvil pasa a ser un
   bloque normal encima de él, no superpuesto (ver media query). ── */
.map-panel {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 9998;
  width: 300px;
  max-height: calc(100% - 2rem);
  overflow: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  padding: 14px 16px;
  box-sizing: border-box;
}
.map-panel__title {
  font-family: "Petrona", Georgia, serif;
  font-size: 16px;
  font-weight: 700;
  color: #111;
  margin: 0 0 2px;
}
.map-panel__sub {
  font-family: "Open Sans", sans-serif;
  font-size: 12px;
  color: #666;
  margin-bottom: 10px;
}
.map-panel__label {
  font-family: "Open Sans", sans-serif;
  font-size: 12.5px;
  color: #444;
  font-weight: 500;
  display: block;
  margin: 8px 0 3px;
}
.map-panel__input,
.map-panel__select {
  width: 100%;
  padding: 6px 8px;
  font-size: 13px;
  font-family: "Open Sans", sans-serif;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
}
.map-panel__resultados {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
}
.map-panel__resultados li {
  padding: 5px 8px;
  font-size: 13px;
  font-family: "Open Sans", sans-serif;
  color: #333;
  cursor: pointer;
  border-radius: 5px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.map-panel__resultados li:hover {
  background: #f0f0f0;
}
.map-panel__leyenda {
  margin-top: 10px;
  font-size: 11px;
  color: #333;
}
.map-panel__barra-wrap {
  position: relative;
}
.map-panel__barra {
  height: 10px;
  border-radius: 5px;
  margin: 10px 0 2px;
}
.map-panel__marcador {
  position: absolute;
  top: -4px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid #1c1d1f;
  transform: translateX(-50%);
  display: none;
  pointer-events: none;
}
.map-panel__extremos {
  display: flex;
  justify-content: space-between;
  font-family: "Open Sans", sans-serif;
}
.map-panel__toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 10px 0 0;
  font-size: 12.5px;
  font-family: "Open Sans", sans-serif;
  color: #444;
}
.map-panel__toggle label {
  margin: 0;
}
.map-panel__toggle input {
  accent-color: #d9a441;
  width: 15px;
  height: 15px;
}

/* ── Tooltip fijo (popup del municipio) ── */
.mapboxgl-popup-content {
  font-family: "Petrona", Georgia, serif;
  font-size: 11px;
  line-height: 1.3;
}

.popup-municipio {
  font-family: "Petrona", Georgia, serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
  color: #111;
  margin: 0 0 6px;
}

.aviso-total {
  font-weight: 600;
  font-size: 11.5px;
  margin-bottom: 8px;
}

.popup-table--eclipse {
  width: 100%;
  border-collapse: collapse;
}
.popup-table--eclipse td {
  padding: 1px 4px 1px 0;
  vertical-align: top;
  font-family: "Open Sans", sans-serif;
  font-size: 11.5px;
  color: #333;
}
.popup-table--eclipse td:first-child {
  color: #666;
  white-space: nowrap;
}

.aviso-ocaso {
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid #eee;
  color: #a15c00;
  font-size: 11.5px;
  line-height: 1.35;
  font-family: "Open Sans", sans-serif;
}

.mapa {
  width: 100%;
  position: relative;
}

/* El mapa y todos sus overlays (aviso móvil, zoom, tooltip, aviso de
   gesto...) viven aquí dentro, no en .mapa directamente: así ocupan solo
   el área del mapa y no la del panel (.map-panel), que es hermano de este
   contenedor. */
.mapa__viewport {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}
.map-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.75);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 60px;
  pointer-events: none;
}
.map-loading-overlay > span {
  font-family: "Open Sans", sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.map-loading-letter {
  display: inline-block;
  animation: map-letter-wave 1.6s infinite ease-in-out both;
}
@keyframes map-letter-wave {
  0%, 100% { opacity: 0.1; }
  50% { opacity: 1; }
}
.tooltip-close {
  display: none;
}

.map-mobile-overlay {
  display: none;
}

@media (max-width: 900px) {
  .map-mobile-overlay {
    display: flex;
    position: absolute;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  .map-mobile-overlay.hidden {
    display: none;
  }
  .map-mobile-overlay > span {
    font-family: "Open Sans", sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
  }
  .map-mobile-exit {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.45);
    border: none;
    color: white;
    font-size: 3rem;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .map-mobile-exit.visible {
    display: flex;
  }
}

@media (max-width: 900px) {
  .tooltip-close {
    display: block;
    position: absolute;
    top: -3px;
    right: 10px;
    background: none;
    border: none;
    font-size: 2.9rem;
    line-height: 1;
    color: #bebebe;
    cursor: pointer;
    padding: 0;
    pointer-events: auto;
  }
}

.fixed-tooltip {
  position: absolute;
  right: 20px;
  bottom: 20px;

  width: 260px;
  z-index: 10000;

  background: white;
  padding: 12px 14px 10px;
  box-sizing: border-box;

  font-family: "Petrona", Georgia, serif;
  font-size: 11px;
  line-height: 1.3;

  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);

  pointer-events: none;
}
.mapboxgl-control-container {
  display: none;
}
.mapboxgl-marker svg path {
  fill: #111 !important;
}
.map-gesture-hint {
  position: absolute;
  inset: 0;
  z-index: 9997;
  pointer-events: none;
  transition: opacity 0.3s;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}
.map-gesture-hint span {
  font-family: "Open Sans", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.map-gesture-hint.hidden {
  opacity: 0;
}

@media (max-width: 900px) {
  .map-gesture-hint {
    display: none;
  }
  .fixed-tooltip {
    pointer-events: auto;
    right: 10px;
    left: 10px;
    bottom: 0.2rem;
    width: auto;
  }
  .map-panel {
    position: static;
    top: auto;
    left: auto;
    z-index: auto;
    max-height: none;
    overflow: visible;
    width: auto;
    margin: 1rem;
    border-radius: 10px;
  }
  .map-zoom-btns {
    top: auto;
    left: auto;
    bottom: 4.5rem;
    right: 0.8rem;
  }
  .map-zoom-btn {
    height: 2rem;
    width: 2rem;
  }
  .map-zoom-btn svg {
    height: 1rem;
  }
}

.map-zoom-btns {
  display: flex;
  flex-direction: column;
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  z-index: 9998;
  pointer-events: none;
}
.map-zoom-btn {
  pointer-events: auto;
}
.map-zoom-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #e5e5e5;
  background: white;
  height: 1.4rem;
  width: 1.4rem;
  color: gray;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.map-zoom-btn:first-child { border-radius: 5px 5px 0 0; }
.map-zoom-btn:nth-child(2) { border-top: none; border-radius: 0 0 5px 5px; background: #f8f8f8; }
.map-zoom-btn svg { height: 0.8rem; stroke: gray; fill: none; }
.map-center-btn {
  margin-top: 6px;
  border-radius: 5px !important;
  border-top: 2px solid #e5e5e5 !important;
  background: white !important;
}
