/* ==========================================
   ROBY LOGGER
   FERMENTATION MONITORING SYSTEM
   ========================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #0b0f14;
    color: #e6edf3;
    font-family: Arial, Helvetica, sans-serif;
    min-height: 100vh;
}

/* CONTENITORE PRINCIPALE */

.container {
    width: 100%;
    max-width: 1200px;
    margin: auto;
    padding: 30px;
}

/* HEADER */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
}

.logo h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 3px;
    color: #ffffff;
}

.logo p {
    margin-top: 6px;
    font-size: 11px;
    letter-spacing: 2px;
    color: #8b949e;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #151c24;
    border: 1px solid #26323d;
    padding: 12px 16px;
    border-radius: 30px;
    font-size: 12px;
    color: #9daab7;
}

.status-dot {
    width: 9px;
    height: 9px;
    background: #39d98a;
    border-radius: 50%;
    box-shadow: 0 0 10px #39d98a;
}

/* ==========================================
   PANNELLO TEMPERATURA + FERMENTAZIONE
   ========================================== */

.main-panel {
    display: grid;
    grid-template-columns: 0.8fr 1.8fr;
    gap: 25px;
    align-items: stretch;
    margin-bottom: 25px;
}

/* TEMPERATURA */

.main-panel .temperature-card {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 280px;
}

.main-panel .temperature-value {
    font-size: 65px;
}

.main-panel .temperature-value span {
    font-size: 30px;
}

/* FERMENTAZIONE */

.main-panel .fermentation-card {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* INFORMAZIONI */

.main-panel .fermentation-info {
    grid-template-columns: repeat(2, 1fr);
}

/* SMARTPHONE E TABLET */

@media (max-width: 768px) {

    .main-panel {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .main-panel .temperature-card {
        min-height: 200px;
    }

    .main-panel .temperature-value {
        font-size: 65px;
    }

}

/* CARD TEMPERATURA */

.temperature-card {
    background: linear-gradient(135deg, #17232c, #111820);
    border: 1px solid #263744;
    border-radius: 20px;
    padding: 35px;
    text-align: center;
    margin-bottom: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.card-label {
    color: #91a1af;
    font-size: 12px;
    letter-spacing: 3px;
}

.temperature-value {
    font-size: 100px;
    font-weight: 700;
    color: #f0f6fc;
    margin: 15px 0;
    line-height: 1;
}

.temperature-value span {
    font-size: 45px;
    color: #45d483;
}

.sensor-status {
    color: #8b949e;
    font-size: 12px;
    letter-spacing: 2px;
}

.sensor-status span {
    color: #39d98a;
}

/* CARD FERMENTAZIONE */

.fermentation-card,
.chart-card {
    background: #121820;
    border: 1px solid #26323d;
    border-radius: 18px;
    padding: 25px;
    margin-bottom: 25px;
}

.section-title {
    margin-bottom: 25px;
}

.section-title h2 {
    font-size: 15px;
    letter-spacing: 2px;
    color: #dce6ee;
}

/* INFORMAZIONI FERMENTAZIONE */

.fermentation-info {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.info-box {
    background: #0b1117;
    border: 1px solid #222e38;
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-label {
    font-size: 10px;
    color: #7d8b98;
    letter-spacing: 2px;
}

.info-value {
    font-size: 15px;
    color: #e6edf3;
    font-weight: 600;
}

/* PULSANTI */

.controls {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.controls button {
    flex: 1;
    padding: 16px;
    border-radius: 10px;
    border: none;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-start {
    background: #25c976;
    color: #07140d;
}

.btn-start:hover {
    background: #43e18c;
    transform: translateY(-2px);
}

.btn-stop {
    background: #321d21;
    border: 1px solid #5b3038 !important;
    color: #e16b79;
}

.btn-stop:hover:not(:disabled) {
    background: #51252d;
}

.btn-stop:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* GRAFICO */

.chart-placeholder {
    width: 100%;
    height: 300px;
    background: #0b1117;
    border: 1px dashed #283642;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #52616f;
    font-size: 12px;
    letter-spacing: 2px;
}

/* STATISTICHE */

.statistics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #121820;
    border: 1px solid #26323d;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
}

.stat-card span {
    display: block;
    color: #7d8b98;
    font-size: 11px;
    letter-spacing: 2px;
    margin-bottom: 12px;
}

.stat-card strong {
    font-size: 25px;
    color: #e6edf3;
}

/* FOOTER */

footer {
    text-align: center;
    padding: 20px;
    font-size: 10px;
    letter-spacing: 2px;
    color: #4c5966;
}

/* ==========================================
   VERSIONE SMARTPHONE
   ========================================== */

@media (max-width: 768px) {

    .container {
        padding: 15px;
    }

    .header {
        align-items: flex-start;
        gap: 15px;
    }

    .logo h1 {
        font-size: 23px;
    }

    .logo p {
        font-size: 9px;
        letter-spacing: 1px;
    }

    .system-status {
        font-size: 10px;
        padding: 10px;
    }

    .temperature-card {
        padding: 30px 15px;
    }

    .temperature-value {
        font-size: 75px;
    }

    .temperature-value span {
        font-size: 35px;
    }

    .fermentation-info {
        grid-template-columns: repeat(2, 1fr);
    }

    .controls {
        flex-direction: column;
    }

    .statistics {
        gap: 10px;
    }

    .stat-card {
        padding: 15px 5px;
    }

    .stat-card strong {
        font-size: 18px;
    }

    .chart-placeholder {
        height: 220px;
    }
}

/* SMARTPHONE PICCOLI */

@media (max-width: 400px) {

    .system-status {
        padding: 8px;
    }

    .temperature-value {
        font-size: 60px;
    }

    .info-value {
        font-size: 13px;
    }

}

/* ==============================
   MODALE AVVIO FERMENTAZIONE
============================== */

.modal {

    display: none;

    position: fixed;

    inset: 0;

    background: rgba(0, 0, 0, 0.75);

    backdrop-filter: blur(5px);

    z-index: 1000;

    justify-content: center;

    align-items: center;

    padding: 20px;

}


.modal-content {

    width: 100%;

    max-width: 420px;

    background: #1c2430;

    border: 1px solid #303c4c;

    border-radius: 14px;

    padding: 30px;

    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);

}


.modal-content h2 {

    margin: 0 0 25px;

    font-size: 20px;

    color: #ffffff;

    letter-spacing: 1px;

}


.modal-form {

    display: flex;

    flex-direction: column;

    gap: 12px;

}


.modal-form label {

    font-size: 12px;

    color: #9ba8b8;

    letter-spacing: 1px;

    margin-top: 8px;

}


.modal-form input {

    width: 100%;

    box-sizing: border-box;

    background: #111821;

    border: 1px solid #354253;

    border-radius: 7px;

    padding: 12px;

    color: #ffffff;

    font-size: 15px;

    outline: none;

}


.modal-form input:focus {

    border-color: #38bdf8;

    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);

}


.modal-buttons {

    display: flex;

    gap: 12px;

    margin-top: 25px;

}


.modal-buttons button {

    flex: 1;

    padding: 12px;

    border: none;

    border-radius: 7px;

    font-weight: bold;

    cursor: pointer;

    transition: 0.2s;

}


#modal-cancel {

    background: #303b49;

    color: #d1d9e2;

}


#modal-cancel:hover {

    background: #3c4959;

}


#modal-confirm {

    background: #16a34a;

    color: white;

}


#modal-confirm:hover {

    background: #15803d;

}


.modal-error {

    color: #f87171;

    font-size: 13px;

    margin-top: 15px;

    text-align: center;

}


/* PULSANTI MODALE TERMINAZIONE */

#modal-stop-cancel {
    background: #303b49;
    color: #d1d9e2;
}

#modal-stop-confirm {
    background: #dc2626;
    color: white;
}

#modal-stop-confirm:hover {
    background: #b91c1c;
}

/* STATO SENSORE */

.sensor-status.online span {
    color: #22c55e;
}

.sensor-status.offline span {
    color: #ef4444;
}
/* ULTIMA RILEVAZIONE */

.last-reading {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 8px;
    letter-spacing: 0.5px;
}

/* GRAFICO STORICO TEMPERATURA */
.chart-card {
    background: #121820;
    border: 1px solid #26323d;
    border-radius: 18px;
    padding: 25px;
    margin-bottom: 25px;
    width: 100%;
}

.chart-card .card-label {
    margin-bottom: 20px;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 320px;
}

.chart-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

@media (max-width: 768px) {
    .chart-card {
        padding: 18px;
    }
    .chart-container {
        height: 250px;
    }
}
