/* --- STILE GENERALE (ALTA LEGGIBILITÀ DSA) --- */
body {
    font-family: Arial, Verdana, sans-serif;
    background: #f5f7fa;
    margin: 0;
    padding: 20px;
    letter-spacing: 0.04em;
    line-height: 1.9;
}

.container {
    width: 95%;
    max-width: 1100px;
    margin: auto;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* --- HEADER --- */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e8f5e9;
}

.header h1 {
    color: #2e7d32;
    margin-bottom: 10px;
    font-size: 2em;
}

.header-box {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 15px !important;
    border: 2px dashed #28a745 !important;
    border-radius: 8px !important;
    background-color: white !important;
    margin-bottom: 25px !important;
    transition: background-color 0.3s;
}

.header-box:hover {
    background-color: #f0fdf4 !important;
    cursor: pointer;
}

/* --- SEZIONI E BOTTONI --- */
.section {
    margin-bottom: 20px;
}

.section-button {
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
    background: #e0f2f1; 
    border: 2px solid #80cbc4; 
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-weight: bold;
    color: #004d40; 
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 77, 64, 0.1);
}

.section-button:hover {
    background: #b2dfdb; 
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 77, 64, 0.2);
}

.arrow {
    transition: transform 0.3s ease;
    font-size: 0.8em;
    color: #00796b;
}

/* --- ANIMAZIONE SOLUZIONI (FISSA) --- */
.section-content {
    display: none;
    padding: 20px;
    border: 2px solid #e8f5e9;
    border-top: none;
    border-radius: 0 0 8px 8px;
    background: #fafafa;
}

/* --- CONTENUTI SPECIFICI --- */
.problem-text {
    background: #f0f4f8;
    padding: 15px;
    margin: 15px 0;
    border-left: 5px solid #2e7d32;
    border-radius: 4px;
}

.step {
    background: #f1f8e9;
    padding: 15px;
    margin: 15px 0;
    border-radius: 8px;
}

.formula-box {
    background: white;
    padding: 15px;
    margin: 15px 0;
    border-left: 4px solid #4caf50;
    border-radius: 4px;
    overflow-x: auto;
}

.result-box {
    background: #e8f5e9;
    padding: 15px;
    border: 2px solid #2e7d32;
    border-radius: 8px;
}

/* --- TABELLE --- */
table {
    border-collapse: collapse;
    width: 100%;
    margin: 20px 0;
    background-color: #ffffff;
}

table td, table th {
    padding: 12px;
    border: 2px solid #ccd1d9 !important;
    text-align: center;
}

table th {
    background-color: #e8f5e9;
    color: #2e7d32;
}

table tr:nth-child(even) {
    background-color: #fcfdfc;
}

/* --- GRAFICI --- */
.graph-container {
    background-color: white;
    border: 1px solid #c8e6c9;
    border-radius: 12px;
    padding: 20px;
    margin: 20px auto;
    max-width: 600px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.graph-container img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* --- BOTTONI AUDIO E NAVIGAZIONE --- */
#btn-audio, .btn-ascolta-domanda {
    background-color: #ff9800;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.nav-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

.btn-nav {
    padding: 12px 24px;
    background: white;
    color: #2e7d32;
    border: 2px solid #2e7d32;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.btn-nav:hover { background: #2e7d32; color: white; }

/* --- ACCESSIBILITÀ --- */
button:focus, a:focus {
    outline: 3px solid #ff9800;
    outline-offset: 2px;
}
.instruction-box {
    background: #fff3cd;
    padding: 15px;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    margin: 10px 0 25px 0;
    font-size: 0.95rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    color: #333;
}

/* --- STAMPA (CORRETTA) --- */
@media print {
    body { background: white; padding: 0; }
    .container { width: 100%; max-width: 100%; box-shadow: none; border: none; }
    
    /* Forza l'espansione di tutte le soluzioni */
    .section-content { 
        display: block !important; 
        max-height: none !important; 
        opacity: 1 !important; 
        overflow: visible !important;
        border: 1px solid #eee !important;
        padding: 20px !important;
        margin-bottom: 20px;
    }
    
    /* Nasconde elementi inutili su carta */
    .section-button, .arrow, .nav-buttons, .btn-ascolta-domanda, #btn-audio, .instruction-box { 
        display: none !important; 
    }
    
    .section { page-break-inside: avoid; margin-bottom: 30px; }
    .step, .formula-box, table { page-break-inside: avoid; }
}

/* Responsive */
@media (max-width: 600px) {
    .header-box { flex-direction: column; gap: 15px; }
}