/* Styles pour les erreurs de validation dans les formulaires */

/* Champs avec erreurs */
.is-invalid {
    border-color: #dc3545 !important;
    background-color: #fff5f5 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.is-invalid:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

/* Messages d'erreur */
.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #dc3545;
    font-weight: 500;
    line-height: 1.4;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    animation: fadeIn 0.3s ease-in-out;
}

/* Animation pour les messages d'erreur */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Labels des champs avec erreurs */
.is-invalid + label,
.is-invalid ~ label {
    color: #dc3545 !important;
    font-weight: 600;
}

/* Icônes dans les champs avec erreurs */
.is-invalid + .input-group-text,
.is-invalid ~ .input-group-text {
    border-color: #dc3545 !important;
    background-color: #f8d7da !important;
}

/* Select2 avec erreurs */
.select2-container--default .select2-selection--single.is-invalid {
    border-color: #dc3545 !important;
    background-color: #fff5f5 !important;
}

/* Focus sur les champs avec erreurs */
.is-invalid:focus {
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.15) !important;
}

/* Style pour les champs de type file avec erreurs */
.is-invalid[type="file"] {
    border-color: #dc3545 !important;
    background-color: #fff5f5 !important;
}

/* Style pour les textarea avec erreurs */
.is-invalid textarea {
    border-color: #dc3545 !important;
    background-color: #fff5f5 !important;
}

/* Style pour les selects avec erreurs */
.is-invalid select {
    border-color: #dc3545 !important;
    background-color: #fff5f5 !important;
}

/* Animation de secousse */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.is-invalid {
    animation: shake 0.5s ease-in-out;
}

/* Conteneur du formulaire avec erreurs */
.form-group.has-error .form-label {
    color: #dc3545 !important;
    font-weight: 600;
}

/* Boutons dans les formulaires avec erreurs */
.form-group.has-error .btn {
    border-color: #dc3544;
    background-color: #dc3544;
}

/* Messages d'erreur multiples */
.invalid-feedback ul {
    margin: 0;
    padding-left: 1.2rem;
    list-style-type: disc;
}

.invalid-feedback li {
    margin-bottom: 0.25rem;
}

.invalid-feedback li:last-child {
    margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .invalid-feedback {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
}
