/* ============================================================
   stile-compiti-v3.css
   Foglio di stile v3 per i Compiti in classe.
   
   ============================================================ */

:root {
    --green: #009966;
    --green-dk: #009966;
    --green-title: #009966;
    --border-green: #009900;
    --green-lt: #f0fdf4;
    --bordeaux: #800020;
    --border: #dbe4dc;
    --text: #2c3e50;
    --muted: #666;
    --bg: #f8f9fa;
    --radius: 8px;
    --container: 1000px;
}
* { box-sizing: border-box; }
html { overflow-y: scroll; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 10px;
    background-color: var(--bg);
    color: var(--text);
}

/* ---------- Header ---------- */
.page-wrap {
    max-width: var(--container);
    margin: 0 auto;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    padding: 20px;
}
.header-box {
    width: 100%;
    border: 2px dashed var(--border-green);
    box-sizing: border-box;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    border-radius: 6px;
    margin-bottom: 15px;
    cursor: pointer;
    gap: 15px;
}
.header-box .brand-left { display: flex; align-items: center; gap: 8px; }
.header-box .brand-left img { height: 50px; width: auto; }
.header-box .brand-left .site-url { font-size: 0.85rem; color: #555; font-weight: 600; white-space: nowrap; }
.header-box .brand-right { display: flex; align-items: center; gap: 14px; }
.header-box .brand-right .logo-block { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.header-box .brand-right img { height: 50px; width: auto; }
.header-box .brand-right .since { font-size: 0.78rem; color: #999; font-style: italic; }

.breadcrumb { font-size: 0.9rem; color: var(--muted); margin: 0 0 20px; }
.breadcrumb a { color: var(--green-dk); text-decoration: none; font-weight: 600; }
.breadcrumb a:hover { text-decoration: underline; }

/* ---------- Nav principale ---------- */
.main-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 0 0 25px;
    padding: 5px;
    border: 1px solid var(--border-green);
    border-radius: 8px;
    background: #f4f7f5;
}
.main-menu a {
    color: var(--text);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}
.main-menu a:hover { background: var(--green); color: white; }
.main-menu a.current { background: var(--green); color: white; }
.main-menu a.current:hover { background: var(--green); }

.main-page-title {
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    margin: 6px 0 8px;
    color: var(--green-title);
}

.page-intro {
    background-color: var(--green-lt);
    border: 1px solid var(--border);
    border-left: 4px solid var(--green);
    padding: 15px 20px;
    margin-bottom: 25px;
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.6;
    text-align: left;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

/* ---------- Sottotitolo argomenti trattati ---------- */
.argomenti-compito {
    text-align: center;
    font-style: italic;
    color: var(--muted);
    margin-bottom: 25px;
    font-size: 0.95rem;
}

/* ---------- Esercizio ---------- */
.exercise-block { margin-bottom: 28px; }
.exercise-block h2 {
    color: var(--green-dk);
    font-size: 1.3rem;
    padding-bottom: 6px;
}

.fade-green {
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--green), transparent);
    margin: 15px 0;
}

/* Box testo esercizio (azzurrino, come nei questionari) */
.question-body {
    background-color: #f0f7ff;
    border: 1px solid #d0e3ff;
    border-left: 3px solid #007bff;
    padding: 15px 20px;
    border-radius: 4px 8px 8px 4px;
    margin: 15px 0 25px 0;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.02);
}
.question-body p { margin: 10px 0; font-size: 1.05rem; line-height: 1.6; color: #2c3e50; }
.question-body p:first-child { margin-top: 0; }
.question-body p:last-child { margin-bottom: 0; }

/* Riga di controlli (bottone Soluzione) */
.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
@media print { .controls { display: none !important; } }

/* Bottone "Soluzione Esercizio N" */
.solution-button {
    background-color: white;
    color: #2e7d32;
    border: 2px solid #2e7d32;
    padding: 10px 20px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    margin: 8px 4px;
    cursor: pointer;
    border-radius: 25px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    font-weight: 600;
}
.solution-button:hover {
    background-color: #2e7d32;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(46,125,50,0.3);
}

.solution-container { display: none; }
.solution {
    background-color: #f8f9fa;
    padding: 15px 15px 15px 25px;
    margin: 15px 0 15px 8px;
    border-left: 4px solid #0000FF;
    border-radius: 0 5px 5px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    position: relative;
}
.solution h3 { color: #2c3e50; margin-top: 0; margin-bottom: 10px; font-size: 1.2em; }
.solution .conclusion {
    background: var(--green-lt);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 16px;
    margin-top: 14px;
    font-weight: 600;
}

.btn-nascondi-top {
    background-color: white;
    color: #e65100;
    border: 2px solid #e65100;
    padding: 10px 20px;
    text-align: center;
    text-decoration: none;
    display: none;
    font-size: 14px;
    margin: 8px 4px;
    cursor: pointer;
    border-radius: 25px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    font-weight: 600;
}
.btn-nascondi-top:hover { background-color: #e65100; color: white; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(230,81,0,0.3); }

.btn-nascondi-wrap { text-align: center; }
.btn-nascondi {
    background-color: white;
    color: #e65100;
    border: 2px solid #e65100;
    padding: 10px 25px;
    cursor: pointer;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    display: inline-block;
    margin: 10px auto;
    transition: all 0.3s ease;
}
.btn-nascondi:hover { background-color: #e65100; color: white; box-shadow: 0 4px 8px rgba(230,81,0,0.3); transform: translateY(-2px); }

/* Formula box e grafico (riutilizzati dalle altre unità) */
.formula-box { margin: 15px 0; overflow-x: auto; overflow-y: hidden; }

/* Box di rimando alla teoria (azzurro, come nei questionari) */
.box-azzurro {
    background-color: #eaf3fb;
    border: 1px solid var(--border);
    padding: 12px 20px;
    margin: 15px 0;
    border-radius: var(--radius);
    font-size: 0.95rem;
}
.box-azzurro a { color: #007bff; font-weight: 600; text-decoration: none; }
.box-azzurro a:hover { text-decoration: underline; }
.graph {
    text-align: center;
    margin: 20px auto;
    padding: 15px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
    max-width: 500px;
}
.graph img { max-width: 100%; height: auto; border-radius: 5px; }
/* Variante per grafici "a due pannelli" (es. funzione + sua trasformata affiancate) */
.graph.graph-wide { max-width: 800px; }
.graph-caption { font-size: 0.9em; font-style: italic; color: #555; margin-top: 10px; }

/* ---------- Blocco codice multilinguaggio ---------- */
.code-langs { margin: 20px 0; }
.code-lang-block { margin-bottom: 25px; }
.code-lang-block h5 { margin-bottom: 8px; }
.code-lang-block.cpp h5 { color: #00599c; }
.code-lang-block.pascal h5 { color: #24305e; }
.code-lang-block.python h5 { color: #3776ab; }
.code-lang-block.c h5 { color: #5c6bc0; }
.code-lang-block pre {
    background: #f4f4f4;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    font-size: 0.9em;
}
.code-lang-block .btn-esegui { font-weight: bold; text-decoration: none; }
.code-lang-block.cpp .btn-esegui { color: #00599c; }
.code-lang-block.pascal .btn-esegui { color: #24305e; }
.code-lang-block.python .btn-esegui { color: #3776ab; }
.code-lang-block.c .btn-esegui { color: #5c6bc0; }

/* ---------- Footer buttons ---------- */
.footer-buttons-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 30px 0 20px; }
.btn-footer-bordeaux, .btn-footer-arancio, .btn-footer-viola {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 190px;
    max-width: 44vw;
    min-height: 38px;
    padding: 7px 10px;
    border-radius: 8px;
    background: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.85em;
    text-align: center;
    transition: all 0.25s ease;
    box-shadow: 0 3px 7px rgba(0,0,0,0.1);
    box-sizing: border-box;
    cursor: pointer;
}
.btn-footer-bordeaux { color: var(--bordeaux); border: 2px solid var(--bordeaux); }
.btn-footer-arancio  { color: #ff9800; border: 2px solid #ff9800; }
.btn-footer-viola    { color: #9c27b0; border: 2px solid #9c27b0; }
.btn-footer-bordeaux:hover { background: var(--bordeaux); color: white; transform: translateY(-2px); }
.btn-footer-arancio:hover  { background: #ff9800; color: white; transform: translateY(-2px); }
.btn-footer-viola:hover    { background: #9c27b0; color: white; transform: translateY(-2px); }
@media (max-width: 480px) {
    .btn-footer-bordeaux, .btn-footer-arancio, .btn-footer-viola { max-width: 92vw; }
}
@media print { .footer-buttons-row { display: none !important; } }

/* Freccia torna su */
#btn-top {
    position: fixed;
    bottom: 20px;
    right: 4px;
    background: #9C27B0;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: background 0.2s;
}
#btn-top:hover { background: #7a00cc; }

/* ---------- Footer ---------- */
footer { margin-top: 16px; padding-top: 20px; border-top: 2px solid #ddd; text-align: center; font-size: 0.88rem; color: #555; }
.license-box { background-color: #fafafa; border: 1px solid #eee; border-radius: 8px; padding: 15px; margin-top: 20px; font-size: 0.8rem; color: #777; }
.validation-link { margin-top: 15px; font-size: 0.8rem; color: #999; }
.validation-link a { color: #999; text-decoration: none; }
.validation-link a:hover { text-decoration: underline; }
footer p { margin: 0; }

@media print {
    #btn-top, .main-menu, footer, .solution-button, .btn-nascondi { display: none !important; }
    .solution-container { display: block !important; }
}

@media (min-width: 768px) {
    body { padding: 30px 20px; }
    .page-wrap { padding: 30px; }
    .main-page-title { font-size: 2.2rem; }
}


/* Box verdino per i casi particolari */
.box-verde {
    background-color: var(--green-lt);
    border: 1px solid var(--border-green);
    padding: 12px 20px;
    margin: 15px 0;
    border-radius: var(--radius);
    font-size: 0.95rem;
}
.box-verde p { margin: 0 0 8px 0; }
.box-verde ul { margin: 0; padding-left: 20px; }
.box-verde li { margin-bottom: 8px; }