<!-- start Simple Custom CSS and JS -->
<style type="text/css">
/* ============================================================
   1. STILE CONDIVISO (COLORI, FONT, LABEL E FIX TENDINE)
   ============================================================ */

/* Etichette: Blu, Grassetto, Sinistra */
.page-id-514 label, .page-id-1140 label, .page-id-377 label, .page-id-1661 label, .page-id-1020 label,
.page-id-514 .label, .page-id-1140 .label, .page-id-377 .label, .page-id-1661 .label, .page-id-1020 .label {
    text-align: left !important;
    display: block !important;
    width: 100% !important;
    font-weight: 700 !important;
    color: #003399 !important;
    margin-bottom: 5px !important;
    float: none !important;
}

/* Campi Input e Select Standard: Grigio Tenue + TRANSITION */
.page-id-514 input:not([type="radio"]):not([type="checkbox"]), 
.page-id-1140 input:not([type="radio"]):not([type="checkbox"]),
.page-id-377 input:not([type="radio"]):not([type="checkbox"]),
.page-id-1661 input:not([type="radio"]):not([type="checkbox"]),
.page-id-1020 input:not([type="radio"]):not([type="checkbox"]),
.page-id-514 select, .page-id-1140 select, .page-id-377 select, .page-id-1661 select, .page-id-1020 select {
    height: 55px !important;
    background-color: #f4f6f9 !important;
    border: 1px solid #dbe2e8 !important;
    border-radius: 6px !important;
    padding: 0 15px !important;
    font-size: 16px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin-bottom: 15px !important;
    color: #333 !important;
    transition: all 0.3s ease-in-out !important;
}

/* Stato FOCUS (Click): Bordo Blu + Sfondo Bianco + Ombra */
.page-id-514 input:focus, .page-id-1140 input:focus, .page-id-377 input:focus, .page-id-1661 input:focus, .page-id-1020 input:focus {
    border: 2px solid #003399 !important;
    background-color: #ffffff !important;
    outline: none !important;
    box-shadow: 0 4px 6px rgba(0, 51, 153, 0.1) !important;
}

/* --- UNIVERSAL SELECT2 FIX (TENDINE PROVINCIA E NAZIONE) --- */
.page-id-514 .select2-container, .page-id-1140 .select2-container,
.page-id-377 .select2-container, .page-id-1661 .select2-container, .page-id-1020 .select2-container {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    text-align: left !important;
    z-index: 100 !important;
}

.page-id-514 .select2-container .select2-selection--single,
.page-id-1140 .select2-container .select2-selection--single,
.page-id-377 .select2-container .select2-selection--single,
.page-id-1661 .select2-container .select2-selection--single,
.page-id-1020 .select2-container .select2-selection--single,
.page-id-514 .select2-container .select2-choice,
.page-id-1140 .select2-container .select2-choice,
.page-id-377 .select2-container .select2-choice,
.page-id-1661 .select2-container .select2-choice,
.page-id-1020 .select2-container .select2-choice {
    height: 55px !important;
    background-color: #f4f6f9 !important;
    background-image: none !important;
    border: 1px solid #dbe2e8 !important;
    border-radius: 6px !important;
    padding-left: 15px !important;
    box-sizing: border-box !important;
    color: #333 !important;
    font-size: 16px !important;
    line-height: 53px !important;
}

.page-id-514 .select2-container .select2-dropdown,
.page-id-1140 .select2-container .select2-dropdown,
.page-id-377 .select2-container .select2-dropdown,
.page-id-1661 .select2-container .select2-dropdown,
.page-id-1020 .select2-container .select2-dropdown {
    width: 100% !important;
    min-width: 200px !important;
    max-width: 100% !important;
    border: 1px solid #003399 !important;
    background: #fff !important;
    z-index: 9999999 !important;
    box-sizing: border-box !important;
    left: 0 !important;
}

.page-id-514 .select2-selection__arrow, .page-id-1140 .select2-selection__arrow,
.page-id-377 .select2-selection__arrow, .page-id-1661 .select2-selection__arrow, .page-id-1020 .select2-selection__arrow,
.page-id-514 .select2-arrow, .page-id-1140 .select2-arrow,
.page-id-377 .select2-arrow, .page-id-1661 .select2-arrow, .page-id-1020 .select2-arrow {
    height: 53px !important;
    top: 1px !important; 
    background-image: none !important;
    background: transparent !important;
    border-left: none !important;
}

/* --- Bottoni Invio (Generale) --- */
.page-id-377 .crm-button, .page-id-1661 .crm-button, .page-id-1020 .crm-button,
.page-id-514 .crm-submit-button, .page-id-1140 .crm-submit-button,
.page-id-514 button.crm-form-submit, .page-id-1140 button.crm-form-submit {
    background-color: #003399 !important;
    color: #ffffff !important;
    padding: 15px 50px !important;
    border-radius: 6px !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    border: none !important;
    cursor: pointer !important;
    display: inline-block !important;
    margin-top: 20px !important;
    background-image: none !important;
}

.page-id-514 button::before, .page-id-1140 button::before { 
    display: none !important;
}

/* REGOLE SPECIFICHE PULSANTI PAGINA 377/1661 (Tesseramento) E 1020 (Donazione) */
.page-id-377 #_qf_Main_upload-bottom, .page-id-1661 #_qf_Main_upload-bottom, .page-id-1020 #_qf_Main_upload-bottom {
    text-indent: -9999px !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    width: auto !important;
}

.page-id-377 #_qf_Main_upload-bottom:after, .page-id-1661 #_qf_Main_upload-bottom:after, .page-id-1020 #_qf_Main_upload-bottom:after {
    text-indent: 0 !important;
    display: block !important;
    background-color: #003399 !important;
    color: #ffffff !important;
    padding: 15px 50px !important;
    border-radius: 6px !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    margin: 0 !important; 
}

.page-id-377 #_qf_Main_upload-bottom:after, .page-id-1661 #_qf_Main_upload-bottom:after {
    content: "VOGLIO TESSERARMI" !important;
}

.page-id-1020 #_qf_Main_upload-bottom:after {
    content: "VOGLIO DONARE" !important;
}

/* ============================================================
   2. LAYOUT SPECIFICO PER IL PROFILO (ID 514) E ONBOARDING (ID 1140)
   ============================================================ */

.page-id-514 .crm-section .content, .page-id-1140 .crm-section .content {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: center !important;
    float: none !important;
    width: 100% !important;
    padding-left: 0 !important;
}

/* ============================================================
   3. LAYOUT SPECIFICO PER IL TESSERAMENTO (ID 377/1661) E DONAZIONE (ID 1020)
   ============================================================ */

.page-id-377 .crm-section .content, .page-id-1661 .crm-section .content, .page-id-1020 .crm-section .content {
    display: block !important;
    text-align: left !important;
    float: none !important;
    width: 100% !important;
    padding-left: 0 !important;
}

/* Bottoni allineati a SX */
.page-id-377 .crm-submit-buttons, .page-id-1661 .crm-submit-buttons, .page-id-1020 .crm-submit-buttons {
    text-align: left !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
    display: block !important;
}

/* --- PULSANTI IMPORTO (Radio Button Nascosti) --- */
.page-id-377 .price-set-row input[type="radio"], .page-id-1661 .price-set-row input[type="radio"], .page-id-1020 .price-set-row input[type="radio"] { 
    display: none !important;
}

/* Contenitore pulsanti (Etichette come Bottoni) */
.page-id-377 .price-set-row, .page-id-1661 .price-set-row, .page-id-1020 .price-set-row {
    display: inline-block !important;
    width: auto !important;
    margin-right: 10px !important;
    margin-bottom: 10px !important;
    vertical-align: top !important;
}

/* Stile Base Pulsante */
.page-id-377 .price-set-row label, .page-id-1661 .price-set-row label, .page-id-1020 .price-set-row label {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 12px 25px !important;
    background-color: #ffffff !important;
    color: #003399 !important;
    border: 2px solid #003399 !important;
    border-radius: 6px !important;
    font-weight: 700 !important;
    min-width: 100px !important;
    height: 50px !important;
    cursor: pointer !important;
    margin: 0 !important;
}

/* Pulsante SELEZIONATO */
.page-id-377 .price-set-row input:checked + label, .page-id-1661 .price-set-row input:checked + label, .page-id-1020 .price-set-row input:checked + label {
    background-color: #003399 !important;
    color: #ffffff !important; 
    transform: scale(1.05) !important;
}

/* Nasconde specificamente l'opzione "- Nessuno -" */
.page-id-377 .price-set-row input[type="radio"][value=""],
.page-id-377 .price-set-row input[type="radio"][value=""] + label,
.page-id-1661 .price-set-row input[type="radio"][value=""],
.page-id-1661 .price-set-row input[type="radio"][value=""] + label,
.page-id-1020 .price-set-row input[type="radio"][value=""],
.page-id-1020 .price-set-row input[type="radio"][value=""] + label {
    display: none !important;
}

/* --- FIX PAGAMENTI --- */
.page-id-377 .payment_options-group legend, .page-id-1661 .payment_options-group legend, .page-id-1020 .payment_options-group legend { 
    display: none !important;
}

.page-id-377 .payment_processor-section .content, .page-id-1661 .payment_processor-section .content, .page-id-1020 .payment_processor-section .content {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 30px !important;
    justify-content: flex-start !important;
    align-items: center !important;
}
.page-id-377 .payment_processor-section input[type="radio"], .page-id-1661 .payment_processor-section input[type="radio"], .page-id-1020 .payment_processor-section input[type="radio"] {
    display: inline-block !important;
    width: 20px !important;
    height: 20px !important;
    margin: 0 !important;
    accent-color: #003399 !important;
    vertical-align: middle !important;
}
.page-id-377 .payment_processor-section label, .page-id-1661 .payment_processor-section label, .page-id-1020 .payment_processor-section label {
    display: inline-block !important;
    width: auto !important;
    margin-bottom: 0 !important;
    margin-left: 8px !important;
    text-align: left !important;
    vertical-align: middle !important;
    cursor: pointer !important;
}

/* Totale */
.page-id-377 #pricesetTotal, .page-id-1661 #pricesetTotal, .page-id-1020 #pricesetTotal { 
    margin-bottom: 20px !important;
}
.page-id-377 #pricesetTotal .content, .page-id-1661 #pricesetTotal .content, .page-id-1020 #pricesetTotal .content {
    font-size: 40px !important;
    font-weight: 800 !important;
    color: #003399 !important;
    text-align: left !important;
}

/* --- FIX PRIVACY (VALIDATO) --- */
.page-id-377 .custom_pre_profile-group fieldset > div:has(input[type="checkbox"]), 
.page-id-1661 .custom_pre_profile-group fieldset > div:has(input[type="checkbox"]),
.page-id-1020 .custom_pre_profile-group fieldset > div:has(input[type="checkbox"]) {
    width: 100% !important;
    float: none !important;
    clear: both !important;
    display: block !important;
    margin-right: 0 !important;
    margin-bottom: 30px !important;
}
.page-id-377 input[type="checkbox"], .page-id-1661 input[type="checkbox"], .page-id-1020 input[type="checkbox"] {
    display: inline-block !important;
    width: 20px !important;
    height: 20px !important;
    margin: 0 !important;
    accent-color: #003399 !important;
    vertical-align: middle !important;
}
.page-id-377 input[type="checkbox"] + label, .page-id-1661 input[type="checkbox"] + label, .page-id-1020 input[type="checkbox"] + label {
    display: inline-block !important;
    width: auto !important;
    margin-left: 10px !important;
    margin-bottom: 0 !important;
    text-align: left !important;
    vertical-align: middle !important;
}

/* LAYOUT DESKTOP */
@media (min-width: 992px) {
    /* 1. Anagrafica su 2 colonne (eccetto Privacy) */
    .page-id-377 .custom_pre_profile-group fieldset > div[class*=' editrow_']:not(:has(input[type="checkbox"])),
    .page-id-1661 .custom_pre_profile-group fieldset > div[class*=' editrow_']:not(:has(input[type="checkbox"])),
    .page-id-1020 .custom_pre_profile-group fieldset > div[class*=' editrow_']:not(:has(input[type="checkbox"])) {
        width: 47% !important;
        float: left !important;
        margin-right: 3% !important;
        margin-bottom: 20px !important;
        clear: none !important;
        display: block !important;
    }
    .page-id-377 .custom_pre_profile-group fieldset:after, 
    .page-id-1661 .custom_pre_profile-group fieldset:after,
    .page-id-1020 .custom_pre_profile-group fieldset:after {
        content: "";
        display: table;
        clear: both;
    }

    /* 2. FIX WIDTH & FOCUS IMPORTO PERSONALIZZATO */
    .page-id-377 input[id^="price_"][type="text"],
    .page-id-377 input[name^="price_"][type="text"],
    .page-id-1661 input[id^="price_"][type="text"],
    .page-id-1661 input[name^="price_"][type="text"],
    .page-id-1020 input[id^="price_"][type="text"],
    .page-id-1020 input[name^="price_"][type="text"] {
        width: 47% !important;
        min-width: 0 !important;
    }
    
    .page-id-377 input[id^="price_"]:focus,
    .page-id-377 input[name^="price_"]:focus,
    .page-id-1661 input[id^="price_"]:focus,
    .page-id-1661 input[name^="price_"]:focus,
    .page-id-1020 input[id^="price_"]:focus,
    .page-id-1020 input[name^="price_"]:focus {
        border: 2px solid #003399 !important;
        background-color: #ffffff !important;
        box-shadow: 0 4px 6px rgba(0, 51, 153, 0.1) !important;
    }
}

/* 3. nasconde il campo "-nessuno-" */
input[type="radio"][name^="price_"][value="0"],
input[type="radio"][name^="price_"][value="0"] + label {
    display: none !important;
}

/* ============================================================
   4. FUNZIONALITÀ EXTRA: NASCONDI BENVENUTO E SPAZIO HEADER
   ============================================================ */

/* NASCONDI RIGA BENVENUTO */
.page-id-377 div:has(> a[href*="reset=1"]), .page-id-1661 div:has(> a[href*="reset=1"]),
.page-id-377 p:has(> a[href*="reset=1"]), .page-id-1661 p:has(> a[href*="reset=1"]),
.page-id-377 .messages:has(> a[href*="reset=1"]), .page-id-1661 .messages:has(> a[href*="reset=1"]),
.page-id-377 .crm-not-you-message, .page-id-1661 .crm-not-you-message,
.page-id-1020 div:has(> a[href*="reset=1"]),
.page-id-1020 p:has(> a[href*="reset=1"]),
.page-id-1020 .messages:has(> a[href*="reset=1"]),
.page-id-1020 .crm-not-you-message {
    display: none !important;
}

/* SPAZIO SOTTO IL TITOLO (HEADER) */
.page-id-377 .crm-contribution-main-form-block, .page-id-1661 .crm-contribution-main-form-block, .page-id-1020 .crm-contribution-main-form-block {
    margin-top: 60px !important;
    display: block !important;
}

/* Nasconde il contenitore dei pulsanti nativi Afform nelle pagine 514 e 1140 */
.page-id-514 [af-form] .af-form-buttons,
.page-id-1140 [af-form] .af-form-buttons {
    display: none !important;
}

/* ============================================================
   5. FIX CAMPO DONAZIONE RICORRENTE (SOLO ID 1020)
   ============================================================ */

/* 1. Nascondiamo la select nativa di CiviCRM per rimuovere il duplicato */
.page-id-1020 .is_recur-group select,
.page-id-1020 .is_recur-section select {
    display: none !important;
}

/* 2. Gestione Margini */
.page-id-1020 .is_recur-group,
.page-id-1020 .is_recur-section {
    display: block !important;
    width: 100% !important;
    margin-top: 15px !important;
    margin-bottom: 35px !important;
    clear: both !important;
}

/* 3. Larghezza widget Select2 */
.page-id-1020 .is_recur-group .select2-container,
.page-id-1020 .is_recur-section .select2-container {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    text-align: left !important;
    margin-top: 10px !important;
}

@media (min-width: 992px) {
    .page-id-1020 .is_recur-group .select2-container,
    .page-id-1020 .is_recur-section .select2-container {
        width: 47% !important;
    }
}

/* 4. Stile grafico Select2 Ricorrente */
.page-id-1020 .is_recur-group .select2-container .select2-selection--single,
.page-id-1020 .is_recur-section .select2-container .select2-selection--single,
.page-id-1020 .is_recur-group .select2-container .select2-choice,
.page-id-1020 .is_recur-section .select2-container .select2-choice {
    height: 55px !important;
    background-color: #f4f6f9 !important;
    background-image: none !important;
    border: 1px solid #dbe2e8 !important;
    border-radius: 6px !important;
    padding-left: 15px !important;
    box-sizing: border-box !important;
    color: #333 !important;
    font-size: 16px !important;
    line-height: 53px !important;
}

/* 5. Allineamento freccina */
.page-id-1020 .is_recur-group .select2-container .select2-selection__arrow,
.page-id-1020 .is_recur-section .select2-container .select2-selection__arrow,
.page-id-1020 .is_recur-group .select2-container .select2-choice .select2-arrow,
.page-id-1020 .is_recur-section .select2-container .select2-choice .select2-arrow {
    height: 53px !important;
    top: 1px !important; 
    background-image: none !important;
    background: transparent !important;
    border-left: none !important;
}

/* --- Fix Spaziatura Dinamica Metodo di Pagamento --- */
.page-id-377 .payment_options-group, 
.page-id-1661 .payment_options-group,
.page-id-514 .payment_options-group, 
.page-id-1140 .payment_options-group,
.page-id-1020 .payment_options-group {
    margin-top: 50px !important;
    display: block !important;
    clear: both !important;
}

.page-id-377 .custom_pre_profile-group fieldset,
.page-id-1661 .custom_pre_profile-group fieldset,
.page-id-514 .custom_pre_profile-group fieldset,
.page-id-1140 .custom_pre_profile-group fieldset,
.page-id-1020 .custom_pre_profile-group fieldset {
    margin-bottom: 40px !important;
}</style>
<!-- end Simple Custom CSS and JS -->
