/**
 * STYLES POUR LE FORMULAIRE DE CONTACT SÉCURISÉ - UNIV-REMORQUES
 * Amélioration visuelle et UX du nouveau système de contact
 */

/* Conteneur du formulaire de contact */
#contactForm {
    position: relative;
    transition: all 0.3s ease;
}

/* Animation de chargement du formulaire */
#contactForm.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Styles des champs avec erreurs */
#contactForm input.border-red-500,
#contactForm textarea.border-red-500 {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 1px #ef4444;
    animation: shake 0.5s ease-in-out;
}

/* Animation de secousse pour les erreurs */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Messages d'erreur des champs */
.field-error {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: #dc2626;
    margin-top: 0.25rem;
    animation: slideDown 0.3s ease-out;
}

.field-error::before {
    content: "⚠️";
    font-size: 0.75rem;
}

/* Animation d'apparition des erreurs */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Styles pour les champs valides */
#contactForm input:valid:not(:placeholder-shown),
#contactForm textarea:valid:not(:placeholder-shown) {
    border-color: #10b981;
    background-image: url("data:image/svg+xml,%3csvg width='16' height='16' fill='%2310b981' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath d='M12.736 3.97a.733.733 0 0 1 1.047 0c.286.289.29.756.01 1.05L7.88 12.01a.733.733 0 0 1-1.065.02L3.217 8.384a.757.757 0 0 1 0-1.06.733.733 0 0 1 1.047 0l3.052 3.093 5.4-6.425a.247.247 0 0 1 .02-.022Z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 16px;
    padding-right: 2.5rem;
}

/* Container hCaptcha */
.h-captcha {
    margin: 1rem 0;
    display: flex;
    justify-content: center;
}

/* Styles du bouton de soumission */
#contactSubmitBtn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

#contactSubmitBtn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -8px rgba(0, 0, 0, 0.3);
}

#contactSubmitBtn:active:not(:disabled) {
    transform: translateY(0);
}

#contactSubmitBtn:disabled {
    cursor: not-allowed;
    transform: none !important;
}

/* Animation du spinner */
#submitBtnSpinner svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Messages de statut */
#contactSuccess,
#contactError {
    animation: fadeInUp 0.5s ease-out;
    border-radius: 12px;
    box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Message de succès */
#contactSuccess {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 2px solid #bbf7d0;
    color: #166534;
}

#contactSuccess i {
    color: #16a34a;
    animation: bounce 1s ease-in-out;
}

/* Message d'erreur */
#contactError {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 2px solid #fecaca;
    color: #dc2626;
}

#contactError i {
    color: #ef4444;
    animation: shake 0.5s ease-in-out;
}

/* Animation de rebond pour le succès */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -8px, 0);
    }
    70% {
        transform: translate3d(0, -4px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

/* Styles pour les labels */
#contactForm label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    display: block;
}

/* Styles pour les icônes dans les champs */
#contactForm .relative i {
    color: #6b7280;
    transition: color 0.2s ease;
}

#contactForm .relative input:focus + i,
#contactForm .relative textarea:focus + i {
    color: #f59e0b;
}

/* Checkbox de consentement */
#consent {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: #f59e0b;
    cursor: pointer;
}

#consent:checked {
    animation: checkmark 0.3s ease-in-out;
}

@keyframes checkmark {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Label du consentement */
label[for="consent"] {
    cursor: pointer;
    user-select: none;
    line-height: 1.4;
    color: #6b7280;
}

label[for="consent"]:hover {
    color: #374151;
}

/* Responsive */
@media (max-width: 768px) {
    #contactForm {
        padding: 1.5rem !important;
    }
    
    .h-captcha {
        transform: scale(0.9);
        transform-origin: center;
    }
    
    #contactForm input:valid:not(:placeholder-shown),
    #contactForm textarea:valid:not(:placeholder-shown) {
        background-size: 14px 14px;
        padding-right: 2rem;
    }
}

/* Focus visible pour l'accessibilité */
#contactForm input:focus-visible,
#contactForm textarea:focus-visible,
#contactForm button:focus-visible {
    outline: 2px solid #f59e0b;
    outline-offset: 2px;
}

/* Amélioration du contraste pour l'accessibilité */
@media (prefers-contrast: high) {
    #contactForm input,
    #contactForm textarea {
        border-width: 2px;
    }
    
    .field-error {
        font-weight: 600;
    }
}

/* Animation pour les utilisateurs qui préfèrent moins d'animations */
@media (prefers-reduced-motion: reduce) {
    #contactForm *,
    #contactForm *::before,
    #contactForm *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}