/* Estilos para el diálogo de gráficos */
.chart-dialog {
  position: absolute;
  bottom: 20px;
  right: 20px;
  background: rgba(255,255,255,0.95);
  padding: 15px;
  border: 1px solid #ccc;
  border-radius: 8px;
  width: 350px;
  min-width: 350px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  z-index: 1003;
  display: none;
  height: 450px;
  overflow: hidden;
  resize: both;
}

.chart-dialog.visible {
  display: block;
}

.chart-dialog.collapsed {
  max-height: 50px;
  padding: 10px 15px;
  resize: none;
}

.chart-dialog.collapsed .chart-dialog-content {
  opacity: 0;
  visibility: hidden;
  height: 0;
}

.chart-dialog.moving {
  cursor: grabbing;
  user-select: none;
}

.chart-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  font-size: 1.1em;
  margin-bottom: 10px;
  color: #2c3e50;
  cursor: grab;
  padding: 5px;
  border-radius: 4px;
}

.chart-dialog-header:active {
  cursor: grabbing;
}

.dialog-toggle-button {
  width: 25px;
  height: 25px;
  flex-shrink: 0;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  min-height: 36px;
}

.combobox {
  flex: 1;
  min-width: 120px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.custom-select {
  position: relative;
  width: 120px;
  cursor: pointer;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #f8f9fa;
  user-select: none;
}

.custom-select-header {
  padding: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.custom-select-options {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  z-index: 1004;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.custom-select-option {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.custom-select-option:hover {
  background-color: #f0f0f0;
}

.custom-select.open .custom-select-options {
  display: block;
}

.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
  margin-top: 10px;
  min-height: 150px;
}

.chart-canvas {
  width: 100% !important;
  height: 100% !important;
}

.info-box {
  margin-top: 10px;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 4px;
}

.chart-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  text-align: center;
  color: #7f8c8d;
}

.chart-placeholder i {
  margin-bottom: 10px;
}

.chart-placeholder p {
  margin: 0;
  font-size: 14px;
}

/* Control de Leaflet para mostrar/ocultar diálogo */
.leaflet-control-chartdialog-toggle {
  width: 30px;
  height: 30px;
  line-height: 30px;
  font-size: 16px;
  text-align: center;
  color: white;
  background-color: #3498db;
  border-radius: 4px;
  display: block;
}

.leaflet-control-chartdialog-toggle:hover {
  background-color: #2980b9;
  color: white;
}

/* -----------------------------------------------------------
   ESTILO DEL BOTÓN DE ESTADÍSTICAS (Diseño Minimalista)
----------------------------------------------------------- */
a.leaflet-control-chartdialog-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: white !important;
    width: 30px !important; 
    height: 30px !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 15px 15px !important; /* Mismo tamaño que medir y zoom */
    border-bottom: none !important;
    transition: background-color 0.2s ease !important;
    
    /* SVG Gráfico de Pastel (Gris oscuro profesional) */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23333333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.21 15.89A10 10 0 1 1 8 2.83'/%3E%3Cpath d='M22 12A10 10 0 0 0 12 2v10z'/%3E%3C/svg%3E") !important;
}

/* Efecto Hover */
a.leaflet-control-chartdialog-toggle:hover {
    background-color: #f4f4f4 !important;
}

/* ESTADO ACTIVO (Cuando el usuario abre las estadísticas) */
a.leaflet-control-chartdialog-toggle.active {
    /* Fondo azul muy claro y sombra interna para indicar que está presionado */
    background-color: #eef6fc !important; 
    box-shadow: inset 0 0 5px rgba(0, 112, 180, 0.2) !important;
    
    /* SVG del Gráfico de Pastel en Azul Institucional (#0070b4) */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%230070b4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.21 15.89A10 10 0 1 1 8 2.83'/%3E%3Cpath d='M22 12A10 10 0 0 0 12 2v10z'/%3E%3C/svg%3E") !important;
}