/* Stile Integrazione Numerica - Versione DSA */
/* Alta leggibilità, contrasto morbido, interattività */

:root {
    --primary: #2c3e50;
    --secondary: #2e7d32;      /* Verde DSA */
    --light: #f1f8e9;
    --dark: #1b2631;
    --accent: #27ae60;
    --bg-dsa: #fafdf7;         /* Sfondo leggermente verde, anti-abbagliamento */
}

body {
    font-family: 'Verdana', Arial, sans-serif;
    line-height: 2;
    background: var(--bg-dsa);
    color: var(--dark);
    letter-spacing: 0.03em;
    margin: 0;
    padding: 10px;
}

.container {
    max-width: 1100px;
    margin: 1.5rem auto;
    padding: 2rem;
    background: white;
    box-shadow: 0 0 20px rgba(0,0,0,0.08);
    border-radius: 15px;
}

/* --- TESTATA --- */
.header-box {
    width: 100%;
    border: 2px dashed #28a745;
    box-sizing: border-box;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white !important;
    min-height: 80px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.header-box img {
    box-shadow: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

.left-image, .right-image {
    max-height: 50px;
    height: auto;
    margin: 10px;
}

/* --- TITOLI --- */
h1 {
    color: var(--secondary);
    text-align: center;
    border-bottom: 3px solid var(--accent);
    padding-bottom: 1rem;
    font-size: 1.8em;
    letter-spacing: 0.05em;
}

h2 {
    color: var(--primary);
    margin-top: 2rem;
    padding-left: 12px;
    border-left: 5px solid var(--accent);
    font-size: 1.2em;
    line-height: 1.8;
}

h2 .frac {
    font-size: 0.9em;
    margin: 0 2px;
}

h2 .exp {
    font-size: 0.7em;
}

/* --- ISTRUZIONI --- */
.instruction-box {
    background-color: #e8f5e9;
    border-left: 5px solid #2e7d32;
    padding: 15px 20px;
    margin: 20px auto;
    border-radius: 4px;
    font-size: 1em;
    color: #1b5e20;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    line-height: 1.8;
}

/* --- BOTTONI --- */
button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0.5rem;
    font-weight: 600;
    font-size: 0.9em;
    font-family: 'Verdana', Arial, sans-serif;
}
button:hover {
    transform: translateY(-3px);
    background: #3498db;
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.5);
}

.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 1.5rem 0;
}

/* --- SOLUZIONI --- */
.solution {
    display: none;
    margin: 1.5rem 0;
    padding: 1.8rem;
    background: var(--light);
    border-radius: 10px;
    border: 2px solid #c8e6c9;
    position: relative;
}

.solution::before {
    content: "📗";
    position: absolute;
    left: -15px;
    top: -15px;
    font-size: 1.5rem;
    background: white;
    padding: 5px;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* --- TESTO MATEMATICO --- */
.math {
    font-family: 'Verdana', 'Courier New', monospace;
    background: #f8fdf8;
    padding: 1.2rem;
    border-radius: 8px;
    margin: 1rem 0;
    white-space: pre-wrap;
    font-size: 1.05em;
    line-height: 1.9;
    border-left: 4px solid #a5d6a7;
}

.method-header {
    color: var(--secondary);
    font-size: 1.2em;
    margin-bottom: 1rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- MATH FUNC --- */
.math-func {
    font-family: "Cambria Math", "Times New Roman", serif;
    font-size: 1.1em;
    vertical-align: middle;
}

.frac {
    display: inline-block;
    vertical-align: middle;
    text-align: center;
    margin: 0 0.2em;
}

.frac sup, .frac sub {
    display: block;
    font-size: 0.8em;
    line-height: 1.1;
}

.frac sup {
    border-bottom: 1px solid;
    padding-bottom: 1px;
}

.exp {
    font-size: 0.85em;
    vertical-align: super;
}

.math-func .exp {
    font-size: 0.75em;
    vertical-align: super;
    position: relative;
    top: -0.1em;
}

.math-func .frac {
    font-size: 0.85em;
    vertical-align: middle;
    margin: 0 0.1em;
}

.math-func sup, .math-func sub {
    font-size: 0.7em;
    line-height: 1;
}

/* --- IMMAGINI --- */
img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1rem auto;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-box img {
    box-shadow: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

.centrato {
    text-align: center;
}

/* --- SEPARATORI --- */
.separatore-verde {
    border: none;
    height: 2px;
    background: linear-gradient(to right, #2e7d32, #a5d6a7);
    margin: 20px auto;
    max-width: 1100px;
}

hr {
    border: none;
    height: 1px;
    background: linear-gradient(to right, #2e7d32, #a5d6a7);
    width: 100%;
    max-width: 1100px;
    margin: 20px auto;
}

/* --- FOOTER --- */
.footer {
    text-align: center;
    margin-top: 0px;
    padding-top: 10px;
}

/* --- BOTTONE INDICE --- */
#btn-indice {
    background: #800020;
}

#btn-indice:hover {
    background: #a00028;
    box-shadow: 0 8px 20px rgba(128, 0, 32, 0.5);
}

/* --- BOTTONE STAMPA --- */
button.stampa {
    background-color: #9C27B0 !important;
    border: 2px solid #7B1FA2 !important;
    color: white !important;
}

button.stampa:hover {
    background-color: #BA68C8 !important;
    border-color: #9C27B0 !important;
    box-shadow: 0 8px 20px rgba(156, 39, 176, 0.4) !important;
    transform: translateY(-2px);
}

/* --- STAMPA --- */
@media print {
    body { background: white; padding: 0; }
    .container { width: 100%; max-width: 100%; box-shadow: none; border: none; }
    .solution {
        display: block !important;
        border: 1px solid #ccc !important;
    }
    button, .footer, .button-group { display: none !important; }
    .separatore-verde, hr { background: #ccc; }
}

/* --- RESPONSIVE --- */
@media (max-width: 600px) {
    .header-box {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }
    .container {
        padding: 1rem;
    }
    h1 { font-size: 1.4em; }
    h2 { font-size: 1.1em; }
    .button-group {
        flex-direction: column;
    }
    button {
        width: 100%;
    }
}
.footer button {
    padding: 8px 16px !important;
    font-size: 0.9em !important;
}
