/* =========================================
   STILE DEL FORM "PREMIUM"
   ========================================= */

/* Contenitore principale del form */
.itw-form-wrapper {
    background: #ffffff;
    border-radius: 1.5rem; /* Stesso raggio delle card */
    padding: 3rem 2.5rem; /* Spazio abbondante per respirare */
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.08); /* Ombra morbida */
    border: 0.0625rem solid rgba(0, 0, 0, 0.03);
}

/* Titolo del modulo */
.itw-form-title {
    color: var(--itw-primary);
    font-weight: 800;
    font-size: 1.8rem;
    margin-bottom: 2.5rem;
    text-align: center;
}

/* Etichette dei campi (Labels) */
.itw-form-label {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08rem;
    color: var(--itw-text-muted);
    margin-bottom: 0.5rem;
    display: block;
}

/* Campi di input, select e textarea */
.itw-form-control {
    width: 100%;
    background-color: #f8f9fa; /* Grigio chiarissimo elegante */
    border: 0.125rem solid transparent; /* Bordo invisibile di base per evitare scatti su hover */
    border-radius: 0.75rem; /* Angoli arrotondati, ma meno della card */
    padding: 0.875rem 1.2rem;
    font-size: 1rem;
    color: var(--itw-text-dark);
    transition: all 0.3s ease;
    box-shadow: inset 0 0.125rem 0.25rem rgba(0, 0, 0, 0.02); /* Leggerissima ombra interna */
}

/* Effetto Focus (quando l'utente clicca sul campo) */
.itw-form-control:focus {
    background-color: #ffffff;
    border-color: var(--itw-primary);
    box-shadow: 0 0 0 0.25rem var(--itw-primary-light); /* "Bagliore" azzurro esterno */
    outline: none;
}

/* Checkbox Privacy personalizzata */
.itw-form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.15rem;
    cursor: pointer;
}

.itw-form-check-input:checked {
    background-color: var(--itw-primary);
    border-color: var(--itw-primary);
}

.itw-form-privacy-label {
    font-size: 0.9rem;
    color: var(--itw-text-muted);
    cursor: pointer;
}

.itw-form-privacy-label a {
    color: var(--itw-primary);
    text-decoration: none;
    font-weight: 600;
}

.itw-form-privacy-label a:hover {
    text-decoration: underline;
}

/* Pulsante di invio (Eredita lo stile "pillola" moderno) */
.itw-form-btn-submit {
    background-color: var(--itw-primary);
    color: #ffffff;
    border: none;
    border-radius: 2.5rem;
    padding: 1rem 3rem;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 1rem;
    letter-spacing: 0.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 0.5rem 1.5rem rgba(3, 169, 244, 0.3);
    cursor: pointer;
    width: 100%; /* Su mobile occupa tutto lo spazio */
}

.itw-form-btn-submit:hover {
    background-color: #0288D1;
    transform: translateY(-0.2rem);
    box-shadow: 0 0.75rem 2rem rgba(3, 169, 244, 0.4);
}

@media (min-width: 768px) {
    .itw-form-btn-submit {
        width: auto; /* Su desktop si adatta al testo */
        min-width: 200px;
    }
}

/* =========================================
   STATI DEL FORM: ERRORI E CARICAMENTO
   ========================================= */

/* Allerta generale di errore (sostituisce il form) */
.itw-alert-danger {
    background-color: #fff1f0;
    border-left: 0.3rem solid #ff4d4f; /* Bordo spesso a sinistra */
    border-radius: 0.5rem;
    padding: 1.5rem;
    color: #cf1322;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 0.25rem 1rem rgba(255, 77, 79, 0.1);
}

.itw-alert-danger i {
    font-size: 2rem;
}

.itw-alert-danger div {
    font-weight: 600;
    font-size: 1.05rem;
}

/* Stato di Caricamento (Loader) */
.itw-form-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
    color: var(--itw-primary);
}

.itw-form-loader .spinner-border {
    width: 3rem;
    height: 3rem;
    margin-bottom: 1.5rem;
    border-width: 0.25rem;
}

.itw-form-loader p {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.05rem;
    color: var(--itw-text-dark);
}

/* =========================================
   VALIDAZIONE SINGOLI CAMPI
   ========================================= */

/* Quando un campo ha la classe 'is-invalid' */
.itw-form-control.is-invalid {
    border-color: #ff4d4f !important;
    background-color: #fffcfc !important; /* Leggerissimo sfondo rosso */
    box-shadow: 0 0 0 0.25rem rgba(255, 77, 79, 0.15) !important;
}

/* Testo dell'errore sotto il campo */
.itw-form-wrapper .invalid-feedback {
    font-size: 0.85rem;
    font-weight: 600;
    color: #ff4d4f;
    margin-top: 0.4rem;
    /* Bootstrap gestisce già il display:block quando il campo precedente è is-invalid */
}