/* Correctifs pour les cases à cocher sur les formulaires */

/* Amélioration de la zone cliquable */
.custom-checkbox {
    display: block;
    position: relative;
    min-height: 24px;
    padding-left: 35px;
    cursor: pointer;
    margin-bottom: 15px;
}

/* Style pour la case à cocher visible */
.custom-checkbox .checkbox-icon {
    position: absolute;
    top: 0;
    left: 0;
    height: 24px;
    width: 24px;
    background-color: #fff;
    border: 2px solid #e5e9f2;
    border-radius: 6px;
    transition: all 0.2s ease;
}

/* États actifs et hover */
.custom-checkbox:hover .checkbox-icon {
    border-color: #142c69;
    box-shadow: 0 0 0 3px rgba(20, 44, 105, 0.1);
}

.custom-checkbox.checked .checkbox-icon,
.custom-checkbox input:checked ~ .checkbox-icon {
    background-color: #142c69;
    border-color: #142c69;
}

/* Style de la coche */
.custom-checkbox .checkbox-icon:after {
    content: '';
    position: absolute;
    display: none;
    left: 8px;
    top: 4px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.custom-checkbox.checked .checkbox-icon:after,
.custom-checkbox input:checked ~ .checkbox-icon:after {
    display: block;
}

/* Masquer la case à cocher native mais la garder accessible */
.custom-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Zone de texte du label */
.custom-checkbox .checkbox-text {
    display: inline-block;
    line-height: 1.5;
    padding: 0;
    vertical-align: top;
    margin-left: 8px;
}

/* Correction pour la partie en texte */
.custom-checkbox label {
    cursor: pointer;
    display: flex;
    align-items: flex-start;
}

/* Styles pour le focus */
.custom-checkbox input:focus ~ .checkbox-icon {
    border-color: #142c69;
    box-shadow: 0 0 0 3px rgba(20, 44, 105, 0.2);
}

/* Gestion des erreurs */
.form-group.has-error .custom-checkbox .checkbox-icon {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.form-group.has-error .checkbox-text {
    color: #ef4444;
}

/* Animation de vibration d'erreur */
@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.shake-error {
    animation: shakeError 0.5s linear;
}

/* Message d'erreur pour les champs */
.error-message {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 5px;
    display: block;
    padding: 6px 12px;
    background-color: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
    border-left: 3px solid #ef4444;
    transition: all 0.3s ease;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Style pour le bouton de soumission en état de chargement */
button[type="submit"].loading {
    opacity: 0.8;
    cursor: wait;
}

/* Style pour la case à cocher avec erreur spécifique */
.consent-group.has-error {
    padding: 10px;
    border-radius: 6px;
    background-color: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
