/* Formspree Contact Form - Animations avec Tailwind CSS */

/* S'assurer que le contenu ne déborde jamais */
.formspree-contact-form-container {
    max-width: 100%;
    box-sizing: border-box;
}

.formspree-contact-form-container * {
    box-sizing: border-box;
}

/* Animations des étapes */
.form-step {
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    opacity: 0;
}

.form-step.active {
    display: block !important;
    opacity: 1 !important;
    position: relative !important;
    animation: fadeIn 0.5s ease-out;
}

/* S'assurer que tous les enfants des étapes restent dans le conteneur */
.form-step > * {
    max-width: 100%;
    box-sizing: border-box;
}

.form-step.exiting-left,
.form-step.exiting-right {
    animation: fadeOut 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Indicateur de progression animé */
.progress-step.active .progress-circle {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
    color: white !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.progress-step.completed .progress-circle {
    background: #10b981 !important;
    color: white !important;
    border-color: #10b981 !important;
}

.progress-step.active + .progress-line,
.progress-step.completed + .progress-line {
    background: linear-gradient(90deg, #10b981 0%, #3b82f6 100%) !important;
}

.progress-step.active .text-sm {
    color: #3b82f6 !important;
}

.progress-step.completed .text-sm {
    color: #10b981 !important;
}

/* Animation des boutons de choix actifs */
.btn-choice.active {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
    border-color: #3b82f6 !important;
    color: white !important;
}

.btn-project-type.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    border-color: #10b981 !important;
    color: white !important;
}

/* Animation shake pour les erreurs */
@keyframes shake {
    0%, 100% { 
        transform: translateX(0); 
    }
    25% { 
        transform: translateX(-5px); 
    }
    75% { 
        transform: translateX(5px); 
    }
}

.form-input.error,
.form-textarea.error,
input.error,
textarea.error {
    border-color: #ef4444 !important;
    animation: shake 0.5s ease-in-out;
}

/* Spinner de chargement */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

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

/* Messages de statut avec animation */
.formspree-status {
    animation: fadeInUp 0.4s ease-out;
    display: none;
}

.formspree-status.success {
    display: block !important;
}

.formspree-status.error {
    display: block !important;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Amélioration des transitions des boutons */
.btn-choice,
.btn-project-type,
.btn-next,
.btn-prev,
.btn-submit {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Style pour les labels avec has-[:checked] (fallback pour les navigateurs plus anciens) */
label:has(input[type="radio"]:checked) {
    border-color: currentColor;
}

/* Animation pour les focus des inputs */
input:focus,
textarea:focus,
select:focus {
    transform: translateY(-1px);
}

/* Animation pour les champs conditionnels */
.project-specific-fields > div {
    transition: all 0.3s ease-in-out;
}

.project-specific-fields > div:not(.hidden) {
    animation: fadeInSimple 0.4s ease-out;
}

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

/* Désactivation des animations pour les utilisateurs qui préfèrent réduire les mouvements */
@media (prefers-reduced-motion: reduce) {
    .form-step,
    .btn-choice,
    .btn-project-type,
    .btn-next,
    .btn-prev,
    .btn-submit,
    .progress-circle,
    .project-specific-fields > div,
    input,
    textarea {
        animation: none !important;
        transition: none !important;
    }
}

/* Responsive - Ajustements pour petits écrans */
@media (max-width: 768px) {
    /* Ajustement des boutons de projet sur mobile */
    .btn-project-type {
        font-size: 0.813rem !important;
        padding: 0.75rem 0.5rem !important;
        min-height: 70px;
    }
    
    /* Ajustement des cercles de progression */
    .progress-circle {
        width: 2.5rem !important;
        height: 2.5rem !important;
        font-size: 0.875rem !important;
    }
    
    .progress-line {
        /* width: 3rem !important; */
    }
    
    /* Scroll horizontal pour les steps si nécessaire */
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 640px) {
    /* Sur très petits écrans, garder 2 colonnes pour les travaux */
    .btn-project-type {
        font-size: 0.75rem !important;
        line-height: 1.2 !important;
    }
}
