


/* Icono flotante - Estilos base para escritorio */
.stats-icon {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background-color: #007bff;
    color: white;
    border-radius: 50%;
    width: 60px; /* Tamaño base */
    height: 60px; /* Tamaño base */
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.stats-icon svg {
    width: 30px; /* Tamaño base del SVG */
    height: 30px; /* Tamaño base del SVG */
    fill: white;
}

/* Ventana Modal - Estilos base para escritorio */
.modal {
    display: none; /* Oculto por defecto */
    position: fixed;
    z-index: 1001;
    background-color: rgba(0, 0, 0, 0.0); /* Fondo transparente para no oscurecer la página */
}

.modal-content {
       background-color: #fefefe;
    padding: 20px;
    border: 1px solid #ccc;
    width: 585px;
    min-height: 430px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    position: absolute;
    display: flex
;
    flex-direction: column;
    align-items: center;
    left: 55px;
    top: 376px;
}


.close-button {
    color: #aaa;
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

h2 {
    font-size: 1.3em; /* Tamaño de fuente base */
    margin-top: 5px;
    margin-bottom: 10px;
}

.summary-stats {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-bottom: 10px;
    font-size: 0.9em; /* Tamaño de fuente base */
    text-align: center;
    flex-wrap: wrap; /* Permite que los elementos se envuelvan si no hay espacio */
}

.summary-stats p {
    margin: 0;
    flex: 1;
    min-width: 100px; /* Asegura que no se aplasten demasiado */
    padding: 5px;
}

.summary-stats span {
    display: block;
    font-weight: bold;
    margin-top: 3px;
}

.chart-options {
    display: flex;
    justify-content: center;
    gap: 8px; /* Espacio entre botones */
    margin-bottom: 15px;
    flex-wrap: wrap; /* Permite que los botones se envuelvan */
}

.chart-options button {
    background-color: #e9e9e9;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85em; /* Tamaño de fuente base */
    transition: background-color 0.2s;
    white-space: nowrap; /* Evita que el texto de los botones se rompa */
}

.chart-options button:hover,
.chart-options button.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.chart-container {
    width: 100%;
    height: 250px; /* Altura base del gráfico */
    margin-top: 10px;
}

/* --- Media Queries para tablets y teléfonos (orden de mayor a menor para sobrescribir) --- */

/* Pantallas Medianas: Tablets en modo vertical, Laptops pequeños (hasta 992px) */
@media (max-width: 992px) {
    .stats-icon {
        width: 55px;
        height: 55px;
        bottom: 18px;
        left: 18px;
    }
    .stats-icon svg {
        width: 28px;
        height: 28px;
    }
    .modal-content {
        width: 380px; /* Ancho ajustado para tablets */
        min-height: 320px;
        padding: 18px;
    }
    h2 {
        font-size: 1.2em;
    }
    .summary-stats {
        font-size: 0.85em;
    }
    .chart-options {
        gap: 6px;
    }
    .chart-options button {
        padding: 7px 10px;
        font-size: 0.8em;
    }
    .chart-container {
        height: 200px;
    }
}

/* Pantallas Pequeñas: Teléfonos grandes y tablets pequeñas (hasta 768px) */
@media (max-width: 768px) {
    .stats-icon {
        width: 50px;
        height: 50px;
        bottom: 15px;
        left: 15px;
    }
    .stats-icon svg {
        width: 25px;
        height: 25px;
    }
    .modal-content {
        width: 90%; /* Ocupa la mayor parte del ancho */
        max-width: 350px; /* Límite para que no sea demasiado grande */
        min-height: 280px;
        padding: 15px;
        /* Para móviles, forzamos centrado con transform, JS ajustará la posición */
        position: fixed;
    top: 58%;
        left: 47%;
        transform: translate(-50%, -50%);
        margin: 0; /* Anular cualquier margen previo */
    }
    h2 {
        font-size: 1.15em;
    }
    .summary-stats {
        font-size: 0.8em;
        flex-wrap: wrap; /* Asegura que los ítems se envuelvan */
        justify-content: space-evenly;
    }
    .summary-stats p {
        min-width: unset; /* Reiniciar min-width */
        flex-basis: 45%; /* Dos columnas por fila */
        margin-bottom: 5px;
    }
    .chart-options {
        gap: 5px;
    }
    .chart-options button {
        padding: 6px 9px;
        font-size: 0.75em;
    }
    .chart-container {
        height: 180px;
    }
}

/* Pantallas Muy Pequeñas: Teléfonos pequeños (hasta 480px) */
@media (max-width: 480px) {
    .stats-icon {
        width: 45px;
        height: 45px;
        bottom: 10px;
        left: 10px;
    }
    .stats-icon svg {
        width: 22px;
        height: 22px;
    }
    .modal-content {
        width: 299px; /* Casi todo el ancho para los más pequeños */
        max-width: 300px; /* Ajuste más estricto */
        min-height: 260px;
        padding: 12px;
    }
    h2 {
        font-size: 1.05em;
    }
    .summary-stats {
        font-size: 0.7em;
    }
    .summary-stats p {
        flex-basis: 48%; /* Pequeño ajuste */
    }
    .chart-options {
        gap: 4px;
    }
    .chart-options button {
        padding: 5px 8px;
        font-size: 0.7em;
    }
    .chart-container {
        height: 160px;
    }
}