/* ============================================================ */
/* STILE QUESTIONARIO 4 — RESTYLING CON AIUTI (MODELLO DSA)   */
/* ============================================================ */

:root {
    --primary: #2c3e50;
    --secondary: #3498db;
    --accent: #e74c3c;
    --background: #f8f9fa;
    --border-color: #dee2e6;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--background);
    color: var(--primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- 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;
    min-height: 80px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.header-box img { height: auto; max-height: 50px; margin: 0; }
.left-image  { max-width: 250px; }
.center-image{ max-width: 50px; }
.right-image { max-width: 150px; }

/* --- CONTENITORE --- */
.container {
    max-width: 100%;
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    margin-bottom: 2.5rem;
    border: 1px solid var(--border-color);
    box-sizing: border-box;
}

/* --- TITOLI --- */
h1, h2, h3 {
    color: var(--primary);
    text-align: center;
    margin-bottom: 1.5rem;
}

.problem-title {
    font-size: 1.8em;
    font-weight: bold;
    text-align: center;
    margin: 25px 0;
    color: black;
}

.problem-text {
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 1.1em;
    color: #2c3e50;
    padding-left: 10px;
    line-height: 1.7;
}

.separator {
    border: 0;
    height: 2px;
    background: linear-gradient(to right, transparent, #28a745, transparent);
    margin-bottom: 20px;
}

/* --- QUESITI --- */
.question {
    background-color: #f8f9fa;
    padding: 20px;
    margin-bottom: 25px;
    border-radius: 12px;
    border-left: 4px solid #0000FF;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.question h3 {
    color: #0277bd;
    border-bottom: 2px solid #e3f2fd;
    text-align: center;
    padding-bottom: 8px;
}

/* --- SOLUZIONI --- */
.solution {
    display: none;
    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);
    overflow-x: auto;
}

.solution.show {
    display: block;
}

/* --- BOTTONI GENERALI --- */
button {
    background-color: #a5d6a7;
    color: black;
    border: 2px solid #81c784;
    padding: 10px 20px;
    font-size: 14px;
    margin: 8px 4px;
    cursor: pointer;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: inline-block;
    text-align: center;
}

button:hover {
    background-color: #1e88e5;
    color: white;
    border-color: #1565c0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

button.active-solution {
    background-color: #3498db;
    color: white;
    border-color: #2980b9;
}

button.active-solution:hover {
    background-color: #1976D2;
    border-color: #1565c0;
}

/* Override bottone stampa viola */
button.stampa,
button.stampa:not(:hover) {
    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 4px 12px rgba(156,39,176,0.4) !important;
    transform: translateY(-2px);
}

/* --- CONTENITORE BOTTONI (riga aiuto + soluzione) --- */
.controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 10px 0;
    align-items: center;
}

.solution-button-container {
    text-align: center;
    margin-top: 15px;
    margin-bottom: 15px;
}

.close-solution-container {
    text-align: center;
    padding: 15px 0;
}

/* --- BOTTONE AIUTO --- */
button.btn-aiuto {
    display: inline-block !important;
    padding: 10px 20px !important;
    margin: 8px 4px !important;
    border-radius: 25px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1) !important;
    background-color: #fff9db !important;
    color: #856404 !important;
    border: 2px solid #ffca28 !important;
    white-space: nowrap;
}

button.btn-aiuto:hover {
    background-color: #ffca28 !important;
    border-color: #ffa000 !important;
    color: #4e342e !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
}

button.btn-aiuto.is-active {
    background-color: #e3f2fd !important;
    color: #0d47a1 !important;
    border-color: #2196f3 !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1) !important;
}

/* --- BOX AIUTO (HINT) --- */
.hint {
    background-color: #e3f2fd !important;
    border-left: 5px solid #2196f3 !important;
    margin: 10px 0 !important;
    padding: 15px !important;
    border-radius: 8px !important;
    color: #0d47a1 !important;
    font-size: 0.95em !important;
    line-height: 1.6 !important;
    display: none;
}

.hint strong {
    color: #1565c0 !important;
    display: block;
    margin-bottom: 5px;
}

/* --- BOX ISTRUZIONE --- */
.instruction-box {
    background-color: #e8f5e9;
    border-left: 5px solid #2e7d32;
    padding: 15px;
    margin: 20px auto;
    border-radius: 4px;
    font-size: 0.9em;
    color: #1b5e20;
    display: block;
    text-align: left;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 90%;
}

/* --- BOX RISULTATI --- */
.result-box {
    background-color: #e8f5e9;
    border-left: 6px solid #2e7d32;
    padding: 15px;
    margin: 20px 0;
    border-radius: 6px;
    font-size: 1.05em;
    font-weight: 600;
    color: #1b5e20;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* --- TABELLE --- */
.solution table {
    border-collapse: collapse;
    margin: 15px auto;
}
.solution table th,
.solution table td {
    border: 1px solid #ccc;
    padding: 6px 12px;
    text-align: center;
}
.solution table thead {
    background-color: #e8f5e9;
    font-weight: bold;
}

/* --- GRAFICI E IMMAGINI --- */
img {
    display: block;
    margin: 20px auto;
    max-width: 100%;
    height: auto;
}

.graph {
    text-align: center;
    margin: 25px 0;
    padding: 15px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
}

.graph img {
    max-width: 400px;
    height: auto;
    border-radius: 5px;
}

.question img, .solution img {
    display: block;
    margin: 20px auto;
    max-width: 400px;
    width: 100%;
    height: auto;
    border: 1px solid #eee;
    border-radius: 4px;
}

/* --- BARRA DI AVANZAMENTO FISSA --- */
#progress-box {
    position: fixed;
    top: 15px;
    right: 15px;
    background: #e3f2fd;
    border-left: 6px solid #0277bd;
    padding: 10px 16px;
    font-weight: 600;
    font-size: 0.9em;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    white-space: nowrap;
    font-family: 'Segoe UI', Arial, sans-serif;
}

#progress-count {
    font-size: 1.1em;
    font-weight: 700;
    color: #0277bd;
}

#hint-count {
    font-weight: 700;
    color: #e65100;
}

.progress-container {
    width: 100%;
    height: 14px;
    background: #e0e0e0;
    border-radius: 8px;
    margin: 10px 0 0 0;
    overflow: hidden;
}

#progress-bar {
    height: 100%;
    width: 0%;
    background: #28a745;
    transition: width 0.4s ease, background 0.6s ease;
}

.gold-complete {
    background: linear-gradient(270deg, #ffd700, #ffec8b, #ffd700, #ffec8b) !important;
    background-size: 400% 400%;
    animation: goldShine 2s ease infinite;
}

@keyframes goldShine {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- FEEDBACK FINALE --- */
#feedback-box {
    margin: 30px 10px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
    text-align: center;
    font-size: 0.95em;
    border: 1px solid var(--border-color);
}

/* --- FOOTER --- */
.footer { text-align: center; margin-top: 40px; }

.btn-footer-bordeaux, .btn-footer-arancio, .btn-footer-viola, .btn-footer-blu {
    display: inline-flex; align-items: center; justify-content: center;
    width: 260px; height: 45px; background: white; margin: 5px;
    border-radius: 8px; text-decoration: none; font-weight: bold;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); transition: all 0.3s ease;
    padding: 0; vertical-align: middle; box-sizing: border-box;
}
.btn-footer-bordeaux { color: #7b1f2e; border: 2px solid #7b1f2e; }
.btn-footer-arancio  { color: #ff9800; border: 2px solid #ff9800; }
.btn-footer-viola    { color: #9c27b0; border: 2px solid #9c27b0; }
.btn-footer-blu      { color: #0277bd; border: 2px solid #0277bd; }

.btn-footer-bordeaux:hover { background: #7b1f2e; 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); }
.btn-footer-blu:hover      { background: #0277bd; color: white; transform: translateY(-2px); }

/* Miglioramento focus tastiera */
button:focus, a:focus {
    outline: 3px solid #ff9800;
    outline-offset: 2px;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    body { padding: 1rem; }

    button {
        width: auto; min-width: 200px; display: block;
        margin: 10px auto; padding: 14px 0;
    }

    .btn-aiuto {
        min-width: unset !important;
        width: auto !important;
        display: inline-block !important;
        padding: 10px 16px !important;
    }

    .controls { flex-direction: column; align-items: stretch; }

    .btn-footer-bordeaux, .btn-footer-arancio, .btn-footer-viola, .btn-footer-blu {
        padding: 0; width: 100%; max-width: 300px;
    }

    .footer { display: flex; flex-direction: column; align-items: center; }

    #progress-box {
        font-size: 11px; padding: 3px 6px;
        top: 4px; right: 4px; max-width: 150px;
        white-space: normal; border-left-width: 4px;
    }
    #progress-count { font-size: 13px; }
    .progress-container { height: 8px; margin: 4px 0 0 0; }
}

/* --- STAMPA --- */
@media print {
    #progress-box, button, .footer { display: none !important; }
    .solution { display: block !important; }
    /* Gli hint NON vengono mostrati in stampa */
}
