html, body {
    margin: 0;
    padding: 0;
    height: 100%; /* 🔹 Necesario para que #map herede altura */
    width: 100%;
    position: relative;
}

.iframe-map-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

#map-container {
    height: 100%;
    width: 100%;
    position: relative;
}

.legend {
    position: absolute;
    top: 80px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 24px;
    border-radius: 10px;
    font-family: Arial, sans-serif;
    font-size: 16px;             
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
    max-width: 260px;           
    line-height: 1.6;
}


#legend h4 {
  margin-top: 0;
  font-size: 14px;
  margin-bottom: 5px;
}

.color-box {
    width: 24px;
    height: 14px;
    margin-right: 10px;
    border: 1px solid #aaa;
    border-radius: 3px;
    flex-shrink: 0;
}

#legend h4 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: bold;
}

#legend ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.legend li {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 16px;
}


.legend strong {
    display: block;
    text-align: center;
    font-size: 16px;
    margin-bottom: 10px;
}

.legend-scale ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.legend-scale li {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.legend-scale span {
    width: 20px;
    height: 20px;
    display: inline-block;
    border: 1px solid #000;
}

.filter-container {
    position: absolute;
    top: 80px;
    left: 25px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 8px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-container label {
    font-weight: bold;
}

.filter-container input {
    padding: 5px;
    border-radius: 5px;
    border: 1px solid #ccc;
}

.filter-container button {
    background: #007bff;
    color: white;
    padding: 8px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.filter-container button:hover {
    background: #0056b3;
}

.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 10px;
    border-radius: 5px;
    font-size: 12px;
    pointer-events: none; /* Para que no interfiera con el mouse */
    display: none; /* Oculto por defecto */
}

#color-selector-container {
    position: absolute;
    top: 10px;  /* Ajusta la distancia desde la parte superior */
    left: 50%;
    transform: translateX(-50%);
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f9f9f9;
    display: inline-block;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000; /* Asegura que esté sobre el mapa */
}

#color-palette {
    padding: 5px;
    font-size: 14px;
    border-radius: 4px;
}

#tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 12px 16px; /* 🔹 Más padding para más espacio interno */
    font-size: 14px;
    border-radius: 6px;
    pointer-events: none;
    display: none;
    transition: opacity 0.2s ease-in-out;
    max-width: 320px; /* 🔹 Aumentamos el ancho máximo */
    z-index: 1000;
    box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.4);
}

#tooltip strong {
    color: #ffcc00;
}

.tooltip-value {
    font-weight: bold;
    color: #4cc9f0;
    font-size: 15px; /* 🔹 Un poco más grande para destacar */
}

.tooltip-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    margin: 8px 0;
}

#play-animation-btn {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
}

#play-animation-btn:hover {
    background-color: rgba(0, 0, 0, 0.9);
}

#hora-slider {
    position: absolute;
    bottom: 65px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;

    width: 300px;
    height: 8px;

    background: #444;              /* color de fondo del track */
    border-radius: 4px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;

    cursor: pointer;
}

/* Thumb personalizado */
#hora-slider::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ccc;
    border: 2px solid #888;
    transition: background 0.2s, border-color 0.2s;
}

#hora-slider::-webkit-slider-thumb:hover {
    background: #fff;
    border-color: #aaa;
}

#hora-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ccc;
    border: 2px solid #888;
    transition: background 0.2s, border-color 0.2s;
}

#hora-slider::-moz-range-thumb:hover {
    background: #fff;
    border-color: #aaa;
}

/* Track para Firefox */
#hora-slider::-moz-range-track {
    background: #444;
    height: 8px;
    border-radius: 4px;
}

/* Para mostrar un glow o color cuando se mueve */
#hora-slider:focus {
    box-shadow: 0 0 4px #888;
}

#temp-message {
    position: absolute;
    bottom: 80px; /* Justo arriba del botón de animación */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    opacity: 1; /* 🔹 Hacerlo siempre visible */
    pointer-events: none;
    z-index: 3000; /* 🔹 Asegura que esté sobre el mapa */
    display: block; /* 🔹 Asegura que no esté oculto */
}

#airport-selector-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: white;
    border-radius: 8px;
    padding: 10px 15px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    font-family: 'Arial', sans-serif;
    z-index: 10;
  }
  
  #airport-selector-container label {
    margin-right: 10px;
    font-weight: bold;
    color: #333;
  }
  
  #airport-selector {
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-size: 14px;
    background-color: #f9f9f9;
    color: #333;
  }

  .btn-back {
    position: absolute;
    top: 0.7rem;
    left: 12.5rem; /* o 1rem según necesidad */
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    z-index: 9999; /* Asegura que esté por encima del mapa */
  }
  .btn-back:hover {
    background-color: rgba(0, 0, 0, 0.7);
  }

  .btn-back svg {
    display: block;
  }

#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65); /* Fondo opaco */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

#loading-message {
  background: #222;
  color: #fff;
  padding: 30px 50px;
  font-size: 18px;
  font-family: Arial, sans-serif;
  border-radius: 8px;
  box-shadow: 0 0 12px #000;
  text-align: center;
}

#stations-status {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 1000;
  max-width: min(720px, calc(100% - 32px));
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 1.3;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

#stations-filter-toggle {
  position: absolute;
  top: 96px;
  left: 20px;
  z-index: 1000;
  background: rgba(17, 24, 39, 0.86);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  font-family: Arial, sans-serif;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

#stations-filter-toggle:hover {
  background: rgba(17, 24, 39, 0.96);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  transform: translateY(-1px);
}

.stations-filter-panel {
  position: absolute;
  top: 146px;
  left: 20px;
  z-index: 1000;
  width: min(280px, calc(100% - 40px));
  background: rgba(255, 255, 255, 0.96);
  border-radius: 8px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.32);
  padding: 16px;
  font-family: Arial, sans-serif;
  color: #1f2937;
}

.stations-filter-panel.hidden {
  display: none;
}

.stations-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 16px;
}

#stations-filter-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: #e5e7eb;
  color: #111827;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

#stations-filter-close:hover {
  background: #111827;
  color: #fff;
  transform: translateY(-1px);
}

.stations-search-form {
  margin-bottom: 14px;
}

.stations-search-form label {
  display: block;
  margin-bottom: 6px;
  color: #374151;
  font-size: 13px;
  font-weight: bold;
}

.stations-search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

#stations-search-input {
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  padding: 8px;
  color: #111827;
  font-size: 14px;
  text-transform: uppercase;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

#stations-search-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
  outline: none;
}

.stations-search-row button {
  border: 0;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.stations-search-row button:hover {
  background: #1d4ed8;
  box-shadow: 0 5px 12px rgba(37, 99, 235, 0.24);
  transform: translateY(-1px);
}

.stations-search-message {
  min-height: 18px;
  margin-top: 5px;
  color: #b91c1c;
  font-size: 12px;
  line-height: 1.3;
}

.stations-search-options {
  display: grid;
  gap: 2px;
  max-height: 168px;
  overflow-y: auto;
  margin-top: 6px;
  border: 1px solid #dbe3ee;
  border-radius: 6px;
  background: #fff;
  padding: 4px;
}

.stations-search-options.hidden {
  display: none;
}

.stations-search-options button {
  width: 100%;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #111827;
  cursor: pointer;
  padding: 7px 8px;
  font-size: 14px;
  text-align: left;
  transition: background 0.14s ease, color 0.14s ease, padding-left 0.14s ease;
}

.stations-search-options button:hover {
  background: #eff6ff;
  color: #1d4ed8;
  padding-left: 12px;
}

.stations-filter-dropdown {
  margin-bottom: 14px;
  position: relative;
}

.stations-filter-dropdown:last-child {
  margin-bottom: 0;
}

.stations-filter-dropdown summary {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  padding: 8px;
  cursor: pointer;
  list-style: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.stations-filter-dropdown summary:hover {
  border-color: #93c5fd;
  background: #f8fbff;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.10);
}

.stations-filter-dropdown summary::-webkit-details-marker {
  display: none;
}

.stations-filter-dropdown summary span {
  font-size: 13px;
  font-weight: bold;
  color: #374151;
}

.stations-filter-dropdown summary strong {
  max-width: 130px;
  overflow: hidden;
  color: #111827;
  font-size: 14px;
  font-weight: 500;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stations-filter-options {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 6px;
  border: 1px solid #dbe3ee;
  border-radius: 6px;
  background: #fff;
  padding: 8px;
}

.stations-filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  font-size: 14px;
  color: #111827;
  border-radius: 5px;
  padding: 3px 4px;
  transition: background 0.14s ease, color 0.14s ease;
}

.stations-filter-option:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

.stations-filter-option input {
  flex: 0 0 auto;
}

.stations-filter-empty {
  color: #6b7280;
  font-size: 13px;
}

.stations-legend {
  max-height: calc(100% - 130px);
  overflow-y: auto;
}

.stations-info-window {
  min-width: 205px;
  max-width: 245px;
  font-family: Arial, sans-serif;
  font-size: 12px;
  line-height: 1.35;
  padding: 2px 2px 0;
}

.gm-style .gm-style-iw-c {
  border-radius: 8px;
  padding: 8px 10px 8px !important;
}

.gm-style .gm-style-iw-d {
  overflow: hidden !important;
}

.gm-style .gm-ui-hover-effect {
  width: 24px !important;
  height: 24px !important;
  right: 6px !important;
  top: 6px !important;
  border-radius: 5px !important;
}

.gm-style .gm-ui-hover-effect span {
  width: 14px !important;
  height: 14px !important;
  margin: 5px !important;
}

.stations-info-header {
  display: block;
  padding: 0 28px 7px 0;
  border-bottom: 1px solid #e5e7eb;
}

.stations-info-title {
  color: #111827;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.stations-info-subtitle {
  margin-top: 1px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
}

.stations-info-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-top: 6px;
}

.stations-info-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.stations-info-badge.positive {
  background: #dcfce7;
  color: #166534;
}

.stations-info-badge.negative {
  background: #fee2e2;
  color: #991b1b;
}

.stations-info-badge.neutral {
  background: #e5e7eb;
  color: #374151;
}

.stations-info-grid {
  display: grid;
  gap: 5px;
  margin: 7px 0 0;
}

.stations-info-grid div {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 8px;
  align-items: baseline;
}

.stations-info-grid dt {
  margin: 0;
  color: #6b7280;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.stations-info-grid dd {
  margin: 0;
  color: #111827;
  font-size: 12px;
  font-weight: 600;
  text-align: right;
}

.stations-region-value,
.stations-region-chip {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.stations-region-swatch {
  width: 9px;
  height: 9px;
  border: 1px solid rgba(17, 24, 39, 0.25);
  border-radius: 999px;
  flex: 0 0 auto;
}

.stations-group-info-window {
  min-width: 215px;
  max-width: 280px;
  font-family: Arial, sans-serif;
  font-size: 12px;
  line-height: 1.45;
  padding: 2px 2px 0;
}

.stations-group-info-window ul {
  max-height: 190px;
  overflow-y: auto;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.stations-group-info-window li {
  border-top: 1px solid #e5e7eb;
  padding: 7px 0;
}

.stations-group-row-title {
  color: #111827;
  font-weight: 700;
}

.stations-group-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  margin-top: 4px;
}

.stations-group-row-meta > span:first-child,
.stations-group-more {
  color: #4b5563;
  font-size: 12px;
}
