/* STILE TEST INTEGRALI FISICA - VERSIONE DSA 
   Linee guida: Alta leggibilità, contrasto riposante, spaziatura aumentata.
*/

:root {
    --bg-dsa: #fdf6e3;          /* Sfondo crema/paglierino per ridurre l'abbagliamento */
    --text-dsa: #202124;        /* Grigio quasi nero per contrasto morbido */
    --primary-blue: #0056b3;
    --verify-blue: #004494;
    --reset-red: #b22222;
    --index-bordeaux: #800020;
    --step-bg: #fff9e6;         /* Sfondo evidenziato per i passaggi */
}

body {
    /* Verdana è uno dei font più leggibili per DSA tra quelli standard */
    font-family: 'Verdana', 'Geneva', sans-serif;
    background-color: var(--bg-dsa);
    color: var(--text-dsa);
    line-height: 1.8;           /* Interlinea aumentata per evitare sovrapposizioni */
    letter-spacing: 0.05em;     /* Spaziatura tra lettere aumentata */
    margin: 0;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.main-test-wrapper {
    background-color: #ffffff;
    max-width: 1000px;
    width: 100%;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    margin-top: 20px;
    box-sizing: border-box;
}

/* Header compatto */
.header-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.left-image, .right-image {
    max-height: 45px;
    height: auto;
}

/* Titoli e Istruzioni */
h1 {
    font-size: 2rem;
    color: var(--primary-blue);
    text-align: center;
    margin: 10px 0;
}

.instruction-text {
    background-color: #e7f3ff;
    border-left: 6px solid #0056b3;
    padding: 20px;
    font-weight: bold;
    margin-bottom: 30px;
    border-radius: 4px;
}

/* Box argomenti (verde) */
.topics-box {
    background: #d4edda;
    padding: 15px;
    border-left: 4px solid #28a745;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* Box istruzioni smartphone (giallo) */
.instruction-box {
    background: #fff3cd;
    padding: 15px;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* Domande e Formule */
.question {
    background: #fff;
    border: 2px solid #ced4da;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 40px;        /* Molto spazio tra una domanda e l'altra */
}

.question h3 {
    color: var(--primary-blue);
    font-size: 1.4rem;
    margin-bottom: 15px;
}

/* Ingrandimento formule MathJax per DSA */
.mjx-chtml, .MathJax {
    font-size: 1.25rem !important;
    margin: 15px 0 !important;
}

/* Opzioni di risposta larghe e ben distanziate */
label {
    display: block;
    background: #f8f9fa;
    padding: 15px;
    margin: 12px 0;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    cursor: pointer;
    transition: background 0.2s;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

label:hover {
    background: #e9ecef;
}

input[type="radio"] {
    transform: scale(1.5);      /* Radio button più grandi per facilitare il clic */
    margin-right: 15px;
}

/* Soluzioni */
.solution {
    display: none;
    margin-top: 20px;
    padding: 20px;
    background-color: var(--step-bg);
    border-radius: 8px;
    border: 1px dashed #d4a017;
    font-size: 1.1rem;
}

.solution ol {
    line-height: 1.8;
}

/* BOTTONI - Grandi e con colori differenziati */
button {
    font-family: 'Verdana', sans-serif;
    padding: 15px 25px;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    margin: 10px;
}

/* Mostra Soluzione (Grigio di default) */
.btn-secondary, .solution-btn, .solution-toggle-btn {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover, .solution-btn:hover, .solution-toggle-btn:hover {
    background-color: #495057;
}

/* Stato quando la soluzione è aperta (Rosso) */
.btn-active {
    background-color: #d9534f !important;
    color: white !important;
}

.btn-active:hover {
    background-color: #c9302c !important;
}

/* Ascolta (Verde) */
.btn-listen {
    background-color: #28a745;
    color: white;
}

.btn-listen:hover {
    background-color: #218838;
}

/* Verifica (Blu) */
.btn-verify {
    background-color: var(--verify-blue);
    color: white;
}

.btn-verify:hover {
    background-color: #003d82;
}

/* Ricomincia (Nero) */
.btn-reset {
    background-color: #333333;
    color: white;
}

.btn-reset:hover {
    background-color: #1a1a1a;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: translateY(-2px);
}

/* Stampa (Viola) */
.btn-print {
    background-color: #6f42c1;
    color: white;
}

.btn-print:hover {
    background-color: #5a32a3;
}

/* Indice (Bordeaux) */
.btn-index {
    background-color: var(--index-bordeaux);
    color: white;
}

.btn-index:hover {
    background-color: #600018;
    transform: translateY(-2px);
}

/* Teoria (Blu chiaro) */
.btn-theory {
    background-color: #007bff;
    color: white;
}

.btn-theory:hover {
    background-color: #0056b3;
}

/* Bottone per tornare alla Versione Standard (Arancione) */
.btn-standard-version {
    background-color: #ff8c00;
    color: white;
}

.btn-standard-version:hover {
    background-color: #e67e00;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: translateY(-2px);
}

button:hover {
    transform: translateY(-3px);
    filter: brightness(1.1);
}

/* Footer centrato e ordinato */
.footer-container {
    display: block;
    text-align: center;
    margin-top: 20px;
    padding: 20px 0;
}
.footer-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

/* Risultati chiari */
.results {
    margin-top: 30px;
    padding: 20px;
    border-radius: 10px;
    background-color: #e9ecef;
    width: 100%;
    max-width: 800px;
}

.results h2, .results h3 {
    color: var(--primary-blue);
    margin-top: 0;
}

.correct { color: green; font-weight: bold; }
.incorrect { color: red; font-weight: bold; }

/* --- RESPONSIVE SMARTPHONE --- */
@media (max-width: 768px) {
    .main-test-wrapper {
        max-width: 100%;
        padding: 15px;
        margin: 0;
        border-radius: 8px;
    }
    
    body {
        padding: 5px;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    .instruction-text {
        padding: 12px;
        font-size: 0.9rem;
    }
    
    .question {
        padding: 15px;
    }
    
    .question h3 {
        font-size: 1.3rem;
    }
    
    label {
        padding: 12px;
        font-size: 1rem;
    }
    
    button {
        font-size: 1rem;
        padding: 12px 20px;
    }
    
    .header-box img {
        max-height: 35px;
    }
    
    .solution {
        padding: 15px;
        font-size: 1rem;
    }
}

/* --- REGOLE PER LA STAMPA --- */
@media print {
    .solution {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    button, 
    .footer-buttons, 
    .header-box, 
    input[type="radio"], 
    hr,
    .btn-listen {
        display: none !important;
    }

    .question {
        page-break-inside: avoid;
        border: none !important;
        border-bottom: 1px solid #ddd !important;
        margin-bottom: 30px !important;
        padding-bottom: 20px !important;
    }

    img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid;
    }
    
    body {
        background: white !important;
    }
    
    .main-test-wrapper {
        box-shadow: none !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .solution {
        background: #fffef5 !important;
        border-left: 3px solid #999 !important;
        page-break-inside: avoid;
    }
    
    .footer-container { 
        display: none !important; 
    }
}
/*
@media (min-width: 600px) {
    .footer-container {
        flex-direction: row;
        justify-content: center;
    }
}
*/