/**
 * STYLES VALIDATION FORMULAIRE - UPPERFORMA
 * Styles pour la validation temps réel avec accessibilité
 */

/* ===== ÉTATS DES CHAMPS ===== */

/* Champ avec erreur */
.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: #DC3545 !important;
    background-color: #FFF5F5;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.form-group input.error:focus,
.form-group select.error:focus,
.form-group textarea.error:focus {
    border-color: #DC3545 !important;
    outline: 2px solid #DC3545;
    outline-offset: 2px;
}

/* Champ valide */
.form-group input.valid,
.form-group select.valid,
.form-group textarea.valid {
    border-color: #28A745 !important;
    background-color: #F0FFF4;
}

.form-group input.valid:focus,
.form-group select.valid:focus,
.form-group textarea.valid:focus {
    border-color: #28A745 !important;
    outline: 2px solid #28A745;
    outline-offset: 2px;
}

/* ===== MESSAGE D'ERREUR ===== */

.error-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    background: #FFF5F5;
    border-left: 4px solid #DC3545;
    border-radius: 4px;
    color: #DC3545;
    font-size: 0.875rem;
    font-weight: 500;
    animation: slideDown 0.3s ease;
}

.error-message::before {
    content: '\f06a'; /* Font Awesome exclamation-circle */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 1rem;
}

/* Animation d'apparition */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== MESSAGE DE SUCCÈS ===== */

.form-success-message {
    animation: slideDown 0.3s ease;
}

.form-success-message i {
    flex-shrink: 0;
}

/* ===== ACCESSIBILITÉ ===== */

/* Focus visible pour clavier */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #E65C18;
    outline-offset: 2px;
}

/* Mode contraste élevé */
@media (prefers-contrast: high) {
    .error-message {
        border: 2px solid #DC3545;
        background: white;
    }
    
    .form-group input.error,
    .form-group select.error,
    .form-group textarea.error {
        border: 3px solid #DC3545 !important;
    }
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
    .error-message {
        font-size: 0.8rem;
        padding: 0.625rem 0.875rem;
    }
}

/* ===== ÉTATS DÉSACTIVÉS ===== */

input:disabled,
select:disabled,
textarea:disabled {
    background-color: #E9ECEF;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ===== LOADER SOUMISSION ===== */

.form-submitting {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.form-submitting::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid #E65C18;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== AMÉLIORATION VISUELLE ===== */

/* Ajout d'une icône de validation */
.form-group {
    position: relative;
}

.form-group input.valid::after,
.form-group select.valid::after {
    content: '\f00c'; /* Font Awesome check */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #28A745;
    font-size: 1.25rem;
}
