/* Reset base e fix dimensioni */
* { box-sizing: border-box; margin: 0; padding: 0; }

body, html {
    width: 100%; 
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #8b0000; 
    color: #333;
    touch-action: manipulation; /* Evita zoom al tocco su smartphone */
}

.wrapper { 
    padding: 15px; 
    display: flex; 
    justify-content: center; 
    align-items: flex-start; 
    min-height: 100vh; 
}

.container { 
    background-color: #fff; 
    width: 100%; 
    max-width: 500px; 
    border-radius: 12px; 
    padding: 25px 20px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); 
}

h2, h3 { color: #8b0000; margin-bottom: 15px; text-align: center; }
p { margin-bottom: 15px; line-height: 1.4; }

.form-group { margin-bottom: 20px; text-align: left; }
label { font-weight: bold; display: block; margin-bottom: 8px; font-size: 16px; }

/* Input adattati perfettamente al 100% del contenitore */
input[type="text"], input[type="password"], input[type="number"], input[type="date"], select {
    width: 100%; 
    padding: 15px; 
    border: 2px solid #ccc; 
    border-radius: 8px; 
    font-size: 18px; 
    background-color: #f9f9f9;
}

input:disabled, select:disabled { background-color: #e9ecef; color: #666; }

/* Pulsanti larghi e facili da premere */
.button {
    display: block; 
    width: 100%; 
    padding: 18px 10px; 
    margin-bottom: 15px;
    color: white; 
    text-align: center; 
    text-decoration: none; 
    border: none; 
    border-radius: 8px; 
    font-size: 18px; 
    font-weight: bold; 
    cursor: pointer;
}

.button.blue { background-color: #007bff; }
.button.green { background-color: #28a745; }
.button.red { background-color: #dc3545; }
.button.gray { background-color: #6c757d; }

/* Griglia Voti */
.voto-row {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    background: #f8f9fa; 
    padding: 15px; 
    margin-bottom: 15px;
    border-radius: 8px; 
    border: 2px solid #ddd;
}
.voto-row label { margin: 0; font-size: 18px; width: 60%; }
.voto-row input { width: 80px; text-align: center; font-size: 22px; padding: 10px; border-color: #007bff; margin-bottom: 0; }
.voto-row input:focus { border-color: #8b0000; outline: none; }

/* Evidenziazione errori in rosso */
.error-row { border-color: #dc3545 !important; background-color: #f8d7da !important; color: #721c24; }
.error-row input { border-color: #dc3545 !important; background-color: #fff; color: #dc3545; }

/* Navigazione Tab */
.nav-buttons { display: flex; gap: 10px; margin-top: 25px; }
.nav-buttons button { flex: 1; padding: 18px; font-size: 18px; border-radius: 8px; border: none; color: white; font-weight: bold; }

/* Tabelle */
table.storico { width: 100%; border-collapse: collapse; margin-top: 15px; font-size: 16px; }
table.storico th, table.storico td { border: 1px solid #ddd; padding: 12px; text-align: left; }
table.storico th { background-color: #8b0000; color: white; }
.action-links a { text-decoration: none; font-weight: bold; display: inline-block; padding: 5px; }
/* Messaggi */
.msg-ok { background: #d4edda; color: #155724; padding: 12px; border-radius: 8px; margin-bottom: 20px; text-align: center; font-weight: bold; }
.msg-errore { background: #f8d7da; color: #721c24; padding: 12px; border-radius: 8px; margin-bottom: 20px; text-align: center; font-weight: bold; }
.msg-avviso { background: #fff3cd; color: #856404; padding: 12px; border-radius: 8px; margin-bottom: 20px; text-align: center; }

/* Azioni in POST mostrate come pulsanti o come link */
form.form-azione { margin: 0; }
form.form-azione .button { margin-bottom: 15px; }
.link-azione { background: none; border: none; padding: 5px; color: #dc3545; font-weight: bold; font-size: inherit; cursor: pointer; text-decoration: none; font-family: inherit; }

/* Dettaglio voti */
.voto-dettaglio { color: #333; padding: 4px 0; border-bottom: 1px solid #ddd; }
.voto-dettaglio.scartato { color: #999; text-decoration: line-through; }
