/* =============================================
   QUESTIONARIO ANAMNESTICO SIA — STYLES
   Design coerente con il sito SIA
   ============================================= */

/* Variabili CSS — palette SIA */
:root {
    --nero-profondo: #0a0a0f;
    --blu-notte: #0c0f2e;
    --bianco: #fdfdfd;
    --bianco-off: #f8f9fa;
    --nero-testo: #000000;
    --grigio-testo: #222222;
    --viola: #5a2ca5;
    --viola-light: rgba(90, 44, 165, 0.08);
    --blu: #4A63D9;
    --rosa: #D66FD6;
    --oro: #D9C89E;
    --oro-scuro: #b8a576;
    --grigio: #555566;
    --grigio-light: #d1d5db;
    --errore: #ef4444;
    --successo: #22c55e;
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-hover: rgba(255, 255, 255, 0.08);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background-color: #0a0a1a;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--bianco);
    min-height: 100vh;
    line-height: 1.6;
    background: linear-gradient(135deg, var(--nero-profondo) 0%, var(--blu-notte) 50%, #0a0a1a 100%);
    background-attachment: fixed;
}

/* ===== STARFIELD ===== */
.starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.star {
    position: absolute;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.9), transparent);
    border-radius: 50%;
    animation: twinkle 3s infinite;
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }
}

/* ===== HEADER ===== */
.form-header {
    position: relative;
    z-index: 100;
    background: transparent;
    padding: 2rem 2rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: var(--transition);
}

.logo-img {
    height: 75px;
    width: auto;
    filter: drop-shadow(0 0 10px rgba(111, 66, 193, 0.2));
    transition: var(--transition);
}

.logo-img:hover {
    transform: scale(1.05);
}

/* ===== MAIN CONTAINER ===== */
.form-main {
    position: relative;
    z-index: 1;
    padding: 2rem 1rem 4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: calc(100vh - 120px);
}

.form-container {
    width: 100%;
    max-width: 820px;
    position: relative;
    background: #f2f4f6;
    color: var(--nero-testo);
    padding: 3rem 4rem;
    border-radius: 8px;
    border: 1px solid rgba(111, 66, 193, 0.15);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(111, 66, 193, 0.05),
        inset 0 0 100px rgba(111, 66, 193, 0.02);
    margin-bottom: 2rem;
    backdrop-filter: blur(5px);
}

@media (max-width: 850px) {
    .form-container {
        padding: 2rem;
        border-radius: 0;
    }
}

/* ===== TITOLO ===== */
.form-title-section {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem 1rem;
}

.form-title-section h1 {
    font-size: clamp(1.6rem, 2.5vw + 1rem, 2.4rem);
    font-weight: 800;
    color: var(--nero-testo);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.form-title-section h1 span {
    font-weight: 800;
    color: inherit;
}

/* ===== PROGRESS BAR (outside white box) ===== */
.progress-container {
    width: 100%;
    max-width: 820px;
    margin-bottom: 1.5rem;
}

.progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1.2rem;
}

.progress-fill {
    height: 100%;
    width: 12.5%;
    background: linear-gradient(90deg, var(--viola), var(--rosa), var(--blu));
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 0 12px rgba(111, 66, 193, 0.5);
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    padding: 0 0.5rem;
}

.step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    opacity: 0.3;
    transition: var(--transition);
    flex: 1;
    /* Ensure equal spacing */
    min-width: 0;
    /* Allow shrinking */
}

.step-indicator.active,
.step-indicator.completed {
    opacity: 1;
}

.step-indicator span {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    border: 2px solid transparent;
    transition: var(--transition);
    position: relative;
    z-index: 1;
    /* Ensure circle is above line if any */
}

.step-indicator.active span {
    background: var(--viola);
    color: white;
    box-shadow: 0 4px 15px rgba(111, 66, 193, 0.3);
    transform: scale(1.1);
}

.step-indicator.completed span {
    background: var(--successo);
    color: white;
}

.step-indicator small {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    margin-top: 0.3rem;
}

@media (max-width: 768px) {
    .step-indicator small {
        display: none;
    }

    .step-indicator.active small {
        display: block;
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        width: max-content;
        margin-top: 0.4rem;
        color: var(--viola);
        font-weight: 700;
        z-index: 10;
    }

    .step-indicator {
        position: relative;
    }

    .progress-steps {
        padding-bottom: 1.5rem;
    }

    .step-indicator span {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
}

/* ===== FORM STEPS ===== */
.form-step {
    display: none;
    animation: stepFadeIn 0.5s ease-out;
}

.form-step.active {
    display: block;
}

@keyframes stepFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-header {
    margin-bottom: 1.5rem;
}

.step-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--viola);
    margin-bottom: 0.5rem;
    border-bottom: 2px solid var(--viola);
    display: inline-block;
    padding-bottom: 2px;
}

.step-desc {
    font-size: 0.95rem;
    color: var(--grigio-testo);
    line-height: 1.6;
    margin-top: 0.5rem;
}

/* ===== INFO CARDS ===== */
.info-card {
    background: #f4f7ff;
    border: 1.5px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.info-card h3 {
    font-size: 1.1rem;
    color: #c53030;
    margin-bottom: 1rem;
    font-weight: 700;
}

.info-card h4 {
    font-size: 1rem;
    color: var(--viola);
    margin: 1.5rem 0 0.8rem;
    font-weight: 600;
}

.info-card p {
    font-size: 0.95rem;
    color: var(--grigio-testo);
    margin-bottom: 0.8rem;
    line-height: 1.6;
}

.nota-importante {
    color: #856404 !important;
    font-weight: 500;
    padding: 1rem;
    background: #fff3cd;
    border-radius: var(--radius-sm);
    border: 1px solid #ffeeba;
    margin-top: 2rem !important;
}

.professionista-card ul {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0;
}

.professionista-card li {
    font-size: 0.8rem;
    color: var(--grigio);
    padding: 0.2rem 0;
}

.professionista-card li::before {
    content: '•';
    color: var(--viola);
    margin-right: 0.5rem;
}

.piva {
    font-size: 0.72rem !important;
    opacity: 0.6;
    margin-top: 0.8rem !important;
}

/* ===== STEP 1 — INFO GRID ===== */
.contact-fields {
    margin-bottom: 1.5rem;
}

.contact-fields-notice {
    background: rgba(111, 66, 193, 0.07);
    border-left: 4px solid var(--viola);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 0.8rem 1.1rem;
    margin-bottom: 1rem;
    font-size: 0.82rem;
    color: var(--nero-testo);
    line-height: 1.5;
    font-weight: 500;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.info-tile {
    background: white;
    border: 2px solid rgba(111, 66, 193, 0.12);
    border-radius: var(--radius);
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    transition: var(--transition);
    box-shadow: 0 2px 12px rgba(111, 66, 193, 0.06);
}

.info-tile:hover {
    border-color: var(--viola);
    box-shadow: 0 6px 24px rgba(111, 66, 193, 0.12);
    transform: translateY(-3px);
}

.info-tile-icon {
    font-size: 1.8rem;
    line-height: 1;
    width: 44px;
    height: 44px;
    background: rgba(111, 66, 193, 0.08);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-tile-body strong {
    display: block;
    font-size: 0.9rem;
    color: var(--nero-testo);
    margin-bottom: 0.3rem;
    font-weight: 700;
}

.info-tile-body p {
    font-size: 0.8rem;
    color: var(--grigio);
    line-height: 1.6;
    margin: 0;
}

/* ===== STEP 1 — PROFESSIONISTA V2 ===== */
.professionista-card-v2 {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    background: linear-gradient(135deg, #f8f6ff 0%, #eee8ff 100%);
    border: 1px solid rgba(111, 66, 193, 0.18);
    border-radius: var(--radius);
    padding: 1.8rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(111, 66, 193, 0.06);
}

.prof-photo {
    width: 90px;
    height: 90px;
    min-width: 90px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--viola);
    box-shadow: 0 4px 16px rgba(111, 66, 193, 0.2);
}

.prof-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.prof-photo-fallback {
    width: 100%;
    height: 100%;
    background: var(--viola);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.prof-info h4 {
    font-size: 1.1rem;
    color: var(--nero-testo);
    margin: 0.2rem 0 0.6rem;
    font-weight: 700;
}

.prof-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.8rem;
}

.prof-tag {
    font-size: 0.7rem;
    background: rgba(111, 66, 193, 0.1);
    color: var(--viola);
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
}

.prof-address {
    font-size: 0.8rem;
    color: var(--grigio);
    margin: 0 0 0.3rem;
}

.prof-fiscal {
    font-size: 0.68rem;
    color: #999;
    margin: 0;
}

@media (max-width: 768px) {
    .info-grid {
        grid-template-columns: 1fr;
    }

    .professionista-card-v2 {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .prof-photo {
        width: 100px;
        height: 100px;
        min-width: 100px;
    }

    .prof-tags {
        justify-content: center;
    }
}

/* ===== FORM FIELDS ===== */
.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--nero-testo);
    margin-bottom: 0.4rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 0.5rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.85rem 1.2rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--nero-testo);
    background: white;
    border: 1px solid var(--grigio-light);
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--viola);
    box-shadow: 0 0 0 3px rgba(111, 66, 193, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: #aaa;
}

select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236F42C1' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

textarea {
    resize: vertical;
    min-height: 60px;
}

.error-msg {
    display: block;
    font-size: 0.75rem;
    color: var(--errore);
    margin-top: 0.3rem;
    min-height: 1rem;
}

input.invalid,
select.invalid,
textarea.invalid {
    border-color: var(--errore);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* ===== SECTION DIVIDERS ===== */
.section-divider {
    display: flex;
    align-items: center;
    margin: 2rem 0 1rem;
    gap: 1rem;
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #cbd5e1, transparent);
}

.section-divider span {
    font-size: 1rem;
    font-weight: 700;
    color: var(--viola);
    white-space: nowrap;
}

.section-help {
    font-size: 0.8rem;
    color: var(--grigio);
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* ===== MEDICAL REFERENCE BOX ===== */
.medical-reference-box {
    background: #f8fafc;
    border: 1.5px solid rgba(111, 66, 193, 0.18);
    border-radius: var(--radius);
    padding: 1.5rem 1.5rem 0.5rem;
    margin-bottom: 1.6rem;
    box-shadow: 0 4px 16px rgba(111, 66, 193, 0.08);
}

.medical-reference-box .section-divider {
    margin-top: 0.6rem;
}

.medical-reference-box .section-divider:first-of-type {
    margin-top: 0;
}

.medical-reference-box .section-help {
    margin-bottom: 0.8rem;
}

/* ===== RADIO BUTTONS ===== */
.health-question {
    background: #fafafa;
    border: 1.5px solid #d1d5db;
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    margin-bottom: 1.2rem;
    transition: var(--transition);
}

.health-question:hover {
    border-color: var(--viola);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.health-question>label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--nero-testo);
    margin-bottom: 0.8rem;
    display: block;
}

.radio-group {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    border: 1px solid transparent;
    transition: var(--transition);
}

.radio-label:hover {
    background: #f1f5f9;
}

.radio-mark {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #6b7280;
    position: relative;
    flex-shrink: 0;
    transition: var(--transition);
    background: white;
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-label input[type="radio"]:checked+.radio-mark {
    border-color: var(--viola);
    background: var(--viola);
    box-shadow: 0 0 10px rgba(111, 66, 193, 0.4);
}

.radio-label input[type="radio"]:checked+.radio-mark::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
}

/* ===== DETAILED RADIO LIST ===== */
.radio-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 1rem;
}

.radio-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    cursor: pointer;
    background: white;
    border: 1px solid var(--grigio-light);
    border-radius: var(--radius-sm);
    padding: 1rem;
    transition: var(--transition);
}

.radio-item:hover {
    border-color: var(--viola);
    background: #fdfdfd;
}

.radio-item input[type="radio"] {
    display: none;
}

.radio-item input[type="checkbox"] {
    display: none;
}

.radio-item input[type="radio"]:checked~.radio-mark {
    border-color: var(--viola);
    background: var(--viola);
    box-shadow: 0 0 10px rgba(111, 66, 193, 0.4);
}

.radio-item input[type="checkbox"]:checked~.radio-mark {
    border-color: var(--viola);
    background: var(--viola);
    box-shadow: 0 0 10px rgba(111, 66, 193, 0.4);
}

.radio-item input[type="radio"]:checked~.radio-mark::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
}

.radio-item input[type="checkbox"]:checked~.radio-mark::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
}

.radio-item input[type="radio"]:checked~.radio-content strong {
    color: var(--viola);
}

.radio-item input[type="checkbox"]:checked~.radio-content strong {
    color: var(--viola);
}

.radio-content {
    display: flex;
    flex-direction: column;
}

.radio-content strong {
    font-size: 0.95rem;
    color: var(--nero-testo);
    margin-bottom: 0.2rem;
}

.radio-content small {
    font-size: 0.85rem;
    color: var(--grigio);
    line-height: 1.4;
}

/* ===== CHECKBOX ===== */
.checkbox-group {
    margin-bottom: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--grigio-testo);
    padding: 0.6rem 0;
    line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    display: inline-block;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    border-radius: 4px;
    border: 2px solid var(--viola);
    background: white;
    position: relative;
    transition: var(--transition);
    margin-top: 2px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.checkbox-label input[type="checkbox"]:checked+.checkmark {
    background: var(--viola);
    border-color: var(--viola);
    box-shadow: 0 0 10px rgba(111, 66, 193, 0.3);
}

.checkbox-label input[type="checkbox"]:checked+.checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 13px;
    font-weight: bold;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.3rem;
    margin-top: 0.5rem;
}

/* ===== CONDITIONAL FIELDS ===== */
.conditional-field {
    margin-top: 0.8rem;
    padding: 0.8rem;
    background: rgba(111, 66, 193, 0.06);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--viola);
    animation: slideDown 0.3s ease-out;
}

.conditional-field.hidden {
    display: none;
}

.conditional-field label {
    font-size: 0.82rem;
    color: var(--grigio);
    margin-bottom: 0.3rem;
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== CONSENT TEXT ===== */
.consent-text {
    max-height: 450px;
    overflow-y: auto;
    padding: 2rem;
    background: #fdfdfd;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    margin-bottom: 2rem;
    scrollbar-width: thin;
    scrollbar-color: var(--viola) #f7f7f7;
}

.consent-text::-webkit-scrollbar {
    width: 6px;
}

.consent-text::-webkit-scrollbar-track {
    background: transparent;
}

.consent-text::-webkit-scrollbar-thumb {
    background: var(--viola);
    border-radius: 3px;
}

.consent-clause {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.consent-clause:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.consent-clause strong {
    display: block;
    font-size: 0.85rem;
    color: var(--viola);
    margin-bottom: 0.3rem;
}

.consent-clause p {
    font-size: 0.78rem;
    color: var(--grigio);
    line-height: 1.6;
}

.consent-checkboxes {
    margin-top: 1rem;
}

.consent-checkboxes .checkbox-label {
    background: #f4f7ff;
    border: 2px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 1rem 1.2rem;
    margin-bottom: 0.8rem;
    transition: var(--transition);
}

.consent-checkboxes .checkbox-label:hover {
    border-color: var(--viola);
    background: #eef1ff;
}

.consent-checkboxes .checkbox-label span:last-child {
    flex: 1;
    font-size: 0.88rem;
    color: var(--nero-testo);
    line-height: 1.5;
}

.consent-checkboxes .checkmark {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid var(--viola);
    background: white;
    margin-top: 2px;
    flex-shrink: 0;
}

.consent-checkboxes .checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: var(--viola);
    border-color: var(--viola);
}

/* ===== SIGNATURE ===== */
.signature-section {
    margin: 1.5rem 0;
}

.signature-section>label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--nero-testo);
    margin-bottom: 0.6rem;
}

.signature-wrapper {
    position: relative;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #ffffff;
    touch-action: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.signature-wrapper canvas {
    width: 100%;
    height: 200px;
    cursor: crosshair;
    display: block;
}

.signature-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    color: rgba(0, 0, 0, 0.05);
    pointer-events: none;
    transition: var(--transition);
}

.signature-placeholder.hidden {
    opacity: 0;
}

.btn-clear-signature {
    margin-top: 0.5rem;
    padding: 0.4rem 1rem;
    font-size: 0.78rem;
    font-family: inherit;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-clear-signature:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

/* ===== NAVIGATION BUTTONS ===== */
.form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
    gap: 1rem;
}

.btn {
    padding: 0.85rem 2rem;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 600;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.02rem;
}

.btn-back {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: var(--grigio);
}

.btn-back:hover {
    background: #e2e8f0;
    color: var(--nero-testo);
}

.btn-next {
    background: linear-gradient(135deg, var(--viola), var(--rosa));
    color: white;
    box-shadow: 0 4px 20px rgba(111, 66, 193, 0.3);
    margin-left: auto;
}

.btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(111, 66, 193, 0.5);
}

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

.btn-submit {
    background: linear-gradient(135deg, var(--successo), #16a34a);
    color: white;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
    margin-left: auto;
    padding: 0.85rem 2.5rem;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(34, 197, 94, 0.5);
}

/* ===== SUBMIT OVERLAY ===== */
.submit-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.92);
    backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.submit-overlay.hidden {
    display: none;
}

.submit-status {
    text-align: center;
    padding: 3rem;
    max-width: 400px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(111, 66, 193, 0.2);
    border-top-color: var(--viola);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    animation: spin 1s linear infinite;
}

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

.submit-status h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.submit-status p {
    color: var(--grigio);
    font-size: 0.9rem;
}

.submit-status .success-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* ===== FOOTER ===== */
.form-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.form-footer p {
    font-size: 0.75rem;
    color: rgba(247, 247, 247, 0.4);
    margin-bottom: 0.3rem;
}

.form-footer a {
    font-size: 0.7rem;
    color: rgba(247, 247, 247, 0.3);
    text-decoration: none;
    transition: var(--transition);
}

.form-footer a:hover {
    color: var(--viola);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .form-main {
        padding: 1rem 0.5rem 3rem;
    }

    .form-container {
        padding: 2rem 1.5rem;
    }

    .form-title-section {
        padding: 1.5rem 0.5rem;
    }

    .progress-steps {
        padding: 0;
    }

    .step-indicator small {
        font-size: 0.55rem;
    }

    .step-indicator span {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .radio-group {
        gap: 0.8rem;
    }

    .checkbox-grid {
        grid-template-columns: 1fr;
    }

    .form-navigation {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        text-align: center;
    }

    .btn-next,
    .btn-submit {
        margin-left: 0;
    }

    .signature-wrapper canvas {
        height: 160px;
    }

    .consent-text {
        max-height: 300px;
    }

    .summary-row {
        flex-direction: column;
        gap: 0.15rem;
    }

    .summary-label,
    .summary-value {
        width: 100%;
    }

    .media-consent-body {
        padding: 1rem 1.2rem;
    }

    .media-consent-hero {
        padding: 1.5rem 1.2rem 1rem;
    }
}

@media (max-width: 480px) {
    .form-header {
        padding: 0.8rem 1rem;
    }

    .info-card {
        padding: 1rem;
    }

    .health-question {
        padding: 0.8rem;
    }
}

/* ===== UTILITIES ===== */
.hidden {
    display: none !important;
}

/* Animazione shake per errori */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.3s ease-in-out;
}

/* ===== MEDIA CONSENT (Step 7) ===== */
.media-consent-card {
    background: linear-gradient(135deg, #f8f6ff 0%, #eee8ff 50%, #f0f4ff 100%);
    border: 2px solid rgba(111, 66, 193, 0.15);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(111, 66, 193, 0.08);
}

.media-consent-hero {
    text-align: center;
    padding: 2rem 2rem 1.5rem;
    background: linear-gradient(135deg, rgba(111, 66, 193, 0.08), rgba(224, 86, 253, 0.06));
    border-bottom: 1px solid rgba(111, 66, 193, 0.1);
}

.media-consent-icon {
    font-size: 2.5rem;
    margin-bottom: 0.8rem;
}

.media-consent-hero h3 {
    font-size: 1.15rem;
    color: var(--nero-testo);
    margin: 0 0 0.6rem;
    font-weight: 700;
}

.media-consent-hero p {
    font-size: 0.88rem;
    color: var(--grigio);
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto;
}

.media-consent-body {
    padding: 1.5rem 2rem;
}

.media-consent-clause {
    margin-bottom: 1.4rem;
}

.media-consent-clause strong {
    display: block;
    font-size: 0.9rem;
    color: var(--viola);
    margin-bottom: 0.4rem;
}

.media-consent-clause p {
    font-size: 0.84rem;
    color: var(--grigio-testo);
    line-height: 1.6;
    margin: 0 0 0.5rem;
}

.media-consent-clause ul {
    margin: 0.4rem 0 0.5rem 1.2rem;
    padding: 0;
}

.media-consent-clause ul li {
    font-size: 0.82rem;
    color: var(--grigio-testo);
    line-height: 1.7;
    margin-bottom: 0.2rem;
}

.media-consent-accept {
    background: rgba(34, 197, 94, 0.06) !important;
    border-color: rgba(34, 197, 94, 0.3) !important;
}

.media-consent-note {
    font-size: 0.78rem;
    color: var(--grigio);
    margin-top: 0.6rem;
    line-height: 1.5;
    font-style: italic;
}

/* ===== SUMMARY / RIEPILOGO (Step 8) ===== */
.summary-section {
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    overflow: hidden;
    transition: var(--transition);
}

.summary-section:hover {
    border-color: rgba(111, 66, 193, 0.3);
    box-shadow: 0 2px 12px rgba(111, 66, 193, 0.06);
}

.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    cursor: default;
}

.summary-header h4 {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--nero-testo);
}

.summary-edit-btn {
    padding: 0.35rem 0.9rem;
    font-size: 0.75rem;
    font-family: inherit;
    font-weight: 600;
    background: rgba(111, 66, 193, 0.08);
    color: var(--viola);
    border: 1px solid rgba(111, 66, 193, 0.2);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.summary-edit-btn:hover {
    background: var(--viola);
    color: white;
    box-shadow: 0 2px 8px rgba(111, 66, 193, 0.3);
}

.summary-body {
    padding: 1rem 1.2rem;
}

.summary-row {
    display: flex;
    padding: 0.35rem 0;
    font-size: 0.82rem;
    border-bottom: 1px dotted #f0f0f0;
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-label {
    width: 40%;
    color: var(--grigio);
    font-weight: 500;
}

.summary-value {
    width: 60%;
    color: var(--nero-testo);
    font-weight: 600;
}

.summary-consent-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.summary-consent-status.accepted {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.summary-consent-status.rejected {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.signature-notice {
    background: rgba(111, 66, 193, 0.06);
    border: 1.5px solid rgba(111, 66, 193, 0.15);
    border-radius: var(--radius-sm);
    padding: 1.2rem 1.5rem;
    margin: 1.5rem 0;
    font-size: 0.84rem;
    color: var(--nero-testo);
    line-height: 1.6;
}

.signature-notice ol {
    margin: 0.5rem 0 0 1.2rem;
    padding: 0;
}

.signature-notice ol li {
    margin-bottom: 0.2rem;
}

/* ===== PDF PREVIEW (Reader View) ===== */
.pdf-preview-wrapper {
    margin: 3rem -2.5rem -2.5rem -2.5rem;
    padding: 3rem 1rem;
    background: #4a4d51;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: auto;
    border-top: 5px solid #333;
    box-shadow: inset 0 10px 20px rgba(0, 0, 0, 0.3);
}

.pdf-preview-wrapper h3 {
    color: white;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    font-size: 1.5rem;
}

.preview-hint {
    color: #bbb;
    font-size: 0.95rem;
    margin-bottom: 2rem;
    max-width: 600px;
    text-align: center;
}

.pdf-preview-sheet {
    background: white !important;
    width: 210mm;
    min-height: 297mm;
    padding: 25mm 20mm;
    margin: 0 auto;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    font-family: 'Georgia', serif;
    font-size: 11pt;
    line-height: 1.6;
    color: #1a1a1a;
    text-align: left;
    box-sizing: border-box;
    position: relative;
    border: 1px solid #ddd;
}

.pdf-preview-sheet::before {
    content: 'ANTEPRIMA DOCUMENTO';
    position: absolute;
    top: 10mm;
    right: 15mm;
    font-size: 8pt;
    color: #ddd;
    letter-spacing: 3px;
    font-weight: bold;
}

.preview-header {
    text-align: center;
    border-bottom: 2px solid #333;
    padding-bottom: 1.5rem;
    margin-bottom: 3.5rem;
}

.preview-section {
    margin-bottom: 2.5rem;
}

.preview-section h4 {
    border-bottom: 1px solid #eee;
    text-transform: uppercase;
    font-size: 10pt;
    letter-spacing: 2px;
    margin-bottom: 1.2rem;
    color: #666;
    font-weight: 700;
}

.preview-row {
    display: flex;
    margin-bottom: 0.8rem;
    align-items: baseline;
}

.preview-label {
    font-weight: bold;
    width: 40%;
    color: #333;
    font-size: 11pt;
}

.preview-value {
    width: 60%;
    border-bottom: 1px dotted #ccc;
    min-height: 1.25em;
    padding-left: 8px;
    color: #000;
}

.preview-consent-clause {
    font-size: 10pt;
    margin-top: 5rem;
    padding: 2rem;
    background: #f9f9f9;
    border: 1px solid #eee;
    font-style: italic;
    color: #333;
    line-height: 1.7;
    position: relative;
}

.preview-consent-clause::after {
    content: 'FIRMA DIGITALE APPOSTA AL MOMENTO DELL’INVIO';
    position: absolute;
    bottom: -30px;
    left: 0;
    font-size: 7.5pt;
    color: #999;
    font-style: normal;
}

@media (max-width: 850px) {
    .pdf-preview-wrapper {
        margin: 2rem -1.5rem -1.5rem -1.5rem;
        padding: 2rem 0.5rem;
    }

    .pdf-preview-sheet {
        width: 100%;
        max-width: 100%;
        padding: 15mm 8mm;
        min-height: auto;
    }

    .preview-row {
        flex-direction: column;
        margin-bottom: 1rem;
    }

    .preview-label,
    .preview-value {
        width: 100%;
    }

    .preview-value {
        border-bottom-style: solid;
        padding-left: 0;
        margin-top: 4px;
    }
}
