body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #bfc7cf;  
    text-align: center;
    overflow-x: hidden;
}

h1 {
    color: #c62828;
    margin-top: 15px;
    font-size: 28px;
}

/* BOTONES */
button {
    padding: 10px 20px;
    margin: 10px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    cursor: pointer;
    font-weight: bold;
}

button:hover {
    opacity: 0.9;
}

/* DASHBOARD */
.dashboard {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-top: 10px;
}

/* BLOQUE IZQUIERDO (fábrica + tabla) */
.factory-block {
    width: 48%;
    min-width: 450px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ÁREA FÁBRICA */
.factory {
    position: relative;
    width: 100%;
    height: 260px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    overflow: hidden; /* Evita que las botellas salgan del fondo blanco */
}

/* MÁQUINA */
.machine {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 110px;
    background: linear-gradient(to bottom, #999, #666);
    border: 2px solid #555;
    z-index: 10;
}

.machine::after {
    content: "";
    position: absolute;
    top: 15px;
    right: 15px;
    width: 12px;
    height: 12px;
    background: lime;
    border-radius: 50%;
    box-shadow: 0 0 10px lime;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; box-shadow: none; }
}

.machine::before {
    content: "";
    position: absolute;
    top: 100px;
    left: 62px;
    width: 20px;
    height: 55px;
    background: #222;
    z-index: 9;
}

/* BANDA */
.belt {
    position: absolute;
    bottom: 40px;
    width: 100%;
    height: 50px;
    background: #444;
    border-top: 5px solid #666;
    border-bottom: 5px solid #222;
}

/* BOTELLA */
.bottle {
    position: absolute;
    bottom: 50px;
    width: 38px;
    height: 105px;
    background: linear-gradient(to bottom, #ffffff, #dfefff);
    border: 2px solid #555;
    border-radius: 10px 10px 8px 8px;
    overflow: hidden;
    box-shadow: inset 4px 0px 8px rgba(255,255,255,0.7), inset -4px 0px 8px rgba(0,0,0,0.08), 0px 2px 6px rgba(0,0,0,0.2);
    z-index: 5;
}

.bottle::before {
    content: "";
    position: absolute;
    top: 0px;
    left: 11px;
    width: 12px;
    height: 18px;
    background: linear-gradient(to bottom, #ffffff, #dfefff);
    border-left: 2px solid #555;
    border-right: 2px solid #555;
    border-radius: 4px 4px 0 0;
    z-index: 3;
}

.bottle::after {
    content: "";
    position: absolute;
    top: 0px;
    left: 8px;
    width: 18px;
    height: 6px;
    background: #c62828;
    border-radius: 2px;
    z-index: 4;
}

/* LÍQUIDO */
.liquid {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(to top, #0097a7, #00e5ff);
    transition: height 1s;
    z-index: 1;
}

/* CHORRO */
.stream {
    position: absolute;
    top: 140px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 70px;
    background: #00bcd4;
    opacity: 0;
    z-index: 6;
    transition: opacity 0.1s;
}

/* INFORMACIÓN */
.info-panel {
    width: 48%;
    min-width: 450px;
    min-height: 500px;   
    background: white;
    border-radius: 15px;
    padding: 20px;      
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}


.stats {
    font-size: 16px;
    margin: 5px 0;
    font-weight: bold;
}

.alert {
    font-size: 18px;
    color: red;
    font-weight: bold;
    margin-top: 10px;
    min-height: 22px;
}

.cep-formulas {
    margin-top: 18px;
    text-align: left;
}

.cep-formulas h4 {
    text-align: center;
    margin: 12px 0;
    font-size: 18px;
}

.formula-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.formula-card {
    border: 1px solid #d6dee6;
    border-radius: 8px;
    padding: 12px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 6px;
    line-height: 1.35;
}

.formula-card strong {
    color: #00796b;
    font-size: 16px;
}

.formula-card span {
    font-family: "Consolas", "Courier New", monospace;
    font-size: 13px;
}

.formula-card em {
    color: #334155;
    font-style: normal;
    font-size: 13px;
}

.theory-panel {
    margin-top: 18px;
    text-align: left;
}

.theory-panel h4 {
    text-align: center;
    margin: 12px 0;
    font-size: 18px;
}

.theory-panel p {
    margin: 8px 0;
    line-height: 1.45;
}

/* TABLA SUBGRUPOS */
.subgroup-table {
    width: 100%;
    margin-top: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 0 8px rgba(0,0,0,0.1);
    overflow-x: auto;
}

.subgroup-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.subgroup-table th, .subgroup-table td {
    border: 1px solid #ccc;
    padding: 6px;
    text-align: center;
}

/* CONTENEDOR GENERAL DE GRÁFICOS */
.chart-container {
    width: 95%;
    margin: 30px auto;
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* BLOQUES DE GRÁFICOS */
.chart-box {
    position: relative;
    margin: 20px 0;
    width: 100%;
}

/* GRÁFICO DE PRODUCCIÓN */
#productionChart {
    height: 250px !important;  
    width: 100% !important;
}


/* FILA DE GRÁFICOS X Y R */
.charts-row {
    display: flex;
    justify-content: space-between; 
    align-items: stretch;          
    gap: 20px;                      
}


/* BLOQUES DE GRÁFICOS PEQUEÑOS */
.small-chart {
    flex: 1;
    min-width: 300px;
    background: #fafafa;         
    border: 3px solid #ccc;       
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); 
    transition: transform 0.2s, box-shadow 0.2s;
}


/* CANVAS DE GRÁFICOS PEQUEÑOS */
#xbarChart, #rChart {
    height: 220px !important;
    width: 100% !important;
}

.custom-chart-tooltip {
    position: fixed;
    z-index: 9999;
    display: none;
    max-width: 320px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.82);
    color: white;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.35;
    text-align: left;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.custom-chart-tooltip strong,
.custom-chart-tooltip span {
    display: block;
    margin: 2px 0;
}

@media(max-width:1000px){
    .factory-block,
    .info-panel {
        width: 95%;
        margin-top: 10px;
    }
}
