/* --- CSS SPECIFICO SIMULATORE SALTO DI CLASSE --- */
.static-quiz-container {
    background: var(--white);
    width: 100%;
    max-width: 800px; /* Più largo per la pagina dedicata */
    margin: 0 auto;
    border-radius: var(--border-radius);
    border: 1px solid #eee;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.modal-content {
    background: var(--white);
    width: 100%;
    max-width: 600px;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-close {
    position: absolute;
    top: 15px; right: 20px;
    background: none; border: none;
    font-size: 2rem; color: var(--text-light);
    cursor: pointer; z-index: 10;
}

.modal-header {
    padding: 1.5rem 2rem 1rem;
    background: var(--bg-light);
    border-bottom: 1px solid #eee;
}

.modal-header h2 { color: var(--primary-color); margin-bottom: 1rem; font-size: 1.25em;}
.modal-header h3 { color: var(--primary-color); margin-bottom: 1rem; }

.progress-container {
    width: 100%; height: 6px;
    background: #e0e0e0;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--secondary-color);
    width: 0%;
    transition: width 0.4s ease;
}

#step-counter { font-size: 0.85rem; color: var(--text-light); text-align: right; }

.modal-body {
    padding: 2rem;
    overflow-y: auto;
}

/* Stile Opzioni Quiz */
.quiz-option {
    display: block;
    padding: 15px;
    margin-bottom: 10px;
    border: 2px solid #eee;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s;
}

.quiz-option:hover { border-color: var(--secondary-color); background: #f0f7ff; }
.quiz-option.selected { border-color: var(--primary-color); background: #eefdf4; font-weight: 600; }

.modal-footer {
    padding: 1rem 2rem;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
}

.options-list {
    margin-top: .8rem;
}

/* Stile Risultati */
.result-box { text-align: center; animation: fadeIn 0.5s; }
.class-badge {
    font-size: 3rem; font-weight: 800;
    display: inline-block; padding: 10px 30px;
    border-radius: 10px; color: white; margin: 1rem 0;
    height: 97px;
    width: 97px;
}

.bg-G { background: #E30613; --class-color: #E30613; }
.bg-F { background: #EC6608; --class-color: #EC6608; }
.bg-E { background: #FBBA00; --class-color: #FBBA00; }
.bg-D { background: #FFED00; --class-color: #FFED00; }
.bg-C { background: #C6D300; --class-color: #C6D300; }
.bg-B { background: #52AD30; --class-color: #52AD30; }
.bg-A { background: #009640; --class-color: #009640; }

.class-message {
    font-weight: 500;
    background: #f0f7ff;
    border-left: 4px solid var(--class-color, var(--primary-color));
    padding: 0.75rem 1rem;
}

.intervention-list { text-align: left; margin-top: .5rem; }
.intervention-item {
    display: flex; gap: 15px;
    background: var(--bg-light);
    padding: 15px; margin-top: 10px; margin-bottom: 10px;
    border-radius: var(--border-radius);
    border-left: 5px solid var(--secondary-color);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* INIZIO SALTO CLASSE */
/* Override per il pulsante secondario NEL CONTESTO del simulatore */
.modal-footer .btn-secondary {
    background: #fff;
    color: var(--primary-color);
    box-shadow: inset 0 0 0 2px var(--primary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: .95rem;
}

.modal-footer .btn-secondary:hover {
    background: var(--primary-color);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Stile migliorato per gli interventi cliccabili */
.intervention-list .intervention-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-light);
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--secondary-color);
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    cursor: pointer;
}

.intervention-list .intervention-item:hover {
    border-left-color: var(--primary-color);
    background: #e8f5e9;
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.intervention-list .intervention-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.intervention-list .intervention-content {
    flex: 1;
}

.intervention-list .intervention-content strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--text-dark);
}

.intervention-list .intervention-content p {
    font-size: 0.9rem;
    margin: 0;
    color: var(--text-dark);
}

.intervention-list .intervention-arrow {
    font-size: 1.2rem;
    color: var(--primary-color);
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.intervention-list .intervention-item:hover .intervention-arrow {
    transform: translateX(5px);
}

/* Fix per il footer con doppio pulsante responsive */
.modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
/* FINE SALTO CLASSE */


/* INIZIO TECNOLOGIE */
/* Contenitore specifico per i 6 blocchi verticali */
.product-stack {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 3rem; /* Spazio tra i blocchi */
}

/* Gestione dello scroll quando si clicca un ID dal simulatore */
.product-card {
    /* Offset per la navbar (70px) + un margine di respiro (20px) */
    scroll-margin-top: calc(var(--navbar-height) + 20px);
}

/* CONTAINER PRINCIPALE DEL BLOCCO */
.product-stack .product-card {
    display: flex;
    flex-direction: row;
    height: 500px; /* Altezza forzata come richiesto */
    width: 100%;
    overflow: hidden; /* Taglia tutto ciò che esce */
    background: #fff;
    border: 1px solid #eee; /* Opzionale: bordo leggero */
    border-radius: 12px; /* Opzionale: angoli tondi */
}

/* PARTE SINISTRA: IMMAGINE */
.product-stack .product-img {
    flex: 0 0 40%; /* Occupa il 50% della larghezza */
    position: relative;
    height: 100%; /* Occupa tutta l'altezza di 500px */
}

.product-stack .product-img img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* FONDAMENTALE: riempie senza deformare */
}

/* PARTE DESTRA: CONTENUTO */
.product-stack .product-content {
    flex: 1; /* Prende il restante spazio */
    display: flex;
    flex-direction: column; /* Impila gli elementi verticalmente */
    padding: 3rem; /* Spaziatura interna abbondante */
    /* Se il testo è troppo lungo, evita che esca fuori o copra il bottone */
    overflow-y: auto; 
}

/* GESTIONE SPAZIATURE TESTI (In alto) */
.product-stack .category {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary-color);
    text-transform: uppercase;
}

.product-stack h3 {
    margin-bottom: 1.5rem;
    font-size: 1.8rem; /* Titolo bello grande visto lo spazio */
    line-height: 1.2;
}

.product-stack p {
    margin-bottom: 1rem;
    color: #555;
    line-height: 1.6;
    /* Non mettiamo margin-bottom fisso enorme, ci pensa il bottone a scendere */
}

/* IL BOTTONE (Sempre in basso) */
.product-stack .tecnologie-btn {
    margin-top: auto; /* <--- QUESTA è la magia che lo spinge in fondo */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    background: var(--primary-color);
    color: #fff;
    font-weight: 600;
    border-radius: 6px;
    min-width: 230px;
    width: fit-content; /* Il bottone non si allarga a tutto il blocco */
}
/* FINE TECNOLOGIE */

/* INIZIO ATTRIBUZIONE FOTO */
/* Stile per i crediti foto */
.product-stack .photo-credit {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 10;
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.8); /* Questo colora il testo "Foto di" */
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* HOVER sul LINK */
.product-stack .photo-credit a:hover {
    color: #fff;
}
/* FINE ATTRIBUZIONE FOTO */

/* Animazione icona info calcolatore*/
#info-icon {
    transition: transform 0.3s ease;
}

/* Stato aperto del contenuto */
#info-content.open {
    margin-bottom: 1rem;
    /* Il max-height viene settato dinamicamente via JS */
}

.servizio-item {
    transition: all 0.2s;
}

.servizio-item:hover {
    background: #e8f5e9 !important;
    transform: translateX(3px);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

/* Stile responsive */
@media (max-width: 768px) {
    #info-content div {
        font-size: 0.8rem !important;
        padding: 0.75rem !important;
    }
}

/* Responsive: su mobile TECNOLOGIE */
@media (max-width: 768px) {
    .product-stack .product-card {
        flex-direction: column; /* Immagine sopra, testo sotto */
        height: auto; /* SBLOCCA L'ALTEZZA FISSA: si adatta al contenuto */
        min-height: auto;
    }

    .product-stack .product-img {
        height: 200px; /* Altezza fissa solo per l'immagine su mobile */
        flex: none; /* Disattiva il 50% di larghezza */
        width: 100%;
    }

    .product-stack .product-content {
        padding: 2rem; /* Riduciamo un po' il padding su mobile */
    }
    
    .product-stack h3 {
        font-size: 1.5rem; /* Titolo leggermente più piccolo */
    }
    
    /* Il bottone avrà comunque un po' di margine sopra grazie al layout */
    .product-stack .tecnologie-btn {
        margin-top: 1.5rem; 
        width: 100%; /* Su mobile il bottone largo tutto lo schermo è più cliccabile */
    }
}

/* Responsive per mobile SALTO CLASSE */
@media (max-width: 768px) {
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer > div {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    .modal-footer .btn-cta,
    .modal-footer .btn-secondary,
    .modal-footer .btn-primary {
        width: 100% !important;
        flex: none !important;
    }
    
    .intervention-list .intervention-item {
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    .intervention-list .intervention-icon {
        font-size: 1.2rem;
        width: 35px;
    }
    
    .intervention-list .intervention-content strong {
        font-size: 0.95rem;
    }
    
    .intervention-list .intervention-content p {
        font-size: 0.85rem;
    }
    
    .intervention-list .intervention-arrow {
        font-size: 1rem;
    }
}

/* FIX MOBILE - HOVER PERSISTENTE SUI PULSANTI */

/* Disabilita hover su dispositivi touch e usa :active per feedback immediato */
@media (hover: none) and (pointer: coarse) {
    /* Disabilita completamente l'effetto hover sui pulsanti */
    .modal-footer .btn-secondary:hover {
        background: transparent !important;
        color: var(--text-dark) !important;
        transform: none !important;
        box-shadow: none !important;
    }
    
    .modal-footer .btn-primary:hover {
        transform: none !important;
    }
    
    /* Usa :active per dare feedback visivo quando si tocca */
    .modal-footer .btn-secondary:active {
        background: var(--primary-color);
        color: #fff;
    }
    
    .modal-footer .btn-primary:active {
        opacity: 0.9;
    }
}

/* Solo su desktop (con mouse reale) mostra l'hover */
@media (hover: hover) and (pointer: fine) {
    .modal-footer .btn-secondary:hover {
        background: var(--primary-color);
        color: #fff;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
}

/* Fix generici per tutti i dispositivi */
.modal-footer button {
    /* Rimuove tap highlight blu di Safari iOS */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Rimuove outline blu dopo il click */
.modal-footer button:focus {
    outline: none;
}
