/**
 * Styles pour le frontend
 *
 * @package SW_Role_Checkboxes
 */

.sw-role-checkboxes-container {
    margin: 20px 0;
}

.sw-role-checkboxes-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Layout horizontal */
.sw-role-checkboxes-container.sw-layout-horizontal .sw-role-checkboxes-wrapper {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 15px 25px;
}

.sw-role-checkbox-item {
    position: relative;
}

.sw-checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    user-select: none;
}

.sw-checkbox-label:hover .sw-checkbox-text {
    color: #000000;
}

.sw-role-checkbox-input {
    margin: 3px 12px 0 0;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    cursor: pointer;
}

.sw-checkbox-text {
    flex: 1;
    transition: color 0.2s ease;
    color: #000000;
    font-weight: 500;
}

.sw-checkbox-text .required {
    color: #d63638;
    font-weight: bold;
    margin-left: 3px;
}

/* États du checkbox */
.sw-role-checkbox-input:focus {
    outline: 2px solid #000000;
    outline-offset: 2px;
}

.sw-role-checkbox-input:checked + .sw-checkbox-text {
    font-weight: 600;
    color: #000000;
}

/* Message d'erreur */
.sw-role-checkboxes-container .error {
    color: #d63638;
    font-size: 13px;
    margin-top: 5px;
    display: block;
}

/* Notice pour les admins */
.sw-role-checkboxes-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-left: 4px solid #ffc107;
    padding: 12px 15px;
    margin: 15px 0;
    border-radius: 4px;
    color: #856404;
    font-size: 14px;
}

/* Animation de validation */
.sw-role-checkbox-item.invalid {
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Intégration avec WooCommerce */
.woocommerce-form-register .sw-role-checkboxes-container {
    margin-bottom: 20px;
}

/* Style personnalisé pour les checkbox */
.sw-role-checkbox-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: #fff;
    border: 2px solid #000000;
    border-radius: 4px;
    position: relative;
    transition: all 0.2s ease;
}

.sw-role-checkbox-input:hover {
    border-color: #000000;
    box-shadow: 0 0 0 1px #000000;
}

.sw-role-checkbox-input:checked {
    background: #000000;
    border-color: #000000;
}

.sw-role-checkbox-input:checked::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 7px;
    width: 7px;
    height: 13px;
    border: solid #fff;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

/* Dark mode support (optionnel) */
@media (prefers-color-scheme: dark) {
    .sw-checkbox-label {
        color: #ffffff;
    }
    
    .sw-checkbox-text {
        color: #ffffff;
    }
    
    .sw-role-checkbox-input {
        background: #ffffff;
        border-color: #000000;
    }
    
    .sw-role-checkbox-input:hover {
        border-color: #000000;
    }
    
    .sw-role-checkbox-input:checked {
        background: #000000;
        border-color: #000000;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sw-role-checkboxes-container.sw-layout-horizontal .sw-role-checkboxes-wrapper {
        flex-direction: column;
        gap: 12px;
    }
    
    .sw-checkbox-label {
        font-size: 14px;
    }
    
    .sw-role-checkbox-input {
        width: 22px;
        height: 22px;
        margin-right: 10px;
    }
    
    .sw-role-checkbox-input:checked::before {
        top: 2px;
        left: 6px;
        width: 6px;
        height: 12px;
    }
}

/* Accessibilité */
.sw-role-checkbox-input:focus-visible {
    outline: 2px solid #000000;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .sw-role-checkbox-item.invalid {
        animation: none;
    }
    
    .sw-role-checkbox-input,
    .sw-checkbox-text {
        transition: none;
    }
}

/* État de soumission - empêcher les interactions sans désactiver les champs */
.sw-role-checkboxes-container.sw-submitting {
    pointer-events: none;
    opacity: 0.6;
    position: relative;
}

.sw-role-checkboxes-container.sw-submitting::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.5);
    cursor: wait;
}

/* Titre des cases à cocher */
.sw-role-checkboxes-title {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    color: #000000;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .sw-role-checkboxes-title {
        font-size: 16px;
        margin-bottom: 12px;
    }
}

