/* ===== SISTEMA CHECKBOX COMPLETAMENTE RINNOVATO ===== */

/* Base styles per tutti i dispositivi */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.checkbox-row {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.checkbox-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 176, 1, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.checkbox-item:hover {
    background: rgba(255, 176, 1, 0.1);
    border-color: rgba(255, 176, 1, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 176, 1, 0.2);
}

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

.checkmark {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 176, 1, 0.6);
    border-radius: 6px;
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.checkbox-item input[type="checkbox"]:checked + .checkmark {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(255, 176, 1, 0.5);
    transform: scale(1.1);
}

.checkbox-item input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

.checkbox-item:has(input[type="checkbox"]:checked) {
    background: rgba(255, 176, 1, 0.15);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 176, 1, 0.3);
}

/* Desktop: Layout verticale */
@media (min-width: 769px) {
    .checkbox-group {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    
    .checkbox-row {
        display: flex;
        gap: 1rem;
        justify-content: space-between;
    }
    
    .checkbox-item {
        flex: 1;
        min-width: 0;
        font-size: 1.1rem;
        padding: 1rem;
        text-align: left;
        flex-direction: row;
        gap: 0.8rem;
    }
    
    .checkmark {
        width: 24px;
        height: 24px;
        flex-shrink: 0;
    }
}

/* Mobile: Layout orizzontale 2x2 */
@media (max-width: 768px) {
    .checkbox-group {
        gap: 1.2rem;
    }
    
    .checkbox-row {
        gap: 1rem;
    }
    
    .checkbox-item {
        flex: 1;
        min-width: 0;
        font-size: 1.2rem;
        font-weight: 600;
        padding: 1.2rem 0.8rem;
        text-align: center;
        flex-direction: column;
        gap: 0.6rem;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .checkbox-item span.checkmark {
        display: block !important;
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        flex-basis: auto !important;
    }
    
    .checkmark {
        width: 24px !important;
        height: 24px !important;
        margin: 0 auto !important;
        border: 2px solid rgba(255, 176, 1, 0.8) !important;
        border-radius: 6px !important;
        background: rgba(255, 255, 255, 0.15) !important;
        box-shadow: 
            0 2px 8px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
        min-width: 24px !important;
        min-height: 24px !important;
        max-width: 24px !important;
        max-height: 24px !important;
    }
    
    .checkbox-item input[type="checkbox"]:checked + .checkmark {
        background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)) !important;
        border-color: var(--primary-color) !important;
        box-shadow: 
            0 0 20px rgba(255, 176, 1, 0.6),
            inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
        transform: scale(1.15) !important;
        width: 24px !important;
        height: 24px !important;
    }
    
    .checkbox-item input[type="checkbox"]:checked + .checkmark::after {
        content: '✓';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        color: white;
        font-size: 14px;
        font-weight: bold;
        text-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
    }
}

/* Tablet: Layout ottimizzato */
@media (max-width: 1024px) and (min-width: 769px) {
    .checkbox-item {
        font-size: 1.3rem;
        padding: 1.2rem 1rem;
        min-height: 60px;
    }
    
    .checkmark {
        width: 26px;
        height: 26px;
    }
}

/* iPhone/Android: Layout compatto */
@media (max-width: 480px) {
    .checkbox-item {
        font-size: 1.1rem;
        padding: 1rem 0.6rem;
        min-height: 50px;
    }
    
    .checkmark {
        width: 20px !important;
        height: 20px !important;
        border: 2px solid rgba(255, 176, 1, 0.8) !important;
        border-radius: 5px !important;
        background: rgba(255, 255, 255, 0.15) !important;
        box-shadow: 
            0 2px 6px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
        min-width: 20px !important;
        min-height: 20px !important;
        max-width: 20px !important;
        max-height: 20px !important;
    }
    
    .checkbox-item input[type="checkbox"]:checked + .checkmark {
        background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
        border-color: var(--primary-color);
        box-shadow: 
            0 0 15px rgba(255, 176, 1, 0.6),
            inset 0 1px 0 rgba(255, 255, 255, 0.4);
        transform: scale(1.1);
    }
    
    .checkbox-item input[type="checkbox"]:checked + .checkmark::after {
        content: '✓';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        color: white;
        font-size: 12px;
        font-weight: bold;
        text-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
    }
}

/* iPad: Layout ottimizzato */
@media (max-width: 1024px) and (min-width: 769px) and (-webkit-min-device-pixel-ratio: 1) {
    .checkbox-item {
        font-size: 1.4rem;
        padding: 1.3rem 1rem;
        min-height: 65px;
    }
    
    .checkmark {
        width: 22px !important;
        height: 22px !important;
        border: 2px solid rgba(255, 176, 1, 0.8) !important;
        border-radius: 6px !important;
        background: rgba(255, 255, 255, 0.15) !important;
        box-shadow: 
            0 3px 10px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
        min-width: 22px !important;
        min-height: 22px !important;
        max-width: 22px !important;
        max-height: 22px !important;
    }
    
    .checkbox-item input[type="checkbox"]:checked + .checkmark {
        background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
        border-color: var(--primary-color);
        box-shadow: 
            0 0 18px rgba(255, 176, 1, 0.6),
            inset 0 1px 0 rgba(255, 255, 255, 0.4);
        transform: scale(1.12);
    }
    
    .checkbox-item 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;
        text-shadow: 0 0 7px rgba(0, 0, 0, 0.5);
    }
}
