/*
 * AirAffitti Valutatore Pro - design system premium del wizard e della
 * dashboard di risultato.
 *
 * Solo presentazione: nessuna classe qui e' legata a validazione o
 * invio dati (quelle vivono su attributi `name`/`data-*` invariati nel
 * template). Le variabili CSS con prefisso --aavp- SENZA suffisso
 * interno (--aavp-accent, --aavp-accent-2, --aavp-chart-*,
 * --aavp-transition-duration) sono l'unico punto scritto dai controlli
 * Elementor: non rinominarle. Tutte le altre (--aavp-ink, --aavp-*,
 * ecc.) sono token interni del design system, liberi da vincoli.
 */

.aavp-widget {
    /* Token esposti a Elementor (non rinominare) */
    --aavp-accent: #e85a4f;
    --aavp-accent-2: #ff8a65;
    --aavp-chart-min: #c9cdd6;
    --aavp-chart-avg: var(--aavp-accent);
    --aavp-chart-max: #16213e;
    --aavp-transition-duration: 400ms;

    /* Token interni del design system */
    --aavp-ink: #10121c;
    --aavp-ink-soft: #565b6e;
    --aavp-muted: #6b7085;
    --aavp-surface: #ffffff;
    --aavp-surface-soft: #f6f7fb;
    --aavp-border: #e7e8f0;
    --aavp-track: #edeef4;
    --aavp-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --aavp-shadow-sm: 0 1px 2px rgba(16, 18, 34, 0.05);
    --aavp-shadow-md: 0 10px 30px -8px rgba(16, 18, 34, 0.16);
    --aavp-shadow-lg: 0 24px 70px -12px rgba(16, 18, 34, 0.22);
    --aavp-radius-sm: 10px;
    --aavp-radius-md: 14px;
    --aavp-radius-lg: 22px;
    --aavp-gradient-accent: linear-gradient(135deg, var(--aavp-accent), var(--aavp-accent-2));
    --aavp-gradient-bar: linear-gradient(90deg, var(--aavp-accent), var(--aavp-accent-2));

    box-sizing: border-box;
    position: relative;
    container-type: inline-size;
    container-name: aavp;
    max-width: 620px;
    margin: 0 auto;
    padding: 30px;
    border-radius: var(--aavp-radius-lg);
    /*
     * Il washer decorativo e' un secondo layer di background (non un
     * elemento ::before separato): i background sono sempre ritagliati
     * al border-radius dell'elemento senza bisogno di overflow:hidden,
     * che altrimenti taglierebbe anche il box-shadow qui sotto.
     */
    background-color: var(--aavp-surface);
    background-image:
        radial-gradient(60% 60% at 25% 0%, color-mix(in srgb, var(--aavp-accent) 10%, transparent), transparent 70%),
        radial-gradient(50% 50% at 95% 0%, color-mix(in srgb, var(--aavp-accent-2) 8%, transparent), transparent 70%);
    background-repeat: no-repeat;
    box-shadow: var(--aavp-shadow-sm), var(--aavp-shadow-md);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
    color: var(--aavp-ink);
    -webkit-font-smoothing: antialiased;
}

.aavp-widget *,
.aavp-widget *::before,
.aavp-widget *::after {
    box-sizing: border-box;
}

.aavp-widget svg {
    display: block;
}

.aavp-icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* ---------- Hero ---------- */

.aavp-hero {
    margin-bottom: 22px;
}

.aavp-hero__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-bottom: 12px;
    border-radius: 10px;
    background: var(--aavp-gradient-accent);
    color: #ffffff;
    box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--aavp-accent) 55%, transparent);
}

.aavp-hero__badge .aavp-icon {
    width: 17px;
    height: 17px;
    stroke-width: 2;
}

.aavp-widget__title {
    margin: 0 0 6px;
    font-size: 1.44rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--aavp-ink);
}

.aavp-widget__subtitle {
    margin: 0;
    max-width: 46ch;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--aavp-ink-soft);
}

/* ---------- Progress / stepper ---------- */

.aavp-progress {
    margin-bottom: 22px;
}

.aavp-progress__steps {
    display: flex;
    justify-content: space-between;
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
}

.aavp-progress__step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
    text-align: center;
}

.aavp-progress__dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--aavp-track);
    color: var(--aavp-muted);
    font-size: 0.8rem;
    font-weight: 700;
    transition: background var(--aavp-transition-duration) var(--aavp-ease),
                color var(--aavp-transition-duration) var(--aavp-ease),
                transform var(--aavp-transition-duration) var(--aavp-ease),
                box-shadow var(--aavp-transition-duration) var(--aavp-ease);
}

.aavp-progress__label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--aavp-muted);
    transition: color var(--aavp-transition-duration) var(--aavp-ease);
    white-space: nowrap;
}

.aavp-progress__step--active .aavp-progress__dot {
    background: var(--aavp-gradient-accent);
    color: #ffffff;
    transform: scale(1.1);
    box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--aavp-accent) 55%, transparent);
}

.aavp-progress__step--active .aavp-progress__label {
    color: var(--aavp-ink);
}

.aavp-progress__step--done .aavp-progress__dot {
    background-color: var(--aavp-ink);
    color: #ffffff;
}

.aavp-progress__step--done .aavp-progress__label {
    color: var(--aavp-ink-soft);
}

.aavp-progress__track {
    position: relative;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background-color: var(--aavp-track);
    overflow: hidden;
}

.aavp-progress__fill {
    height: 100%;
    width: 25%;
    border-radius: 999px;
    background: var(--aavp-gradient-bar);
    transition: width calc(var(--aavp-transition-duration) * 1.4) var(--aavp-ease);
}

/* ---------- Error banner ---------- */

.aavp-error-banner {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: var(--aavp-radius-sm);
    background-color: #fdeeec;
    border: 1px solid #f6c9c3;
    color: #ac2b1f;
    font-size: 0.85rem;
    line-height: 1.4;
    animation: aavp-fade-in 240ms var(--aavp-ease) both;
}

/* ---------- Step transitions ---------- */

.aavp-step {
    animation-duration: var(--aavp-transition-duration);
    animation-timing-function: var(--aavp-ease);
    animation-fill-mode: both;
}

.aavp-widget[data-animation="fade"] .aavp-step--entering {
    animation-name: aavp-fade-in;
}

.aavp-widget[data-animation="slide"] .aavp-step--entering {
    animation-name: aavp-slide-in;
}

@keyframes aavp-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes aavp-slide-in {
    from { opacity: 0; transform: translateX(14px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Il focus programmatico sullo step (per screen reader/tastiera) non deve mostrare un riquadro intorno a tutta la sezione. */
.aavp-step:focus {
    outline: none;
}

.aavp-step__title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    font-size: 1.05rem;
    font-weight: 750;
    letter-spacing: -0.01em;
    color: var(--aavp-ink);
}

.aavp-step__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background-color: var(--aavp-surface-soft);
    color: var(--aavp-accent);
    flex-shrink: 0;
}

/* ---------- Fields ---------- */

.aavp-field {
    margin-bottom: 14px;
}

.aavp-field-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.aavp-field-row--3 {
    grid-template-columns: repeat(3, 1fr);
}

.aavp-field-row .aavp-field {
    margin-bottom: 14px;
}

.aavp-field__label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.78rem;
    font-weight: 650;
    color: var(--aavp-ink-soft);
}

.aavp-field__required {
    color: var(--aavp-accent);
}

.aavp-field__control {
    position: relative;
    display: flex;
    align-items: center;
}

.aavp-field__icon {
    position: absolute;
    left: 13px;
    display: flex;
    color: var(--aavp-muted);
    pointer-events: none;
    transition: color 0.2s ease;
}

.aavp-field__control:focus-within .aavp-field__icon {
    color: var(--aavp-accent);
}

.aavp-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--aavp-border);
    border-radius: var(--aavp-radius-sm);
    background-color: var(--aavp-surface-soft);
    color: var(--aavp-ink);
    font-size: 0.93rem;
    font-family: inherit;
    line-height: 1.3;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

/*
 * BUG FIX: prima questa regola era su `.aavp-input--icon` (stessa
 * specificita' della regola base `.aavp-input` sopra: una sola
 * classe). Con specificita' identica vince l'ultima dichiarata nel
 * file, un equilibrio fragile che si rompe facilmente (es. minifier,
 * concatenazione di file, o l'ordine con cui un futuro child theme
 * inietta altro CSS). Il selettore discendente sotto ha specificita'
 * strutturalmente piu' alta (due classi) e vince sempre, a
 * prescindere dall'ordine: l'icona non torna mai a sovrapporsi al
 * testo del campo.
 */
.aavp-field__control .aavp-input {
    padding-left: 40px;
}

.aavp-input::placeholder {
    color: var(--aavp-muted);
}

.aavp-input:hover {
    border-color: color-mix(in srgb, var(--aavp-accent) 35%, var(--aavp-border));
}

.aavp-input:focus {
    outline: none;
    border-color: var(--aavp-accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--aavp-accent) 14%, transparent);
    background-color: var(--aavp-surface);
}

.aavp-field--invalid .aavp-input {
    border-color: #d6483d;
    animation: aavp-shake 0.3s ease;
}

.aavp-field__error {
    display: none;
    margin-top: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    color: #d6483d;
}

.aavp-field--invalid .aavp-field__error {
    display: block;
}

@keyframes aavp-shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

/* ---------- Pill options (qualita', stagionalita') ---------- */

.aavp-pill-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.aavp-pill {
    position: relative;
    cursor: pointer;
}

.aavp-pill input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.aavp-pill span {
    display: inline-flex;
    align-items: center;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1.5px solid var(--aavp-border);
    background-color: var(--aavp-surface-soft);
    font-size: 0.83rem;
    font-weight: 650;
    color: var(--aavp-ink-soft);
    transition: all 0.18s ease;
}

.aavp-pill:hover span {
    border-color: var(--aavp-accent);
    color: var(--aavp-ink);
    transform: translateY(-1px);
}

.aavp-pill input:checked + span {
    background: var(--aavp-gradient-accent);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--aavp-accent) 60%, transparent);
}

.aavp-pill input:focus-visible + span {
    outline: 2px solid var(--aavp-accent);
    outline-offset: 2px;
}

/* ---------- Amenities chips ---------- */

.aavp-amenities {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
}

.aavp-amenity {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 12px;
    border-radius: var(--aavp-radius-sm);
    border: 1.5px solid var(--aavp-border);
    background-color: var(--aavp-surface-soft);
    font-size: 0.8rem;
    font-weight: 650;
    color: var(--aavp-ink-soft);
    cursor: pointer;
    transition: all 0.18s ease;
    overflow: hidden;
}

.aavp-amenity input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.aavp-amenity__icon {
    display: flex;
    color: var(--aavp-muted);
    transition: color 0.18s ease;
}

.aavp-amenity__label {
    flex: 1;
}

.aavp-amenity__check {
    display: flex;
    color: var(--aavp-accent);
    opacity: 0;
    transform: scale(0.6);
    transition: all 0.18s var(--aavp-ease);
}

.aavp-amenity:hover {
    border-color: color-mix(in srgb, var(--aavp-accent) 40%, var(--aavp-border));
    transform: translateY(-1px);
    box-shadow: var(--aavp-shadow-sm);
}

.aavp-amenity:has(input:checked) {
    background-color: color-mix(in srgb, var(--aavp-accent) 8%, var(--aavp-surface));
    border-color: var(--aavp-accent);
    color: var(--aavp-ink);
}

.aavp-amenity:has(input:checked) .aavp-amenity__icon {
    color: var(--aavp-accent);
}

.aavp-amenity:has(input:checked) .aavp-amenity__check {
    opacity: 1;
    transform: scale(1);
}

.aavp-amenity:has(input:focus-visible) {
    outline: 2px solid var(--aavp-accent);
    outline-offset: 1px;
}

/*
 * Fallback per browser senza supporto a :has() (fino a Safari 15.3,
 * Firefox 120): stessa resa visiva, applicata dalla classe che
 * assets/js/widget.js aggiunge/rimuove sul cambio checkbox.
 */
.aavp-amenity.aavp-amenity--checked {
    background-color: color-mix(in srgb, var(--aavp-accent) 8%, var(--aavp-surface));
    border-color: var(--aavp-accent);
    color: var(--aavp-ink);
}

.aavp-amenity.aavp-amenity--checked .aavp-amenity__icon {
    color: var(--aavp-accent);
}

.aavp-amenity.aavp-amenity--checked .aavp-amenity__check {
    opacity: 1;
    transform: scale(1);
}

/*
 * ---------- Honeypot anti-spam (invisibile, non fa parte del tab order) ----------
 * Stessa tecnica di .aavp-sr-only (clip a 1px, non spostamento fuori
 * schermo con left negativo): da quando .aavp-widget non ha piu'
 * overflow:hidden (vedi sopra, serviva a non tagliare il box-shadow),
 * un posizionamento off-screen qui creerebbe scroll orizzontale
 * indesiderato sulla pagina.
 */
.aavp-honeypot {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Utility accessibilita' ---------- */

.aavp-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Consent checkbox ---------- */

.aavp-consent {
    padding-top: 2px;
}

.aavp-checkbox {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.aavp-checkbox input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.aavp-checkbox__box {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    border-radius: 6px;
    border: 1.5px solid var(--aavp-border);
    background-color: var(--aavp-surface-soft);
    color: #ffffff;
    transition: all 0.18s var(--aavp-ease);
}

.aavp-checkbox__box .aavp-icon {
    width: 13px;
    height: 13px;
    stroke-width: 3;
    opacity: 0;
    transform: scale(0.6);
    transition: all 0.18s var(--aavp-ease);
}

.aavp-checkbox input:checked + .aavp-checkbox__box {
    background: var(--aavp-gradient-accent);
    border-color: transparent;
}

.aavp-checkbox input:checked + .aavp-checkbox__box .aavp-icon {
    opacity: 1;
    transform: scale(1);
}

.aavp-checkbox input:focus-visible + .aavp-checkbox__box {
    outline: 2px solid var(--aavp-accent);
    outline-offset: 2px;
}

.aavp-checkbox__text {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--aavp-ink-soft);
}

.aavp-checkbox__icon {
    color: var(--aavp-muted);
    margin-top: 2px;
}

/* ---------- Actions / buttons ---------- */

.aavp-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}

.aavp-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    padding: 15px 22px;
    border-radius: var(--aavp-radius-sm);
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: transform 0.16s var(--aavp-ease), box-shadow 0.16s var(--aavp-ease), opacity 0.16s ease, background-color 0.16s ease;
}

/*
 * BUG FIX: `display: inline-flex` sopra e' una dichiarazione d'autore,
 * che vince SEMPRE sulla regola dello user-agent stylesheet
 * `[hidden] { display: none }`, indipendentemente dalla specificita'.
 * Senza questa regola il pulsante "Indietro" (che in HTML ha
 * l'attributo `hidden` quando siamo sullo step 1) restava visibile.
 */
.aavp-btn[hidden] {
    display: none;
}

.aavp-btn__content {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.aavp-btn__icon {
    display: flex;
    transition: transform 0.22s var(--aavp-ease);
}

.aavp-btn--primary {
    margin-left: auto;
    min-width: 168px;
    background: var(--aavp-gradient-accent);
    color: #ffffff;
    box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--aavp-accent) 65%, transparent), var(--aavp-shadow-sm);
}

.aavp-btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px -8px color-mix(in srgb, var(--aavp-accent) 70%, transparent), var(--aavp-shadow-sm);
}

.aavp-btn--primary:hover .aavp-btn__icon {
    transform: translateX(3px);
}

.aavp-btn--primary:active {
    transform: translateY(0);
}

.aavp-btn--secondary {
    background-color: var(--aavp-surface-soft);
    color: var(--aavp-ink);
    border: 1.5px solid var(--aavp-border);
}

.aavp-btn--secondary:hover {
    border-color: color-mix(in srgb, var(--aavp-accent) 40%, var(--aavp-border));
    transform: translateY(-1px);
}

.aavp-btn--secondary:hover .aavp-btn__icon {
    transform: translateX(-2px);
}

.aavp-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.aavp-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    animation: aavp-spin 0.7s linear infinite;
}

/* Stesso bug di .aavp-btn sopra: senza questa regola lo spinner restava visibile (e animato) anche a riposo, con l'attributo hidden ignorato. */
.aavp-spinner[hidden] {
    display: none;
}

@keyframes aavp-spin {
    to { transform: rotate(360deg); }
}

/* ---------- Result dashboard ---------- */

.aavp-result {
    animation: aavp-fade-in var(--aavp-transition-duration) var(--aavp-ease) both;
}

.aavp-result__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.aavp-result__title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--aavp-ink);
}

.aavp-result__badge {
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--aavp-gradient-accent);
    color: #ffffff;
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--aavp-accent) 55%, transparent);
}

.aavp-result__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.aavp-result__card {
    padding: 16px;
    border-radius: var(--aavp-radius-md);
    background-color: var(--aavp-surface-soft);
    border: 1px solid var(--aavp-border);
    text-align: left;
    opacity: 0;
    transform: translateY(6px);
    animation: aavp-card-in 0.5s var(--aavp-ease) forwards;
}

.aavp-result__grid .aavp-result__card:nth-child(1) { animation-delay: 0.02s; }
.aavp-result__grid .aavp-result__card:nth-child(2) { animation-delay: 0.06s; }
.aavp-result__grid .aavp-result__card:nth-child(3) { animation-delay: 0.10s; }
.aavp-result__grid .aavp-result__card:nth-child(4) { animation-delay: 0.14s; }
.aavp-result__grid .aavp-result__card:nth-child(5) { animation-delay: 0.18s; }
.aavp-result__grid .aavp-result__card:nth-child(6) { animation-delay: 0.22s; }

@keyframes aavp-card-in {
    to { opacity: 1; transform: translateY(0); }
}

.aavp-result__card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-bottom: 10px;
    border-radius: 8px;
    background-color: var(--aavp-surface);
    color: var(--aavp-accent);
    box-shadow: var(--aavp-shadow-sm);
}

.aavp-result__card-label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--aavp-muted);
}

.aavp-result__card-value {
    font-size: 1.28rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--aavp-ink);
    line-height: 1.2;
}

.aavp-result__card--highlight {
    background: linear-gradient(155deg, color-mix(in srgb, var(--aavp-accent) 10%, var(--aavp-surface)), color-mix(in srgb, var(--aavp-accent-2) 10%, var(--aavp-surface)));
    border-color: color-mix(in srgb, var(--aavp-accent) 25%, var(--aavp-border));
}

.aavp-result__card--highlight .aavp-result__card-icon {
    background: var(--aavp-gradient-accent);
    color: #ffffff;
    box-shadow: none;
}

/* Grafico prezzo min/consigliato/max */

.aavp-result__chart {
    margin-bottom: 20px;
    padding: 16px;
    border-radius: var(--aavp-radius-md);
    background-color: var(--aavp-surface-soft);
    border: 1px solid var(--aavp-border);
}

.aavp-result__chart-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--aavp-ink);
}

.aavp-result__bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.aavp-result__bar-row:last-child {
    margin-bottom: 0;
}

.aavp-result__bar-label {
    flex: 0 0 84px;
    font-size: 0.76rem;
    font-weight: 650;
    color: var(--aavp-ink-soft);
}

.aavp-result__bar-track {
    flex: 1;
    height: 9px;
    border-radius: 999px;
    background-color: var(--aavp-track);
    overflow: hidden;
}

.aavp-result__bar-fill {
    height: 100%;
    border-radius: 999px;
    width: 0;
    transition: width 0.9s var(--aavp-ease);
}

.aavp-result__bar-fill--min { background-color: var(--aavp-chart-min); }
.aavp-result__bar-fill--avg { background-color: var(--aavp-chart-avg); }
.aavp-result__bar-fill--max { background-color: var(--aavp-chart-max); }

.aavp-result__bar-value {
    flex: 0 0 60px;
    text-align: right;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--aavp-ink);
}

/* Punteggio (gauge) + barra qualita' */

@property --aavp-score {
    syntax: "<number>";
    inherits: true;
    initial-value: 0;
}

.aavp-result__score-row {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 20px;
    padding: 16px;
    border-radius: var(--aavp-radius-md);
    background-color: var(--aavp-surface-soft);
    border: 1px solid var(--aavp-border);
}

.aavp-result__score-ring {
    --aavp-score: 0;
    flex: 0 0 88px;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: conic-gradient(var(--aavp-accent) calc(var(--aavp-score) * 1%), var(--aavp-track) 0);
    transition: --aavp-score 1.1s var(--aavp-ease);
}

.aavp-result__score-inner {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background-color: var(--aavp-surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--aavp-shadow-sm);
}

.aavp-result__score-value {
    font-size: 1.24rem;
    font-weight: 800;
    color: var(--aavp-ink);
    line-height: 1;
}

.aavp-result__score-max {
    font-size: 0.64rem;
    color: var(--aavp-muted);
}

.aavp-result__quality {
    flex: 1;
    min-width: 0;
}

.aavp-result__quality-label {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 650;
    color: var(--aavp-ink);
    margin-bottom: 8px;
}

.aavp-result__quality-track {
    height: 9px;
    border-radius: 999px;
    background-color: var(--aavp-track);
    overflow: hidden;
}

.aavp-result__quality-fill {
    height: 100%;
    border-radius: 999px;
    width: 0;
    background: var(--aavp-gradient-bar);
    transition: width 0.9s var(--aavp-ease);
}

/* Consigli automatici */

.aavp-result__recommendations {
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}

.aavp-result__recommendation {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 0;
    border-top: 1px solid var(--aavp-border);
    font-size: 0.84rem;
    line-height: 1.5;
    color: var(--aavp-ink-soft);
}

.aavp-result__recommendation:first-child {
    border-top: none;
}

.aavp-result__recommendation-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin-top: 1px;
    border-radius: 7px;
    background-color: var(--aavp-surface-soft);
    color: var(--aavp-accent);
}

.aavp-result__recommendation-icon .aavp-icon {
    width: 13px;
    height: 13px;
}

/* CTA finale */

.aavp-result__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    border-radius: var(--aavp-radius-sm);
    background: var(--aavp-gradient-accent);
    color: #ffffff !important;
    font-weight: 750;
    font-size: 0.95rem;
    text-decoration: none;
    box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--aavp-accent) 65%, transparent);
    transition: transform 0.16s var(--aavp-ease), box-shadow 0.16s var(--aavp-ease);
}

.aavp-result__cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px -8px color-mix(in srgb, var(--aavp-accent) 70%, transparent);
    color: #ffffff !important;
}

.aavp-result__cta .aavp-icon {
    transition: transform 0.22s var(--aavp-ease);
}

.aavp-result__cta:hover .aavp-icon {
    transform: translateX(3px);
}

/*
 * ---------- Responsive ----------
 *
 * Basato sulla larghezza REALE del widget (container query), non sul
 * viewport: un widget dentro una colonna Elementor stretta su desktop
 * deve comportarsi come "mobile" a prescindere dallo schermo. I due
 * blocchi @media identici sotto sono un fallback per i browser senza
 * supporto a container query (quota ormai residuale nel 2026: Safari
 * <16, Firefox <110), cosi' il layout resta comunque corretto ovunque.
 */

@container aavp (max-width: 480px) {
    .aavp-amenities {
        grid-template-columns: repeat(2, 1fr);
    }

    .aavp-result__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@container aavp (max-width: 360px) {
    .aavp-widget {
        padding: 20px;
        border-radius: var(--aavp-radius-md);
    }

    .aavp-widget__title {
        font-size: 1.25rem;
    }

    .aavp-field-row,
    .aavp-field-row--3 {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .aavp-progress__label {
        display: none;
    }

    .aavp-amenities,
    .aavp-result__grid {
        grid-template-columns: 1fr;
    }

    .aavp-result__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .aavp-result__score-row {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .aavp-result__score-ring {
        margin: 0 auto;
    }

    .aavp-result__bar-label {
        flex-basis: 68px;
    }

    .aavp-actions {
        flex-direction: column-reverse;
    }

    .aavp-btn--primary {
        margin-left: 0;
        width: 100%;
    }

    .aavp-btn--secondary {
        width: 100%;
    }
}

@supports not (container-type: inline-size) {
    @media (max-width: 560px) {
        .aavp-amenities {
            grid-template-columns: repeat(2, 1fr);
        }

        .aavp-result__grid {
            grid-template-columns: repeat(2, 1fr);
        }
    }

    @media (max-width: 400px) {
        .aavp-widget {
            padding: 20px;
            border-radius: var(--aavp-radius-md);
        }

        .aavp-widget__title {
            font-size: 1.25rem;
        }

        .aavp-field-row,
        .aavp-field-row--3 {
            grid-template-columns: 1fr;
            gap: 0;
        }

        .aavp-progress__label {
            display: none;
        }

        .aavp-amenities,
        .aavp-result__grid {
            grid-template-columns: 1fr;
        }

        .aavp-result__header {
            flex-direction: column;
            align-items: flex-start;
            gap: 8px;
        }

        .aavp-result__score-row {
            flex-direction: column;
            align-items: stretch;
            text-align: center;
        }

        .aavp-result__score-ring {
            margin: 0 auto;
        }

        .aavp-result__bar-label {
            flex-basis: 68px;
        }

        .aavp-actions {
            flex-direction: column-reverse;
        }

        .aavp-btn--primary {
            margin-left: 0;
            width: 100%;
        }

        .aavp-btn--secondary {
            width: 100%;
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    .aavp-widget *,
    .aavp-widget *::before,
    .aavp-widget *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
