/* ==========================================================================
   BASE RESET & CORPO PAGINA
   ========================================================================== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #f1f5f9;
    margin: 0;
    padding: 40px 20px;
    text-align: center;
    color: #334155;
}

.container {
    max-width: 1150px;
    margin: 0 auto;
    background: #ffffff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

h1,
h2,
h3,
h4 {
    color: #0f172a;
    margin-top: 0;
}

.progress-indicator {
    display: inline-block;
    font-weight: 600;
    color: #2563eb;
    background-color: #eff6ff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.scenario-intro-box {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 15px 25px;
    border-radius: 8px;
    margin: 0 auto 30px auto;
    max-width: 800px;
    font-size: 1.1rem;
    color: #166534;
    font-style: italic;
    text-align: center;
}

/* ==========================================================================
   LAYOUT SCENARI
   ========================================================================== */
.study-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 30px 0;
    align-items: stretch;
}

.list-column {
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}

.column-header {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1e293b;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #cbd5e1;
    text-align: center;
}

.products-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    justify-content: flex-start;
    margin-bottom: 30px;
}

/* ==========================================================================
   CARD PRODOTTO
   ========================================================================== */
.product-card {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 12px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    text-align: left;
    flex: 0 0 auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    box-sizing: border-box;
}

.card-img-wrapper {
    width: 110px;
    /* Aumentato da 65px */
    height: 110px;
    /* Aumentato da 65px */
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 6px;
    padding: 2px;
}

.product-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-info {
    flex-grow: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 100%;
}

.product-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: #334155;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.product-rating {
    font-size: 0.75rem;
    color: #64748b;
}

/* ETICHETTE */
.badge-wrapper {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-top: auto;
    padding-top: 6px;
    border-top: 1px dashed #cbd5e1;
}

.eco-label-icon {
    width: 25px !important;
    height: 25px !important;
    object-fit: contain;
    cursor: help;
}

.quartile-badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 0.70rem;
    font-weight: bold;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-dark-green {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.badge-light-green {
    background-color: #fef9c3;
    color: #166534;
    border: 1px solid #fef08a;
}

.badge-black {
    background-color: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.badge-red {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Classe per pareggiare le altezze delle card della Lista A */
.invisible-placeholder {
    visibility: hidden;
    pointer-events: none;
}

/* ==========================================================================
   QUESTIONARI
   ========================================================================== */
.list-questionnaire {
    margin-top: auto;
    padding-top: 20px;
    border-top: 2px solid #cbd5e1;
    text-align: left;
}

.list-questionnaire h4 {
    margin-bottom: 15px;
    color: #2563eb;
    font-size: 1.05rem;
    font-weight: 700;
}

.list-questionnaire .q-item {
    margin-bottom: 25px;
    font-size: 0.95rem;
    color: #334155;
    text-align: left;
}

.list-questionnaire .q-item p {
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 12px;
    line-height: 1.4;
}

/* SCALE LIKERT CON ETICHETTE INFERIORI */
.likert-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    height: 100%;
}

.likert-group {
    display: flex;
    justify-content: flex-start;
    gap: 15px;
    margin-top: 5px;
}

/* Modifica per centrare i Likert group nei blocchi generici (NEP, Eval) */
.questionnaire-box .likert-group,
#step-1 .likert-group,
#step-3 .likert-group {
    justify-content: center;
}

.likert-label-under {
    font-size: 0.75rem;
    color: #64748b;
    text-align: center;
    max-width: 70px;
    line-height: 1.1;
    display: inline-block;
    width: 100%;
    padding-top: 5px;
}

.likert-group label.likert-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 500;
    color: #334155;
    min-width: 45px;
}

.likert-group label.likert-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.likert-group input[type="radio"] {
    margin-right: 6px;
    cursor: pointer;
    accent-color: #2563eb;
}

/* SCELTA PRODOTTO & MOTIVAZIONE */
.product-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #ffffff;
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 8px;
}

.product-radio {
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    line-height: 1.4;
    color: #475569;
    text-align: left;
}

.product-radio input {
    margin-top: 3px;
    margin-right: 12px;
    flex-shrink: 0;
    accent-color: #2563eb;
}

/* NUOVI CHECKBOX MULTIPLI PER MOTIVAZIONE */
.motivation-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8fafc;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
}

.motivation-checkbox {
    font-size: 0.85rem;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.motivation-checkbox input[type="checkbox"] {
    margin-right: 10px;
    accent-color: #2563eb;
}

/* COMPARISON */
.questionnaire-box {
    margin-top: 40px;
    padding: 30px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    text-align: center;
}

.comp-item {
    margin: 20px 0;
    padding: 20px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    text-align: center;
}

.comp-item p {
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 0.95rem;
    color: #0f172a;
    text-align: center;
}

.comp-item label {
    display: inline-flex;
    align-items: center;
    margin: 5px 15px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #334155;
}

.comp-item input[type="radio"] {
    margin-right: 8px;
    accent-color: #2563eb;
}

.comp-radio-group {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: center;
}

#step-2 .questionnaire-box {
    text-align: left;
}

#step-2 .comp-item {
    text-align: left;
}

#step-2 .comp-item p {
    text-align: left;
}

#step-2 .comp-item label {
    margin: 5px 25px 5px 0;
}

#step-2 .comp-radio-group {
    justify-content: flex-start;
}

#step-2 .likert-group {
    justify-content: flex-start;
}

.questionnaire-box h3 {
    text-align: center;
}

/* FORM & BUTTONS */
.form-group {
    text-align: left;
    max-width: 450px;
    margin: 30px auto;
    background: #f8fafc;
    padding: 25px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.form-group label {
    display: block;
    margin-top: 15px;
    font-weight: 600;
    font-size: 0.95rem;
    color: #334155;
}

.form-group select {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    background: #ffffff;
    color: #0f172a;
}

.btn-next,
.btn-submit {
    background: #2563eb;
    color: white;
    border: none;
    padding: 14px 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 600;
    margin-top: 20px;
    transition: background 0.2s ease, transform 0.1s ease;
    display: inline-block;
}

.btn-next:hover {
    background: #1d4ed8;
}

.btn-next:active,
.btn-submit:active {
    transform: scale(0.98);
}

.btn-submit {
    background: #10b981;
}

.btn-submit:hover {
    background: #059669;
}

.likert-table {
    text-align: center;
    margin-top: 20px;
}

.btn-center {
    display: block;
    margin: 20px auto 0 auto;
    /* Questo forza il centratura automatica */
}

/* FEATURE CHIPS */
.product-features-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    margin-bottom: 2px;
}

.feature-chip {
    background-color: #f1f5f9;
    color: #475569;
    font-size: 0.70rem;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
}

/* --- GRIGLIA SCELTA FINALE (6 ITEM) --- */
.final-choice-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.final-choice-card {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px 10px;
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.2s ease;
    background: white;
}

.final-choice-card:hover {
    border-color: #94a3b8;
    background-color: #f8fafc;
}

.final-choice-card input[type="radio"] {
    display: none;
}

.final-card-img-wrapper {
    width: 110px;
    height: 110px;
    margin-bottom: 10px;
}

.final-card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.final-card-title {
    font-size: 0.75rem;
    line-height: 1.3;
    color: #333;
    max-height: 2.6em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.final-choice-card.selected-card {
    border-color: #10b981;
    background-color: #ecfdf5;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.1);
}

/* ==========================================================================
   RESPONSIVE DESIGN MOBILE
   ========================================================================== */
@media (max-width: 800px) {
    body {
        padding: 10px 5px;
    }

    .container {
        padding: 15px 10px;
        border-radius: 8px;
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .study-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .likert-group {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: flex-start;
        width: 100% !important;
        box-sizing: border-box;
        padding: 0;
        gap: 10px !important;
    }

    .likert-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
        flex: 1 1 0;
        min-width: 0;
    }

    .likert-group label.likert-btn {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 6px 2px !important;
        margin: 0 !important;
        width: 100% !important;
        gap: 3px !important;
    }

    .likert-group label.likert-btn input[type="radio"] {
        margin: 0 !important;
        display: inline-block !important;
    }

    .likert-label-under {
        font-size: 0.6rem;
        line-height: 1.1;
        text-align: center;
        width: 100%;
        margin-top: 4px;
        word-wrap: break-word;
    }

    .comp-item,
    .form-group label,
    .comp-item p {
        word-break: break-word;
        white-space: normal;
        max-width: 100%;
        overflow-wrap: break-word;
    }

    .card-img-wrapper {
        width: 95px;
        /* Aumentato da 70px per il mobile */
        height: 95px;
        /* Aumentato da 70px per il mobile */
    }

    .final-choice-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .final-card-img-wrapper {
        width: 100px;
        /* Dimensione dedicata per gli schermi dei telefoni */
        height: 100px;
    }
}

/* --- SCHERMATA INTRODUTTIVA E RACCORDO --- */
.instruction-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 30px;
    max-width: 800px;
    margin: 20px auto 30px auto;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.instruction-box p {
    color: #475569;
    font-size: 1.05rem;
    line-height: 1.5;
}

.instruction-box h3 {
    margin-top: 25px;
    margin-bottom: 15px;
    color: #0f172a;
}

.task-instruction-text {
    text-align: center;
    font-weight: 600;
    color: #334155;
    /* Un grigio molto scuro per risaltare bene */
    margin-bottom: 25px;
    font-size: 1.1rem;
}

.final-choice-card .badge-wrapper {
    margin-top: auto;
    /* Spinge l'icona o il badge sul fondo della card, allineandoli perfettamente */
    padding-top: 8px;
}

/* ==========================================================================
   TOOLTIP CUSTOM PER ICONE ECO
   ========================================================================== */
.eco-tooltip-container {
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.eco-tooltip-text {
    visibility: hidden;
    background-color: #1e293b;
    /* Grigio molto scuro */
    color: #ffffff;
    text-align: center;
    padding: 6px 10px;
    border-radius: 6px;
    position: absolute;
    z-index: 10;
    bottom: 130%;
    /* Lo posiziona sopra l'icona */
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    white-space: nowrap;
    font-size: 0.75rem;
    font-weight: 500;
    pointer-events: none;
    /* Impedisce che il tooltip stesso blocchi il mouse */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Frecciolina sotto il tooltip */
.eco-tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1e293b transparent transparent transparent;
}

/* Mostra il tooltip quando si passa sopra al contenitore */
.eco-tooltip-container:hover .eco-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Mostra il tooltip anche quando viene aggiunta la classe .show via JS (per il touch su mobile) */
.eco-tooltip-container.show .eco-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Affianca Rating e Prezzo sulla stessa riga, vicini */
.product-meta {
    display: flex;
    justify-content: flex-start; /* Cambiato da space-between a flex-start */
    align-items: center;
    gap: 12px; /* Aggiungi questo per dare un po' di respiro tra i due */
    margin-top: 2px;
    margin-bottom: 4px;
}

/* Stile per il prezzo: nero e in grassetto */
.product-price {
    font-weight: 500; /* Abbassato da 700 a 500 */
    font-size: 0.95rem;
    color: #334155; /* Grigio ardesia invece del nero scuro #0f172a */
}

/* Stile per la descrizione: discreta, grigia e limitata a 2 righe massime */
.product-description {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Contenitore per allineare prezzo e rating nella scelta finale */
.final-card-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    width: 100%;
}

.final-card-price {
    font-size: 0.85rem;
    font-weight: 500;
    color: #334155;
}

.final-card-rating {
    font-size: 0.75rem;
    color: #64748b;
}