
/* =========================================================
   ValdoTv Meteo - Interfaccia console
   Foglio di stile ripulito
   Compatibile con le classi esistenti in index.php
   Non modifica dati, soglie, PHP o funzioni JavaScript
   ========================================================= */

/* ---------- Variabili e impostazioni generali ---------- */

:root {
    color-scheme: light;

    --carta: #f1efe7;
    --carta-chiara: #faf9f4;
    --scheda: #fdfcf8;
    --inchiostro: #263b46;
    --testo-secondario: #66757a;
    --linea: #d9d7ce;
    --blu: #477f92;
    --blu-scuro: #31596a;
    --arancio: #c87545;
    --verde: #64816e;

    --ombra: 0 3px 12px rgba(39, 53, 59, 0.055);
    --bordo-console: #dce3e1;
    --sfondo-console: linear-gradient(145deg, #ffffff, #f7f8f5);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, Arial, Helvetica, sans-serif;
    background: var(--carta);
    color: var(--inchiostro);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 28px 24px 34px;
}

/* ---------- Intestazione ---------- */

header {
    position: relative;
    margin-bottom: 25px;
    padding: 10px 2px 22px;
    border-bottom: 1px solid #d5dfdc;
    text-align: left;
}

h1 {
    margin: 0 0 8px;
    color: var(--inchiostro);
    font-size: clamp(30px, 4vw, 43px);
    line-height: 1.12;
    letter-spacing: -0.035em;
    font-weight: 650;
}

.aggiornamento,
.prossimo {
    margin: 5px 0 0;
    color: var(--testo-secondario);
    font-size: 14px;
}

.aggiornamento strong,
.prossimo strong {
    color: var(--blu-scuro);
    font-weight: 650;
}

/* ---------- Fotografia ---------- */

.fotografia {
    margin: 0 0 22px;
    padding: 14px;
    background: var(--scheda);
    border: 1px solid var(--linea);
    border-radius: 15px;
    box-shadow: var(--ombra);
    text-align: left;
}

.fotografia h2 {
    margin: 0 0 12px;
    font-size: 17px;
    font-weight: 650;
}

.foto-meteo {
    display: block;
    width: 100%;
    max-width: 900px;
    max-height: 420px;
    object-fit: contain;
    margin: 0 auto;
    border-radius: 9px;
    background: #e7e5dd;
}

/* ---------- Griglia delle misure ---------- */

.misure {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: stretch;
}

/* Stile comune delle schede */

.scheda {
    position: relative;
    min-width: 0;
    overflow: hidden;
    padding: 24px 23px 22px;
    background: var(--sfondo-console);
    border: 1px solid var(--bordo-console);
    border-radius: 19px;
    box-shadow:
        0 5px 16px rgba(35, 58, 67, 0.07),
        0 1px 3px rgba(35, 58, 67, 0.04);
    text-align: left;
    transition:
        box-shadow 200ms ease,
        border-color 200ms ease,
        transform 200ms ease;
}

/* Bordo decorativo superiore */

.scheda::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #477f92, #83b5bc);
}

/* Icone */

.icona {
    min-height: 48px;
    margin: 0 0 7px;
    font-size: 39px;
    line-height: 1.2;
}

.scheda .icona {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    min-height: 58px;
    margin: 3px 0 15px;
    border-radius: 17px;
    background: #e8f0f1;
    font-size: 35px;
    line-height: 1;
}

/* Titoli */

h2 {
    margin: 0 0 14px;
    font-size: 19px;
    line-height: 1.3;
    font-weight: 650;
    letter-spacing: -0.015em;
}

.scheda h2 {
    margin: 0 0 10px;
    color: #62747a;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

/* Valori numerici */

.valore {
    margin: 0 0 20px;
    font-size: clamp(32px, 4vw, 43px);
    line-height: 1.15;
    font-weight: 650;
    letter-spacing: -0.035em;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.valore span {
    color: var(--testo-secondario);
    font-size: 0.48em;
    font-weight: 500;
    letter-spacing: 0;
    white-space: nowrap;
}

.scheda .valore {
    margin: 0 0 23px;
    color: #203d49;
    font-size: clamp(38px, 4.5vw, 52px);
    line-height: 1.08;
    font-weight: 750;
    letter-spacing: -0.045em;
    font-variant-numeric: tabular-nums;
    overflow-wrap: normal;
}

.scheda .valore span {
    display: inline-block;
    margin-left: 3px;
    color: #70838a;
    font-size: 0.40em;
    font-weight: 600;
    letter-spacing: 0;
    vertical-align: 0.18em;
}

/* ---------- Identità visiva delle tre misure ---------- */

/* Temperatura */

.scheda:nth-child(1)::before {
    background: linear-gradient(90deg, #c87545, #f0b27f);
}

.scheda:nth-child(1) .icona {
    background: #f9eadf;
}

.scheda:nth-child(1) .valore {
    color: #a9582f;
}

/* Pressione */

.scheda:nth-child(2)::before {
    background: linear-gradient(90deg, #477fbd, #8ab9e8);
}

.scheda:nth-child(2) .icona {
    background: #e5effa;
}

.scheda:nth-child(2) .valore {
    color: #315f98;
}

/* Umidità */

.scheda:nth-child(3)::before {
    background: linear-gradient(90deg, #299b9a, #8bd5ca);
}

.scheda:nth-child(3) .icona {
    background: #e0f3ef;
}

.scheda:nth-child(3) .valore {
    color: #218581;
}

/* ---------- Barre di riferimento ---------- */

.barra {
    width: 100%;
    height: 8px;
    overflow: hidden;
    background: #e6e5dd;
    border-radius: 99px;
}

.scheda .barra {
    height: 10px;
    background: #e5eae7;
    border-radius: 20px;
}

.riempimento {
    height: 100%;
    border-radius: inherit;
    transition: width 0.65s ease;
}

.scheda .riempimento {
    border-radius: 20px;
}

.temperatura {
    background: var(--arancio);
}

.pressione {
    background: var(--blu);
}

.scheda .temperatura {
    background: linear-gradient(90deg, #c87545, #e9a36e);
}

.scheda .pressione {
    background: linear-gradient(90deg, #477f92, #83b5bc);
}

/* Colori specifici delle barre delle prime tre schede */

.scheda:nth-child(1) .temperatura {
    background: linear-gradient(90deg, #c87545, #f0b27f);
}

.scheda:nth-child(2) .pressione {
    background: linear-gradient(90deg, #477fbd, #8ab9e8);
}

.scheda:nth-child(3) .umidita-barra {
    background: linear-gradient(90deg, #299b9a, #8bd5ca);
}

/* Etichette delle scale */

.scala {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    color: #7e8989;
    font-size: 12px;
}

.scheda .scala {
    margin-top: 9px;
    color: #829094;
    font-size: 11px;
    font-weight: 600;
}

/* Effetto al passaggio del puntatore */

.scheda:hover {
    border-color: #c4d5d6;
    box-shadow: 0 9px 23px rgba(35, 58, 67, 0.11);
    transform: translateY(-2px);
}


/* Scheda vento: dati a sinistra, rosa a destra */

.scheda-vento .vento-layout {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}

.scheda-vento .vento-dati {
    flex: 1 1 0;
    min-width: 0;
    text-align: left;
}

.scheda-vento .rosa-venti {
    display: block;
    flex: 0 0 150px;
    width: 150px;
    min-width: 150px;
    max-width: 150px;
    margin-left: auto;
    text-align: center;
}

.scheda-vento .rosa-venti svg {
    display: block;
    width: 150px;
    height: 150px;
    max-width: 100%;
    margin: 0 auto;
}

.scheda-vento .rosa-didascalia {
    margin-top: 5px;
    color: #6b7280;
    font-size: 9px;
    line-height: 1.2;
    text-align: center;
    overflow-wrap: anywhere;
}


/* ---------- Grafici meteo ---------- */

.grafico {
    position: relative;
    grid-column: 1 / -1;
    min-width: 0;
    overflow: hidden;
    margin-top: 2px;
    padding: 23px 24px 20px;
    background: var(--sfondo-console);
    border: 1px solid var(--bordo-console);
    border-radius: 19px;
    box-shadow:
        0 5px 16px rgba(35, 58, 67, 0.055),
        0 1px 3px rgba(35, 58, 67, 0.025);
    animation: comparsa 350ms ease both;
}

.grafico h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 20px;
    color: var(--blu-scuro);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.grafico-contenitore {
    position: relative;
    width: 100%;
    height: 290px;
    padding: 3px 0;
}

.grafico canvas {
    max-width: 100%;
}

/* ---------- Selettori dei grafici ---------- */

.selettori-grafico {
    display: grid;
    grid-template-columns: auto minmax(130px, 1fr) auto minmax(130px, 1fr);
    align-items: center;
    gap: 10px 12px;
    margin-bottom: 24px;
    padding: 15px;
    background: #edf2f0;
    border: 1px solid #dce5e1;
    border-radius: 14px;
}

.selettori-grafico label {
    color: #526a73;
    font-size: 13px;
    font-weight: 700;
}

.selettori-grafico select {
    width: 100%;
    min-width: 0;
    padding: 11px 30px 11px 12px;
    border: 1px solid #d1ddda;
    border-radius: 10px;
    background: #ffffff;
    color: #263b46;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.selettori-grafico select:focus {
    outline: 2px solid #83b5bc;
    outline-offset: 2px;
}

.grafico-messaggio {
    margin: 10px 0;
    padding: 20px;
    border-radius: 12px;
    background: #edf2f0;
    color: #526a73;
    text-align: center;
}

.grafico-messaggio[hidden] {
    display: none;
}

/* ---------- Errori ---------- */

.errore {
    padding: 24px;
    background: var(--scheda);
    border: 1px solid #e5c9bf;
    border-radius: 14px;
    color: #984b3e;
    box-shadow: var(--ombra);
    text-align: center;
}

/* ---------- Piè di pagina ---------- */

footer {
    margin-top: 28px;
    padding-top: 17px;
    border-top: 1px solid var(--linea);
    color: var(--testo-secondario);
    font-size: 13px;
    text-align: center;
}

footer p {
    margin: 0;
}

/* ---------- Animazioni ---------- */

@keyframes comparsa {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Tablet e smartphone ---------- */

@media (max-width: 700px) {
    .container {
        padding: 20px 14px 26px;
    }

    header {
        margin-bottom: 18px;
        padding-bottom: 17px;
    }

    h1 {
        font-size: clamp(27px, 7vw, 35px);
    }

    .aggiornamento,
    .prossimo {
        font-size: 13px;
    }

    .fotografia {
        margin-bottom: 16px;
        padding: 10px;
    }

    .misure {
        grid-template-columns: 1fr;
        gap: 13px;
    }

    .scheda {
        padding: 18px 19px 19px;
        border-radius: 17px;
    }

    .icona {
        min-height: 40px;
        font-size: 34px;
    }

    .scheda .icona {
        width: 48px;
        height: 48px;
        min-height: 48px;
        margin-bottom: 12px;
        border-radius: 14px;
        font-size: 30px;
    }

    .scheda h2 {
        font-size: 15px;
    }

    .valore {
        margin-bottom: 17px;
        font-size: 36px;
    }

    .scheda .valore {
        margin-bottom: 19px;
        font-size: 39px;
    }

    .grafico {
        padding: 18px 14px 15px;
        border-radius: 16px;
    }

    .grafico h2 {
        margin-bottom: 14px;
        font-size: 15px;
    }

    .grafico-contenitore {
        height: 245px;
    }

    .selettori-grafico {
        grid-template-columns: 1fr;
        gap: 7px;
        margin-bottom: 18px;
        padding: 12px;
    }

    .selettori-grafico label {
        margin-top: 3px;
    }

    .selettori-grafico select {
        margin-bottom: 8px;
        font-size: 14px;
    }

    .scheda-vento .vento-layout {
        gap: 6px;
    }

    .scheda-vento .vento-dati .valore {
        font-size: 3rem;
    }
}

/* ---------- Schermi molto stretti ---------- */

@media (max-width: 360px) {
    .container {
        padding-right: 10px;
        padding-left: 10px;
    }

    .valore {
        font-size: 32px;
    }

    .scheda .valore {
        font-size: 34px;
    }

    .grafico-contenitore {
        height: 215px;
    }
}

/* ---------- Preferenza per animazioni ridotte ---------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Riepilogo statistiche ultime 24 ore */
.riepilogo-24h {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0 8px;
}

.statistica-24h {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 8px;
    border: 1px solid #d8d4ca;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.55);
    text-align: center;
    min-width: 0;
}

.etichetta-statistica {
    font-size: 0.82rem;
    color: #555;
}

.statistica-24h strong {
    font-size: 1.2rem;
    font-weight: 700;
    color: #222;
}

@media (max-width: 480px) {
    .riepilogo-24h {
        gap: 5px;
    }

    .statistica-24h {
        padding: 10px 3px;
    }

    .etichetta-statistica {
        font-size: 0.68rem;
    }

    .statistica-24h strong {
        font-size: 0.95rem;
    }
}

