document.addEventListener('alpine:init', () => {
    Alpine.data('HF_LIC_APP', () => ({
        nonce: hfngLICData.values.nonce,
        burnNonce: hfngLICData.values.burnNonce,
        canUpgrade:hfngLICData.values.can_upgrade,
        upgradeText:hfngLICData.values.upgrade_text,
        planClass:hfngLICData.values.plan_class,
        
        featureEnabled: hfngLICData.values.feature_enabled,
        checkbox_on: hfngLICData.values.checkbox_on,
        checkbox_off: hfngLICData.values.checkbox_off,
        myResult: '',
        myColor: 'hfng-success',           
        
    }))
});
document.addEventListener('DOMContentLoaded', () => {
    // prendi il piano corrente dal secondo span dentro #hfng-current
    const spans = document.querySelectorAll('#hfng-current span');
    if (spans.length < 2) return;

    const currentPlan = spans[1].textContent.trim().toUpperCase();

    // seleziona tutti i box dei piani
    document.querySelectorAll('.hfng-plan h3').forEach(h3 => {
        const title = h3.textContent.trim().toUpperCase();
        if (title === currentPlan) {
            h3.closest('.hfng-plan').classList.add('hfng-current-plan');
        }
    });
});

