/* ============================================
   FORM CONTROLS - Version Light
   Sans conflit avec les styles existants
   ============================================ */

/* ---------- ETATS DE VALIDATION UNIQUEMENT ---------- */

/* État valide - Ajoute uniquement les classes sans impacter les styles existants */
.form-group input.is-valid,
.form-group textarea.is-valid,
.form-group select.is-valid {
    border-color: #28a745 !important;
    background-color: #f0fff4 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2328a745' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'%3E%3C/path%3E%3Cpolyline points='22 4 12 14.01 9 11.01'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.2rem;
    padding-right: 2.8rem;
}

/* État invalide */
.form-group input.is-invalid,
.form-group textarea.is-invalid,
.form-group select.is-invalid {
    border-color: #dc3545 !important;
    background-color: #fff5f5 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23dc3545' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='15' y1='9' x2='9' y2='15'%3E%3C/line%3E%3Cline x1='9' y1='9' x2='15' y2='15'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.2rem;
    padding-right: 2.8rem;
    animation: shake 0.3s ease-in-out;
}

/* ---------- ANIMATIONS ---------- */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

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

/* ---------- MESSAGES D'ERREUR ---------- */
.error-message {
    display: none;
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    align-items: center;
    gap: 0.5rem;
    animation: fadeIn 0.3s ease-in;
}

.error-message.show {
    display: flex !important;
}

.error-message::before {
    content: "⚠️";
    font-size: 1rem;
    flex-shrink: 0;
}

/* Message de succès */
.success-message {
    display: none;
    color: #28a745;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    align-items: center;
    gap: 0.5rem;
    animation: fadeIn 0.3s ease-in;
}

.success-message.show {
    display: flex !important;
}

.success-message::before {
    content: "✅";
    font-size: 1rem;
    flex-shrink: 0;
}

/* ---------- HELPER TEXT ---------- */
.helper-text {
    display: block;
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.3rem;
    transition: all 0.3s ease;
}

.helper-text.error {
    color: #dc3545;
}

.helper-text.success {
    color: #28a745;
}

.helper-text .helper-icon {
    margin-right: 0.25rem;
}

/* ---------- ERREUR GLOBALE ---------- */
.global-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #dc3545;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: none;
}

.global-error.show {
    display: block;
}

.global-error ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.5rem;
}

.global-error ul li {
    margin-bottom: 0.25rem;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
    .error-message,
    .success-message {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }

    .helper-text {
        font-size: 0.75rem;
    }
}
