/**
 * Form Feedback Styles
 * Handles validation states, loading indicators and user messages
 */

/* ==========================================
   VALIDATION STATES
   ========================================== */

/* Input validation - error state */
.form-contact input.error,
.form-contact textarea.error {
    border: 2px solid #dc3545;
    background-color: #fff5f5;
}

/* Input validation - success state */
.form-contact input.success,
.form-contact textarea.success {
    border: 2px solid #28a745;
    background-color: #f0fff4;
}

/* Error message below field */
.field-error {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
    animation: slideDown 0.3s ease;
}

/* ==========================================
   LOADING STATE
   ========================================== */

/* Disable button during submit */
.form-contact button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
}

/* Loading spinner */
.form-contact button[type="submit"].loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

.form-contact button[type="submit"].loading {
    padding-right: 40px;
}

/* ==========================================
   MESSAGES UTILISATEUR
   ========================================== */

/* Message box styles */
.form-contact-message-confirmation {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    font-weight: 500;
    animation: slideDown 0.4s ease;
    role: alert;
}

.form-contact-message-confirmation.ok {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.form-contact-message-confirmation.erreur {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Auto-dismiss indicator */
.form-contact-message-confirmation::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    vertical-align: middle;
}

.form-contact-message-confirmation.ok::before {
    content: '✅';
}

.form-contact-message-confirmation.erreur::before {
    content: '❌';
}

/* ==========================================
   ANIMATIONS
   ========================================== */

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

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

/* ==========================================
   ACCESSIBILITY
   ========================================== */

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible for keyboard navigation */
.form-contact input:focus-visible,
.form-contact textarea:focus-visible,
.form-contact button:focus-visible {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
}

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

@media (max-width: 768px) {
    .form-contact-message-confirmation {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .field-error {
        font-size: 0.8rem;
    }
}
