/* =====================================================
   CALCOLATORE PREVENTIVI - House Assistance
   UX/UI v2 - palette teal medicale, tipografia moderna,
   micro-animazioni, toggle eleganti, mobile-first.
   Tutti gli stili sono prefissati con .cw- per non
   collidere con il CSS del sito ospitante.
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    /* Palette ufficiale House Assistance:
       #1d6dff (blu primario) + #2bbcd6 (ciano accent) */
    --cw-primary:        #1d6dff;
    --cw-primary-dark:   #1556cc;
    --cw-primary-darker: #0a3d99;
    --cw-primary-light:  #e8f0ff;
    --cw-primary-50:     #f3f7ff;
    --cw-accent:         #2bbcd6;
    --cw-accent-dark:    #1ea4bc;
    --cw-accent-light:   #e3f6fa;
    --cw-bg:             #f6f8fa;
    --cw-bg-deep:        #eef2f5;
    --cw-card:           #ffffff;
    --cw-border:         #e3e8ee;
    --cw-border-strong:  #c9d2dc;
    --cw-text:           #14222e;
    --cw-text-light:     #5b6b7a;
    --cw-text-muted:     #94a3b3;
    --cw-success:        #15a36b;
    --cw-success-light:  #e6f8ef;
    --cw-error:          #e23636;
    --cw-error-light:    #fdecec;
    --cw-warning:        #f5b800;
    --cw-warning-light:  #fff7d6;

    --cw-radius:         16px;
    --cw-radius-lg:      20px;
    --cw-radius-sm:      10px;
    --cw-radius-xs:      6px;

    --cw-shadow-sm:      0 1px 3px rgba(20, 34, 46, 0.05);
    --cw-shadow:         0 4px 16px rgba(20, 34, 46, 0.06);
    --cw-shadow-md:      0 8px 24px rgba(20, 34, 46, 0.08);
    --cw-shadow-lg:      0 16px 40px rgba(20, 34, 46, 0.12);

    --cw-ease:           cubic-bezier(0.4, 0, 0.2, 1);
    --cw-ease-out:       cubic-bezier(0.16, 1, 0.3, 1);

    --cw-font:           'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

.calcolatore-wrap, .calcolatore-wrap * {
    box-sizing: border-box;
}

/* L'attributo HTML `hidden` deve sempre vincere su qualsiasi
   regola di display (alcune classi tipo .cw-btn usano inline-flex). */
.calcolatore-wrap [hidden] {
    display: none !important;
}

/* Quando il calcolatore è dentro il layout del sito (header + footer),
   la fascia grigia occupa tutta la larghezza — stesso grigio del wizard,
   niente bordi bianchi ai lati — e dà respiro verso header e footer. */
.cw-page {
    background: var(--cw-bg);
    padding: 56px 20px 80px;
}

/* In questo contesto la spaziatura verticale la dà .cw-page:
   evitiamo di sommarla al padding interno del wrap. */
.cw-page .calcolatore-wrap {
    padding-top: 0;
    padding-bottom: 0;
}

.calcolatore-wrap {
    font-family: var(--cw-font);
    color: var(--cw-text);
    background: var(--cw-bg);
    max-width: 880px;
    margin: 0 auto;
    padding: 40px 20px 100px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================================================
   HEADER
   ================================================== */
.cw-header {
    text-align: center;
    margin-bottom: 36px;
}
.cw-header h1 {
    font-size: 2.1rem;
    margin: 0 0 10px;
    color: var(--cw-primary-darker);
    font-weight: 800;
    letter-spacing: -0.02em;
}
.cw-subtitle {
    color: var(--cw-text-light);
    max-width: 600px;
    margin: 0 auto;
    font-size: 1rem;
}

/* ==================================================
   STEP INDICATOR
   ================================================== */
.cw-progress {
    margin: 0 0 28px;
    padding: 0 8px;
}
.cw-steps {
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0;
    margin: 0;
    position: relative;
}
.cw-steps::before {
    content: "";
    position: absolute;
    top: 19px;
    left: 7%;
    right: 7%;
    height: 3px;
    background: var(--cw-border);
    z-index: 0;
    border-radius: 3px;
}
.cw-steps::after {
    content: "";
    position: absolute;
    top: 19px;
    left: 7%;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--cw-primary), var(--cw-accent));
    z-index: 1;
    border-radius: 3px;
    transition: width 0.5s var(--cw-ease-out);
}
.cw-steps[data-progress="1"]::after { width: 0%; }
.cw-steps[data-progress="2"]::after { width: 17%; }
.cw-steps[data-progress="3"]::after { width: 34%; }
.cw-steps[data-progress="4"]::after { width: 53%; }
.cw-steps[data-progress="5"]::after { width: 72%; }
.cw-steps[data-progress="6"]::after { width: 86%; }
.cw-step {
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 2;
}
.cw-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--cw-card);
    border: 3px solid var(--cw-border);
    color: var(--cw-text-light);
    font-weight: 700;
    font-size: 0.92rem;
    transition: all 0.3s var(--cw-ease-out);
}
.cw-step-label {
    display: block;
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--cw-text-light);
    font-weight: 500;
    transition: color 0.2s var(--cw-ease);
}
.cw-step.is-active .cw-step-num {
    background: var(--cw-primary);
    border-color: var(--cw-primary);
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 0 0 6px rgba(29, 109, 255, 0.15), var(--cw-shadow);
}
.cw-step.is-active .cw-step-label {
    color: var(--cw-primary-darker);
    font-weight: 700;
}
.cw-step.is-done .cw-step-num {
    background: var(--cw-primary);
    border-color: var(--cw-primary);
    color: #fff;
    font-size: 0;
}
.cw-step.is-done .cw-step-num::before {
    content: "";
    width: 14px;
    height: 8px;
    border-left: 3px solid #fff;
    border-bottom: 3px solid #fff;
    transform: rotate(-45deg);
    margin-top: -3px;
}

/* ==================================================
   FORM CONTAINER
   ================================================== */
.cw-form {
    background: var(--cw-card);
    border-radius: var(--cw-radius-lg);
    box-shadow: var(--cw-shadow-md);
    padding: 44px;
    position: relative;
}

.cw-pane {
    display: none;
    animation: cwSlideIn 0.4s var(--cw-ease-out);
}
.cw-pane.is-active {
    display: block;
}
@keyframes cwSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cw-pane h2 {
    margin: 0 0 8px;
    font-size: 1.55rem;
    color: var(--cw-primary-darker);
    font-weight: 700;
    letter-spacing: -0.01em;
}
.cw-help {
    color: var(--cw-text-light);
    margin: 0 0 28px;
    font-size: 0.96rem;
}

/* ==================================================
   CARDS (step 1 - veicolo)
   ================================================== */
.cw-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.cw-card {
    cursor: pointer;
    border: 2px solid var(--cw-border);
    border-radius: var(--cw-radius);
    padding: 28px 24px;
    text-align: center;
    transition: all 0.25s var(--cw-ease-out);
    background: #fff;
    position: relative;
    overflow: hidden;
}
.cw-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.cw-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--cw-primary-light), transparent 60%);
    opacity: 0;
    transition: opacity 0.25s;
}
.cw-card:hover {
    border-color: var(--cw-primary);
    box-shadow: var(--cw-shadow-md);
    transform: translateY(-3px);
}
.cw-card:hover::before {
    opacity: 0.6;
}
.cw-card:has(input:checked) {
    border-color: var(--cw-primary);
    background: var(--cw-primary-light);
    box-shadow: 0 12px 28px rgba(29, 109, 255, 0.18);
}
/* Indicatore di selezione: pallino + spunta in un solo elemento,
   così la spunta è sempre centrata dentro il pallino. */
.cw-card:has(input:checked)::after {
    content: "";
    position: absolute;
    top: 14px;
    right: 14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--cw-primary);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 16px 16px;
    z-index: 3;
    animation: cwPopIn 0.3s var(--cw-ease-out);
}
.cw-card-body {
    position: relative;
    z-index: 1;
}
.cw-card-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: var(--cw-primary-light);
    color: var(--cw-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.9rem;
    transition: all 0.25s;
}
.cw-card:has(input:checked) .cw-card-icon {
    background: var(--cw-primary);
    color: #fff;
    transform: scale(1.08);
}
.cw-card h3 {
    margin: 0 0 8px;
    color: var(--cw-primary-darker);
    font-size: 1.15rem;
    font-weight: 700;
}
.cw-card p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--cw-text-light);
    line-height: 1.5;
}

/* ==================================================
   LIST CHOICES (step 2 - modalità)
   ================================================== */
.cw-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.cw-list-item {
    cursor: pointer;
    border: 2px solid var(--cw-border);
    border-radius: var(--cw-radius);
    padding: 18px 22px;
    background: #fff;
    transition: all 0.2s var(--cw-ease-out);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: relative;
}
.cw-list-item input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.cw-list-item:hover {
    border-color: var(--cw-primary);
    transform: translateY(-1px);
    box-shadow: var(--cw-shadow-sm);
}
.cw-list-item:has(input:checked) {
    border-color: var(--cw-primary);
    background: var(--cw-primary-light);
    box-shadow: 0 6px 18px rgba(29, 109, 255, 0.14);
}
.cw-list-item-text h4 {
    margin: 0 0 4px;
    color: var(--cw-primary-darker);
    font-size: 1.05rem;
    font-weight: 700;
}
.cw-list-item-text p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--cw-text-light);
}
.cw-list-item-price {
    text-align: right;
    flex-shrink: 0;
}
.cw-list-item-price small {
    font-size: 0.72rem;
    color: var(--cw-text-muted);
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.cw-list-item-price strong {
    color: var(--cw-primary);
    font-size: 1.25rem;
    font-weight: 800;
    display: block;
    margin-top: 2px;
}

/* ==================================================
   FORM FIELDS
   ================================================== */
.cw-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.cw-field {
    display: flex;
    flex-direction: column;
}
.cw-field-wide {
    grid-column: 1 / -1;
}
.cw-field label {
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 8px;
    color: var(--cw-text);
}
.cw-field input,
.cw-field select,
.cw-field textarea {
    font-family: inherit;
    font-size: 1rem;
    padding: 13px 16px;
    border: 2px solid var(--cw-border);
    border-radius: var(--cw-radius-sm);
    background: #fff;
    color: var(--cw-text);
    transition: all 0.2s var(--cw-ease);
}
.cw-field input::placeholder,
.cw-field textarea::placeholder {
    color: var(--cw-text-muted);
}
.cw-field input:hover:not(:focus),
.cw-field select:hover:not(:focus),
.cw-field textarea:hover:not(:focus) {
    border-color: var(--cw-border-strong);
}
.cw-field input:focus,
.cw-field select:focus,
.cw-field textarea:focus {
    outline: none;
    border-color: var(--cw-primary);
    box-shadow: 0 0 0 4px rgba(29, 109, 255, 0.12);
}
.cw-field input.is-invalid,
.cw-field select.is-invalid,
.cw-field textarea.is-invalid {
    border-color: var(--cw-error);
    background: var(--cw-error-light);
    animation: cwShake 0.35s var(--cw-ease);
}
/* Spunta privacy mancante */
.cw-field input[type="checkbox"].is-invalid {
    outline: 2px solid var(--cw-error);
    outline-offset: 3px;
    animation: cwShake 0.35s var(--cw-ease);
}
.cw-checkbox:has(input.is-invalid) span { color: var(--cw-error); }
/* Messaggio di validazione visibile sopra i pulsanti */
.cw-validation-msg {
    margin: 16px 0 0;
    padding: 12px 16px;
    background: var(--cw-error-light);
    border: 1px solid var(--cw-error);
    border-radius: 10px;
    color: var(--cw-error);
    font-size: 0.92rem;
    font-weight: 600;
}
@keyframes cwShake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-6px); }
    75%      { transform: translateX(6px); }
}
.cw-hint {
    font-size: 0.82rem;
    color: var(--cw-text-light);
    margin-top: 6px;
    line-height: 1.4;
}

/* ==================================================
   AUTOCOMPLETE INDIRIZZI
   ================================================== */
.cw-autocomplete {
    position: relative;
}
.cw-autocomplete-list {
    position: absolute;
    top: calc(100% - 24px);
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    border: 2px solid var(--cw-primary);
    border-radius: 0 0 var(--cw-radius-sm) var(--cw-radius-sm);
    max-height: 280px;
    overflow-y: auto;
    box-shadow: var(--cw-shadow-lg);
}
.cw-suggest-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 0.93rem;
    border-bottom: 1px solid var(--cw-border);
    transition: background 0.12s;
}
.cw-suggest-item:last-child { border-bottom: none; }
.cw-suggest-item:hover,
.cw-suggest-item.is-active {
    background: var(--cw-primary-light);
}
.cw-suggest-icon {
    font-size: 1.05rem;
    flex-shrink: 0;
    color: var(--cw-primary);
}

.cw-hint-addr.is-ok {
    color: var(--cw-success);
    font-weight: 600;
}

/* Box km */
.cw-km-box {
    background: linear-gradient(135deg, var(--cw-primary-light), #fff);
    border: 2px solid var(--cw-primary);
    border-radius: var(--cw-radius);
    padding: 20px 24px;
    margin-top: 4px;
    animation: cwSlideIn 0.4s var(--cw-ease-out);
}
.cw-km-info {
    display: flex;
    align-items: center;
    gap: 18px;
}
.cw-km-icon {
    width: 52px;
    height: 52px;
    background: var(--cw-primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.cw-km-text strong {
    display: block;
    font-size: 1.6rem;
    color: var(--cw-primary-darker);
    font-weight: 800;
    letter-spacing: -0.02em;
}
.cw-km-text small {
    color: var(--cw-text-light);
    font-size: 0.88rem;
}
.cw-km-box .cw-hint {
    margin-top: 12px;
    color: var(--cw-primary-darker);
    font-weight: 500;
}

.cw-km-error {
    background: var(--cw-error-light);
    border: 2px solid var(--cw-error);
    border-radius: var(--cw-radius);
    padding: 16px 20px;
    color: var(--cw-error);
    display: flex;
    align-items: center;
    gap: 12px;
}
.cw-km-error strong {
    display: block;
    margin-bottom: 4px;
    font-weight: 700;
}
.cw-km-error::before {
    content: "!";
    width: 28px;
    height: 28px;
    background: var(--cw-error);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
}

/* ==================================================
   TRIAGE - TOGGLE SWITCH ELEGANTI
   ================================================== */
.cw-questions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.cw-question {
    border: 2px solid var(--cw-border);
    border-radius: var(--cw-radius);
    padding: 18px 22px;
    margin: 0;
    background: #fff;
    transition: all 0.2s var(--cw-ease);
}
.cw-question:hover {
    border-color: var(--cw-border-strong);
}
.cw-question.is-answered {
    border-color: var(--cw-primary);
    background: var(--cw-primary-50);
}
.cw-question.is-invalid {
    border-color: var(--cw-error);
    background: var(--cw-error-light);
    animation: cwShake 0.35s var(--cw-ease);
}
.cw-q-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.cw-q-title {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 240px;
}
.cw-q-icon {
    width: 40px;
    height: 40px;
    background: var(--cw-primary-light);
    color: var(--cw-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.cw-q-text {
    font-weight: 600;
    font-size: 0.98rem;
    color: var(--cw-text);
}
.cw-q-text small {
    display: block;
    font-weight: 400;
    color: var(--cw-text-light);
    font-size: 0.82rem;
    margin-top: 2px;
}

/* Toggle Sì/No */
.cw-toggle {
    display: inline-flex;
    background: var(--cw-bg-deep);
    border-radius: 10px;
    padding: 4px;
    position: relative;
    flex-shrink: 0;
}
.cw-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.cw-toggle label {
    cursor: pointer;
    padding: 8px 22px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--cw-text-light);
    border-radius: 7px;
    transition: all 0.2s var(--cw-ease);
    min-width: 64px;
    text-align: center;
    margin: 0;
    user-select: none;
}
.cw-toggle input:checked + label {
    background: #fff;
    color: var(--cw-primary-darker);
    box-shadow: var(--cw-shadow-sm);
}
.cw-toggle input[value="si"]:checked + label {
    background: var(--cw-primary);
    color: #fff;
}
.cw-toggle input[value="no"]:checked + label {
    background: #fff;
    color: var(--cw-text);
    box-shadow: var(--cw-shadow-sm);
}

/* Question number/counter input */
.cw-q-input {
    display: flex;
    align-items: center;
    gap: 0;
    border: 2px solid var(--cw-border);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}
.cw-q-input button {
    width: 38px;
    height: 38px;
    border: none;
    background: var(--cw-bg-deep);
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--cw-text);
    font-weight: 700;
    transition: background 0.15s;
}
.cw-q-input button:hover {
    background: var(--cw-primary-light);
    color: var(--cw-primary);
}
.cw-q-input input {
    width: 50px;
    text-align: center;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    color: var(--cw-text);
    padding: 8px 0;
    -moz-appearance: textfield;
    background: #fff;
}
.cw-q-input input::-webkit-outer-spin-button,
.cw-q-input input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Costo badge - ciano accent, coerente con la palette */
.cw-q-cost {
    display: inline-block;
    background: var(--cw-accent-light);
    color: var(--cw-accent-dark);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    margin-left: 6px;
}

/* Checkbox privacy */
.cw-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 0.93rem;
    padding: 14px 16px;
    background: var(--cw-primary-50);
    border: 2px solid var(--cw-border);
    border-radius: var(--cw-radius-sm);
    transition: all 0.2s;
}
.cw-checkbox:hover {
    border-color: var(--cw-primary);
}
.cw-checkbox input {
    margin-top: 2px;
    accent-color: var(--cw-primary);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.cw-checkbox a {
    color: var(--cw-primary);
    font-weight: 600;
}

/* ==================================================
   RIEPILOGO
   ================================================== */
.cw-riepilogo {
    margin-bottom: 16px;
}
.cw-riep-card {
    background: #fff;
    border: 2px solid var(--cw-border);
    border-radius: var(--cw-radius);
    padding: 22px;
    margin-bottom: 14px;
    transition: all 0.2s;
}
.cw-riep-card:hover {
    border-color: var(--cw-primary);
    box-shadow: var(--cw-shadow-sm);
}
.cw-riep-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.cw-riep-card-icon {
    width: 38px;
    height: 38px;
    background: var(--cw-primary-light);
    color: var(--cw-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.cw-riep-card h4 {
    margin: 0;
    color: var(--cw-primary-darker);
    font-size: 0.92rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 700;
}
.cw-riepilogo-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 7px 0;
    font-size: 0.95rem;
    border-bottom: 1px dashed rgba(195, 210, 220, 0.5);
}
.cw-riepilogo-row:last-child {
    border-bottom: none;
}
.cw-riepilogo-row span:first-child {
    color: var(--cw-text-light);
}
.cw-riepilogo-row span:last-child {
    color: var(--cw-text);
    font-weight: 600;
    text-align: right;
}

/* Card totale - più d'impatto, blu primario sfumato con ciano */
.cw-riep-total {
    background: linear-gradient(135deg, var(--cw-primary), var(--cw-accent));
    color: #fff;
    border-radius: var(--cw-radius);
    padding: 28px;
    text-align: center;
    box-shadow: 0 14px 32px rgba(29, 109, 255, 0.25);
    margin-top: 8px;
}
.cw-riep-total-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.85;
    margin-bottom: 6px;
    font-weight: 600;
}
.cw-riep-total-value {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}
.cw-riep-total-note {
    font-size: 0.82rem;
    opacity: 0.85;
    margin-top: 10px;
}

.cw-disclaimer {
    background: var(--cw-warning-light);
    border-left: 4px solid var(--cw-warning);
    padding: 14px 18px;
    border-radius: var(--cw-radius-sm);
    font-size: 0.88rem;
    color: #6a4a00;
    margin-top: 14px;
    line-height: 1.5;
}

/* ==================================================
   STICKY PRICEBAR (nascosta durante la compilazione,
   il totale finale è mostrato solo nel riepilogo)
   ================================================== */
.cw-pricebar {
    display: none;
}
.cw-pricebar-label {
    font-size: 0.78rem;
    color: var(--cw-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}
.cw-pricebar-amount {
    font-size: 1.9rem;
    font-weight: 800;
    margin-right: auto;
    color: var(--cw-primary-darker);
    letter-spacing: -0.02em;
    transition: transform 0.25s var(--cw-ease-out);
}
.cw-pricebar-amount.is-bump {
    animation: cwBump 0.4s var(--cw-ease-out);
}
@keyframes cwBump {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); color: var(--cw-accent); }
}
.cw-pricebar-toggle {
    background: var(--cw-primary-light);
    border: 1px solid transparent;
    color: var(--cw-primary-darker);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.15s;
}
.cw-pricebar-toggle:hover {
    background: var(--cw-primary);
    color: #fff;
}
.cw-pricebar-detail {
    flex-basis: 100%;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--cw-border);
    font-size: 0.88rem;
    color: var(--cw-text-light);
    animation: cwSlideIn 0.3s var(--cw-ease-out);
}
.cw-pricebar-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
}
.cw-pricebar-detail-row span:last-child {
    color: var(--cw-text);
    font-weight: 600;
}

/* ==================================================
   ACTIONS
   ================================================== */
.cw-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-top: 36px;
    flex-wrap: wrap;
}
.cw-actions-right {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-left: auto;
}
.cw-btn {
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    padding: 14px 28px;
    border-radius: var(--cw-radius-sm);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s var(--cw-ease-out);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.cw-btn-primary {
    background: var(--cw-primary);
    color: #fff;
    box-shadow: 0 6px 16px rgba(29, 109, 255, 0.28);
}
.cw-btn-primary:hover {
    background: var(--cw-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(29, 109, 255, 0.35);
}
.cw-btn-primary:active {
    transform: translateY(0);
}
.cw-btn-primary:disabled {
    background: var(--cw-border);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.cw-btn-ghost {
    background: transparent;
    color: var(--cw-text-light);
    border-color: var(--cw-border-strong);
}
.cw-btn-ghost:hover:not(:disabled) {
    border-color: var(--cw-primary);
    color: var(--cw-primary);
    background: var(--cw-primary-light);
}
.cw-btn-ghost:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ==================================================
   SUCCESS / ERROR
   ================================================== */
.cw-success,
.cw-error {
    background: #fff;
    border-radius: var(--cw-radius-lg);
    box-shadow: var(--cw-shadow-md);
    padding: 56px 40px;
    text-align: center;
}
.cw-success-icon,
.cw-error-icon {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.6rem;
    color: #fff;
    font-weight: 700;
    animation: cwPopIn 0.5s var(--cw-ease-out);
}
@keyframes cwPopIn {
    0%   { transform: scale(0.5); opacity: 0; }
    60%  { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); }
}
.cw-success-icon {
    background: linear-gradient(135deg, var(--cw-success), #0e7b50);
    box-shadow: 0 12px 30px rgba(21, 163, 107, 0.3);
}
.cw-error-icon {
    background: linear-gradient(135deg, var(--cw-error), #b82323);
}

.cw-success h2,
.cw-error h2 {
    margin: 0 0 14px;
    color: var(--cw-primary-darker);
    font-size: 1.7rem;
    font-weight: 800;
}
.cw-success p,
.cw-error p {
    color: var(--cw-text-light);
    max-width: 520px;
    margin: 0 auto 12px;
    font-size: 1rem;
}
.cw-success-ref {
    background: var(--cw-primary-light);
    display: inline-block;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--cw-primary-darker);
    font-weight: 700;
    margin: 18px 0 26px !important;
    letter-spacing: 0.4px;
}

/* ==================================================
   MOBILE
   ================================================== */
@media (max-width: 720px) {
    .calcolatore-wrap {
        padding: 20px 14px 80px;
    }
    .cw-header h1 {
        font-size: 1.55rem;
    }
    .cw-subtitle {
        font-size: 0.92rem;
    }
    .cw-form {
        padding: 24px 20px;
        border-radius: var(--cw-radius);
    }
    .cw-pane h2 {
        font-size: 1.25rem;
    }
    .cw-help {
        font-size: 0.9rem;
        margin-bottom: 22px;
    }

    .cw-cards,
    .cw-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    /* Step indicator compatto - nasconde le label */
    .cw-progress {
        padding: 0;
    }
    .cw-steps::before { left: 8%; right: 8%; top: 16px; }
    .cw-steps::after  { left: 8%;            top: 16px; }
    .cw-step-num {
        width: 34px;
        height: 34px;
        font-size: 0.8rem;
        border-width: 2px;
    }
    .cw-step-label {
        display: none;
    }
    .cw-step.is-active .cw-step-label {
        display: block;
        position: absolute;
        top: 42px;
        left: 50%;
        transform: translateX(-50%);
        white-space: nowrap;
        font-size: 0.75rem;
    }
    .cw-progress {
        margin-bottom: 44px; /* spazio per la label dello step attivo */
    }

    .cw-card {
        padding: 22px 18px;
    }
    .cw-card-icon {
        width: 54px;
        height: 54px;
        font-size: 1.6rem;
    }

    .cw-list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .cw-list-item-price {
        align-self: flex-end;
        text-align: right;
    }

    /* Toggle: meglio in colonna su mobile per non strapparsi */
    .cw-q-header {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }
    .cw-q-title {
        min-width: 0;
    }
    .cw-toggle {
        align-self: stretch;
    }
    .cw-toggle label {
        flex: 1;
        padding: 12px 18px;
    }

    .cw-pricebar {
        margin: 24px -20px -24px;
        padding: 14px 20px;
        border-radius: 0 0 var(--cw-radius) var(--cw-radius);
    }
    .cw-pricebar-amount {
        font-size: 1.45rem;
    }

    .cw-actions {
        flex-direction: column-reverse;
        gap: 10px;
    }
    .cw-actions-right {
        flex-direction: column-reverse;
        width: 100%;
        margin-left: 0;
    }
    .cw-btn {
        width: 100%;
        padding: 16px 24px;
        font-size: 1.02rem;
    }

    .cw-riep-total-value {
        font-size: 2.2rem;
    }
    .cw-success,
    .cw-error {
        padding: 40px 24px;
    }
    .cw-success h2,
    .cw-error h2 {
        font-size: 1.4rem;
    }
}

/* Ulteriore breakpoint per smartphone piccoli */
@media (max-width: 380px) {
    .cw-step-num { width: 30px; height: 30px; font-size: 0.75rem; }
    .cw-pricebar-amount { font-size: 1.25rem; }
}

/* Riduzione animazioni se l'utente preferisce */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
