/* -------------------------------------------------------------------------- */
/* Bloque 1: estilos base de la página                                         */
/* Define tipografía, colores generales y el tamaño completo del lienzo.       */
/* -------------------------------------------------------------------------- */
html,
body {
  height: 100%;
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f4f6f8;
  color: #1f2933;
}

/* -------------------------------------------------------------------------- */
/* Bloque 2: layout principal                                                   */
/* Organiza la interfaz en panel lateral y zona de mapa.                       */
/* -------------------------------------------------------------------------- */
#app {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: 100vh;
  width: 100%;
}

#sidebar {
  background: #ffffff;
  border-right: 1px solid #d9e2ec;
  overflow-y: auto;
  padding: 18px 16px 28px;
  box-sizing: border-box;
}

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

#map {
  width: 100%;
  height: 100%;
}

/* -------------------------------------------------------------------------- */
/* Bloque 3: caja de coordenadas del cursor                                     */
/* Fija las coordenadas en la parte inferior izquierda del mapa.               */
/* -------------------------------------------------------------------------- */
#coordinatesBox {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #bcccdc;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.88rem;
  color: #243b53;
  box-shadow: 0 2px 8px rgba(16, 42, 67, 0.15);
  pointer-events: none;
}

/* -------------------------------------------------------------------------- */
/* Bloque 4: panel lateral                                                      */
/* Da formato a títulos, subtítulos, controles y contenedores informativos.    */
/* -------------------------------------------------------------------------- */
.sidebar-section {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e6edf3;
}

.sidebar-section:last-child {
  border-bottom: none;
}

h2 {
  margin: 0 0 6px 0;
  font-size: 1.45rem;
  color: #102a43;
}

h3 {
  margin: 0 0 12px 0;
  font-size: 1rem;
  color: #243b53;
}

.subtitle {
  margin: 0;
  font-size: 0.92rem;
  color: #52606d;
  line-height: 1.4;
}

.controls-block label {
  display: block;
  margin: 12px 0 6px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #334e68;
}

.controls-block select,
.controls-block input[type="range"] {
  width: 100%;
  box-sizing: border-box;
}

.controls-block select {
  padding: 10px 12px;
  border: 1px solid #bcccdc;
  border-radius: 8px;
  background: #fff;
  font-size: 0.95rem;
}

.slider-value {
  margin-top: 6px;
  font-size: 0.88rem;
  color: #486581;
  text-align: right;
  font-weight: 600;
}

.legend-title {
  font-size: 0.9rem;
  color: #486581;
  margin-bottom: 10px;
  font-weight: 600;
}

#legend,
#giLegend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-item,
.gi-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  color: #334e68;
  line-height: 1.35;
}

.legend-color,
.gi-color {
  width: 18px;
  height: 18px;
  border: 1px solid #7b8794;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 1px;
}

.feature-info,
.variable-description {
  background: #f8fafc;
  border: 1px solid #d9e2ec;
  border-radius: 10px;
  padding: 12px;
  box-sizing: border-box;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #334e68;
}

.feature-info {
  min-height: 140px;
}

.feature-info h4,
.variable-description h4 {
  margin: 0 0 8px 0;
  font-size: 0.98rem;
  color: #102a43;
}

.feature-info ul,
.variable-description ul {
  margin: 0;
  padding-left: 18px;
}

.feature-info li,
.variable-description li {
  margin-bottom: 6px;
}

.variable-description p {
  margin: 0 0 10px 0;
}

/* -------------------------------------------------------------------------- */
/* Bloque 5: controles Leaflet y popup                                          */
/* Ajusta la estética del selector de capas, popups y escala centrada.         */
/* -------------------------------------------------------------------------- */
.leaflet-control-layers {
  font-size: 0.92rem;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(16, 42, 67, 0.15);
}

.leaflet-popup-content {
  line-height: 1.45;
  font-size: 0.92rem;
}

.leaflet-center {
  left: 50%;
  transform: translateX(-50%);
  position: absolute;
  pointer-events: none;
  bottom: 0;
}

.leaflet-control-scale {
  margin-bottom: 12px !important;
}

.leaflet-center .leaflet-control {
  pointer-events: auto;
}

.leaflet-center .leaflet-control-scale {
  margin-left: 0;
}

/* -------------------------------------------------------------------------- */
/* Bloque 6: MiniMap                                                            */
/* Mejora la presentación del mapa de contexto agregado con el plugin.         */
/* -------------------------------------------------------------------------- */
.leaflet-control-minimap {
  border: 1px solid #bcccdc !important;
  box-shadow: 0 2px 10px rgba(16, 42, 67, 0.18);
  border-radius: 10px;
  overflow: hidden;
}

.leaflet-control-minimap a {
  background-color: rgba(255, 255, 255, 0.95) !important;
}

/* -------------------------------------------------------------------------- */
/* Bloque 7: diseño responsivo                                                  */
/* Adapta el layout cuando la pantalla es estrecha.                            */
/* -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  #sidebar {
    max-height: 45vh;
    border-right: none;
    border-bottom: 1px solid #d9e2ec;
  }

  #coordinatesBox {
    left: 10px;
    bottom: 10px;
    font-size: 0.82rem;
  }

  .leaflet-control-minimap {
    transform: scale(0.9);
    transform-origin: bottom right;
  }
}