/* ============================================================ */
/* STILE QUESTIONARIO 3 — OTTIMIZZATO (MODELLO P3)            */
/* ============================================================ */

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
    color: #333;
}

.container {
    max-width: 95%;
    width: 1200px;
    margin: 30px auto;
    padding: 20px;
    background-color: white;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    border-radius: 8px;
    box-sizing: border-box;
}

/* --- 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;
}

/* FIX: margin: 0 annulla il margin: 20px auto della regola generale img */
.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; }

/* --- TESTI E TITOLI --- */
.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; }
.separator { border: 0; height: 2px; background: linear-gradient(to right, transparent, #28a745, transparent); margin-bottom: 20px; }

/* --- QUESITI E SOLUZIONI --- */
.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);
}

.solution {
    display: block;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s ease;
    background-color: white;
    padding: 0 20px;
    border-left: 4px solid #28a745;
}

.solution.show {
    opacity: 1;
    max-height: none;
    padding: 15px 20px;
    margin: 15px 0;
}

/* --- 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: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.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%;
}

.solution-button-container {
    text-align: center;
    margin-top: 15px;
    margin-bottom: 15px;
}

.close-solution-container {
    text-align: center;
    padding: 15px 0;
}

button:hover { background-color: #81c784; transform: translateY(-2px); }
button.active-solution { background-color: #2196f3; color: white; border-color: #1976d2; }

/* --- CENTRATURA GRAFICI E IMMAGINI --- */
img {
    display: block;
    margin: 20px auto;
    max-width: 100%;
    height: auto;
}

/* --- OTTIMIZZAZIONE GRAFICI --- */
.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 --- */
#progress-box {
    position: fixed;
    top: 15px;
    right: 15px;
    background: #e3f2fd;
    border-left: 6px solid #0277bd;
    padding: 10px 16px;
    font-weight: 600;
    font-size: 1.05em;
    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.25em;
    font-weight: 700;
    color: #0277bd;
}

.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;
}
.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;
}.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;
}
@keyframes goldShine {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- 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;  /* ← aggiunge questo */
}
.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); }

/* --- RESPONSIVE SMARTPHONE --- */
@media (max-width: 768px) {
    .container { width: 98%; padding: 15px; margin-top: 15px; }

    button {
        width: auto; min-width: 200px; display: block;
        margin: 10px auto; padding: 14px 0;
    }

    /* FIX: i bottoni footer non devono ereditare padding: 14px 0 dalla regola button mobile */
    .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; }

    /* --- ADATTAMENTO MOBILE PROGRESS BOX --- */
    #progress-box {
        font-size: 11px;
        padding: 3px 6px;
        top: 4px;
        right: 4px;
        max-width: 140px;
        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 { max-height: none !important; opacity: 1 !important; }
}
