﻿/* Stili specifici del form: i token e i componenti base arrivano da nuova-grafica.css */

.form-progress-label { margin: 0; font-size: 0.9375rem; color: var(--forest-soft); font-variant-numeric: tabular-nums; }
.form-progress-label span { color: var(--cream); font-weight: 600; }
.scroll-progress { transition: transform .5s var(--ease-out); }

.form-intro {
    background: var(--forest);
    color: var(--cream);
    padding-block: clamp(24px, 4vw, 48px) calc(clamp(40px, 5vw, 64px) + var(--radius));
}
.form-intro .lead { margin-top: 16px; color: var(--forest-soft); }

.form-page {
    position: relative;
    margin-top: calc(var(--radius) * -1);
    padding-block: clamp(40px, 5vw, 72px) calc(clamp(64px, 8vw, 104px) + var(--radius));
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--mist);
}
.form-layout {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    gap: clamp(32px, 5vw, 72px);
    align-items: start;
}

/* Indice delle sezioni */
.form-steps { position: sticky; top: 88px; }
.form-steps ol { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.form-steps a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 10px;
    border-radius: 10px;
    color: var(--ink-soft);
    font-size: 0.9375rem;
    line-height: 1.3;
    text-decoration: none;
    transition: background-color .2s ease, color .2s ease;
}
.form-steps a:hover { background: var(--sage); color: var(--ink); }
.form-steps span {
    position: relative;
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    transition: background-color .25s ease, border-color .25s ease, color .25s ease;
}
.form-steps a[aria-current="true"] { background: var(--sage); color: var(--ink); font-weight: 600; }
.form-steps li.is-done span { border-color: #34601a; background: #34601a; color: transparent; }
.form-steps li.is-done span::after {
    content: "";
    position: absolute;
    top: 7px;
    left: 6px;
    width: 12px;
    height: 6px;
    border-bottom: 2px solid #fff;
    border-left: 2px solid #fff;
    transform: rotate(-45deg);
    animation: step-done .35s var(--ease-back) both;
}
@keyframes step-done { from { transform: rotate(-45deg) scale(0); } }

/* Sezioni e domande */
.form-section { scroll-margin-top: 88px; }
.form-section + .form-section { margin-top: clamp(48px, 6vw, 80px); }
.form-section h2 { margin-bottom: 24px; font-size: clamp(1.625rem, 2.8vw, 2.25rem); }
.question {
    position: relative;
    padding: clamp(20px, 3vw, 28px);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(18, 41, 27, .06);
}
.question + .question { margin-top: 14px; }
.question-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    margin-bottom: 18px;
}
.question-head img { flex: none; width: 44px; height: 44px; object-fit: contain; }
.question-head h3 { flex: 1 1 0; min-width: 0; font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }

.hint { flex: 0 1 auto; margin-left: auto; }
.hint[open] { flex-basis: 100%; order: 3; margin-left: 0; }
.hint summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    color: var(--link);
    font-size: 0.875rem;
    font-weight: 600;
    list-style: none;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
}
.hint summary::-webkit-details-marker { display: none; }
.hint summary:hover, .hint[open] summary { background: #34601a; color: #fff; }
.hint[open] summary { float: right; margin-left: 12px; }
.hint p {
    margin: 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--mist);
    color: var(--ink-soft);
    font-size: 0.9375rem;
    line-height: 1.5;
    animation: panel-down .25s var(--ease-out) both;
}

/* Opzioni a scelta */
.options { position: relative; display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.options input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.options label {
    display: inline-block;
    padding: 10px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font-size: 0.9375rem;
    line-height: 1.3;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .2s var(--ease-out);
}
.options label:hover { border-color: var(--ink); background: var(--mist); }
.options label:active { transform: scale(.97); }
.options input:focus-visible + label { outline: 2px solid var(--link); outline-offset: 2px; }
.options input:checked + label { border-color: var(--forest); background: var(--forest); color: var(--cream); animation: option-pop .3s var(--ease-back); }
@keyframes option-pop { from { transform: scale(.94); } }

/* Campi di testo */
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.field { position: relative; }
.combo-native { position: absolute; bottom: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.combo { position: relative; }
.combo::after {
    content: "";
    position: absolute;
    top: 21px;
    right: 18px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--link);
    border-bottom: 2px solid var(--link);
    transform: rotate(45deg);
    pointer-events: none;
    transition: transform .25s var(--ease-out), top .25s var(--ease-out);
}
.combo.is-open::after { top: 25px; transform: rotate(225deg); }
.field .combo-input { padding-right: 44px; text-overflow: ellipsis; appearance: none; }
.combo-input::-webkit-search-cancel-button { display: none; }
.combo-input::placeholder { color: var(--ink-soft); opacity: 1; }
.combo-list {
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 280px;
    margin: 0;
    padding: 6px;
    overflow-y: auto;
    list-style: none;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(18, 41, 27, .18);
    animation: panel-down .2s var(--ease-out) both;
}
.combo-list[hidden] { display: none; }
.combo-list [role="option"] {
    padding: 9px 12px;
    border-radius: 9px;
    line-height: 1.3;
    cursor: pointer;
}
.combo-list [role="option"]:hover, .combo-list [role="option"].is-active { background: var(--mist); }
.combo-list [role="option"][aria-selected="true"] { background: var(--forest); color: var(--cream); }
.combo-list [role="option"][aria-selected="true"] mark { color: inherit; }
.combo-list mark { background: none; color: var(--link); font-weight: 700; }
.combo-empty { padding: 9px 12px; color: var(--ink-soft); }
.question:focus-within { z-index: 5; }
.field-number {
    display: block;
    width: 100%;
    padding: 13px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background-color: #fff;
    color: var(--ink);
    font: inherit;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.field-number { max-width: 220px; }
.field-number:focus { border-color: var(--lime); outline: 0; box-shadow: 0 0 0 3px rgba(124, 183, 65, .35); }
.field input { background: #fff; }
.field-error { margin: 12px 0 0; color: #a52a1e; font-size: 0.9375rem; }
.question-action { margin-top: 22px; }
.consent { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; }
.consent input { flex: none; width: 18px; height: 18px; margin: 4px 0 0; accent-color: #34601a; }

/* Messaggi e attesa */
#messageBox { margin-top: 20px; scroll-margin-top: 100px; }
.alert { margin-top: 14px; padding: 14px 18px; border-radius: 12px; font-size: 0.9375rem; line-height: 1.6; }
.alert-success { background: #e3efd2; color: #24471a; }
.alert-info { background: var(--sage); color: var(--ink); }
.alert-danger { background: #fbe6e2; color: #7f2015; }
.alert-danger a { color: inherit; }
.spinner { padding-block: 24px; text-align: center; scroll-margin-top: 120px; }
.spinner span {
    display: inline-block;
    width: 36px;
    height: 36px;
    border: 3px solid var(--line);
    border-top-color: #34601a;
    border-radius: 50%;
    animation: art-spin .9s linear infinite;
}

/* Finestra di pagamento */
.dialog-wide { width: min(720px, calc(100vw - 32px)); }
.dialog-subtitle { margin: 24px 0 12px; font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; }
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.plan {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    text-align: center;
}
.plan-free { cursor: pointer; transition: transform .25s var(--ease-out), border-color .2s ease; }
.plan-free:hover { border-color: var(--ink); transform: translateY(-3px); }
.plan-pro { border-color: var(--forest); background: var(--forest); color: var(--cream); }
.plan-name { font-weight: 600; }
.plan-price { font-size: 2rem; font-weight: 400; letter-spacing: -0.03em; line-height: 1.1; }
.plan-note { font-size: 0.875rem; color: var(--ink-soft); }
.plan form { margin-top: 10px; }
.plan form input[type="image"] { max-width: 100%; }
.dialog .field { margin-top: 20px; }
.survey { margin-top: 20px; padding-top: 4px; border-top: 1px solid var(--line); }
.survey .options { margin-bottom: 8px; }
.survey .options h3 { flex-basis: 100%; }
.survey .btn { margin-top: 16px; }
.dialog-foot { margin-top: 22px; }

@media (max-width: 960px) {
    .form-layout { grid-template-columns: minmax(0, 1fr); }
    .form-steps {
        top: 66px;
        z-index: 10;
        margin-inline: -24px;
        padding: 8px 24px;
        background: var(--mist);
    }
    .form-steps ol { flex-direction: row; gap: 6px; overflow-x: auto; scrollbar-width: none; }
    .form-steps ol::-webkit-scrollbar { display: none; }
    .form-steps a { flex: none; padding: 4px; font-size: 0; gap: 0; }
    .form-steps a[aria-current="true"] { padding-right: 12px; gap: 8px; font-size: 0.875rem; white-space: nowrap; }
    .form-steps span { font-size: 0.75rem; }
    .form-section { scroll-margin-top: 130px; }
}

@media (max-width: 560px) {
    .form-steps { margin-inline: -16px; padding-inline: 16px; }
    .field-grid, .plans { grid-template-columns: minmax(0, 1fr); }
    .question-action { width: 100%; }
    .field-number { max-width: none; }
}
