html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Arial, sans-serif;
}

/* MAPA FULL */
#map {
  height: 100vh;
  width: 100%;
}

/* ===============================
   PANEL MODERNO
===============================*/
#table-container {
  position: fixed;
  top: 0;
  right: -50%;
  width: 45%;
  max-width: 850px;
  min-width: 350px;
  height: 100%;
  background: #ffffff;
  box-shadow: -10px 0 30px rgba(0,0,0,0.15);
  overflow: hidden;
  transition: right 0.35s cubic-bezier(.4,0,.2,1);
  z-index: 2000;
  display: flex;
  flex-direction: column;
}

#table-container.active {
  right: 0;
}

.panel-header {
  padding: 0;
  background: #f8f9fa;
  border-bottom: 1px solid #eee;
}

.tabs {
  display: flex;
}

.tab {
  flex: 1;
  padding: 12px;
  border: none;
  background: #e0e0e0;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s;
  text-align: center;
}

.tab.active {
  background: #501020;
  color: white;
}

.panel-body {
  padding: 15px;
  overflow-y: auto;
  flex: 1;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* BOTÓN FLOTANTE (FAB) */
#toggle-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  border: none;
  background: #1976D2;
  color: white;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  z-index: 2100;
  transition: all 0.3s ease;
}

#toggle-btn:hover {
  transform: scale(1.05);
}

#toggle-btn.open {
  background: #E53935;
}

/* TABLAS */
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}

th, td {
  padding: 6px;
  text-align: left;
}

th {
  background: #000000;
  color: white;
  position: sticky;
  top: 0;
}

tr.selected {
  background-color: #d6eaf8 !important;
}

.alerta-baja { background-color: #d5f5e3; }
.alerta-media-baja { background-color: #fcf3cf; }
.alerta-media-alta { background-color: #fae2be; }
.alerta-alta { background-color: #fadbd8; }

/* ===============================
   BANNER MEJORADO
===============================*/
.info-banner{
  padding:10px;
  border-radius:10px;
  box-shadow:0 4px 15px rgba(0,0,0,.3);
  max-width:320px;
  overflow:hidden;
}

.banner-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-size: 14px;
}

.banner-content{
  overflow:hidden;
  max-height:500px;
  transition:max-height .3s ease;
}

.banner-content.collapsed{
  max-height:0;
}

.collapse-btn{
  border:none;
  background:#000;
  color:#fff;
  border-radius:5px;
  cursor:pointer;
}


/* Titulo del Mapa */
#map-title {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  font-size: 1.5rem;
  font-weight: bold;
  color: rgb(66, 5, 5);
  text-align: center;
  /*text-shadow: 1px 1px 1px rgba(0,0,0,0.6);*/
  background-color: rgba(255,255,255,0.8);
  padding: 8px 15px;
  width: fit-contents;
}

#map-update {
  position: absolute;
  top: 88px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  font-size: 1rem;
  font-weight: bold;
  color: rgb(99, 77, 7);
  /*text-shadow: 1px 1px 1px rgba(0,0,0,0.6);
  background-color: rgba(255,255,255,0.8);
  padding: 8px 15px;
  width: fit-contents;*/
}

.map-label {
  font-size: 0.6rem;
  font-weight: bold;
  color: #000;
  background: transparent;
  text-shadow: 0 0 2px #fff;
  pointer-events: none;
}

  .legend {
    background: white;
    padding: 6px 6px;
    border-radius: 6px;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    color: #333;
}

.legend-horizontal {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.legend-title {
    font-size: 10px;
    font-weight: bold;
    margin-bottom: 2px;
}

.legend-colors {
    display: flex;
    align-items: flex-end;
    margin: 0;
}

.legend-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding: 0;
    width: 11px;
}

.legend-item i {
    width: 8px;
    height: 10px;
    display: block;
    opacity: 0.8;
    margin: 0;
    padding: 0;
    width: 13px;
}

.legend-item span {
    font-size: 6px;
    margin-top: 1px;
}

.logout-control {
        background: rgb(234, 185, 22);
        padding: 8px 12px;
        border-radius: 4px;
        box-shadow: 0 1px 5px rgba(0,0,0,0.4);
        cursor: pointer;
        font-family: Arial, sans-serif;
        font-size: 14px;
    }

.logout-control:hover {
        background: #cb421c;
    }

/* =========================================
   Ajustes para dispositivos móviles
   ========================================= */

@media (max-width: 600px) {

  #table-container {
    width: 100%;
    right: -100%;
    max-width: none;
    min-width: 0;
  }
  
  #map {
    height: 93vh;
    width: 100%;
  }

  #map-title {
    top: 8px;
    font-size: 12px;
	font-weight: bold;
    white-space: nowrap;
	background-color: rgba(255,255,255,0.8);
	padding: 8px 15px;
	width: fit-contents;
  }

  #map-update {
    top: 52px;
    font-size: 10px;
    white-space: nowrap;
	/*padding: 8px 15px;
	width: fit-contents;
	background-color: rgba(255,255,255,0.8);*/
  }


  .map-label {
    font-size: 10px;
  }

  .layers-title {
    padding: 4px 8px;
    font-size: 0.9rem;
	line-height: 1;
  }
  
  .leaflet-control-layers label {
    margin-bottom: 2px;
  }
  
  .leaflet-control-layers-overlays {
    font-size: 8px;
	line-height: 1;
  }
  
  .leaflet-control-layers-selector {
    height: 9px;
  }
  .leaflet-control {
    max-width: 400px;
  }
  
  #toggle-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    border: none;
    background: #1976D2;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    z-index: 2100;
    transition: all 0.3s ease;
  }

}

.info { padding: 6px 8px; font: 14px/16px Arial, Helvetica, sans-serif; background: white; background: rgba(255,255,255,0.8); box-shadow: 0 0 15px rgba(0,0,0,0.2); border-radius: 5px; } .info h4 { margin: 0 0 5px; color: #777; }

/* Cuadro de control layers */
  .layers-title {
  padding: 5px 10px;
  font-size: 12px;
  background: #f8f9fa;
  border-bottom: 1px solid #ccc;
  text-align: center;
  border-radius: 5px 5px 0 0;
}

/* =========================================
   MODAL GRÁFICO
========================================= */

.chart-modal {
  display: none;
  position: fixed;
  z-index: 5000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.55);

  align-items: center;
  justify-content: center;
}

.chart-modal.active {
  display: flex;
}

.chart-modal-content {
  background: white;
  width: 70%;
  max-width: 900px;
  height: 45%;
  min-height: 350px;

  border-radius: 10px;

  box-shadow: 0 10px 40px rgba(0,0,0,0.35);

  display: flex;
  flex-direction: column;
}


.chart-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 12px 18px;

  border-bottom: 1px solid #ddd;
  background: #f8f9fa;

  border-radius: 10px 10px 0 0;
}

.chart-modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: #501020;
}

#chart-subtitle {
  font-size: 12px;
  color: #666;
}

.chart-close {
  border: none;
  background: transparent;

  font-size: 30px;
  line-height: 1;

  cursor: pointer;

  color: #555;
}

.chart-close:hover {
  color: #E53935;
}

#chart-container {
  flex: 1;
  width: 100%;
  min-height: 250px;
}



/* =========================================
   BOTÓN GRÁFICO
========================================= */

.chart-button {
  border: none;
  background: #9d8027;
  color: white;
  padding: 5px 9px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.chart-button:hover {
  background: #5d4601;
}


/* =========================================
   MÓVIL
========================================= */

@media (max-width: 600px) {

  .chart-modal-content {
    width: 94%;
    height: 50%;
    min-height: 300px;
  }

  .chart-modal-header h3 {
    font-size: 14px;
  }

  #chart-container {
    min-height: 220px;
	font-size: 0.5rem;
  }

}