/**
 * Vehicle Search Handler - Styles CSS
 * Version: 1.0.0
 * 
 * CE FICHIER CONTIENT :
 * - Styles pour les loaders
 * - Messages d'erreur/succès
 * - Améliorations visuelles des selects
 * 
 * POURQUOI CSS MINIMAL ?
 * - Elementor fournit déjà le style de base des champs
 * - On ajoute juste ce qui manque (loaders, messages)
 * - Reste cohérent avec le design Elementor
 */

/**
 * LOADER - Affiché pendant les appels AJAX
 * 
 * Utilise les couleurs de base Elementor pour la cohérence
 */
.vehicle-search-loader {
    margin-top: 15px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: pulseLoader 1.5s ease-in-out infinite;
}

/* Animation du loader */
@keyframes pulseLoader {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.85;
        transform: scale(0.98);
    }
}

/**
 * MESSAGE DE DEBUG
 * 
 * Visible uniquement si WP_DEBUG est activé
 */
.vehicle-search-debug {
    padding: 12px;
    background: #f8f9fa;
    border-left: 4px solid #007bff;
    margin-bottom: 15px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    color: #333;
}

.vehicle-search-debug strong {
    color: #007bff;
    display: block;
    margin-bottom: 5px;
}

/**
 * CONTENEUR DES DONNÉES CACHÉES
 * 
 * Utilisé par JavaScript pour récupérer les IDs des champs
 */
#vehicle-search-data {
    display: none !important;
    visibility: hidden;
}

/**
 * AMÉLIORATIONS DES SELECTS ELEMENTOR
 * 
 * Ajoute des styles visuels quand un select est disabled (chargement)
 */
.elementor-field-type-select select:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
    opacity: 0.7;
}

/**
 * STYLE DU BOUTON PENDANT LE CHARGEMENT
 * 
 * Change l'apparence du bouton "Rechercher" pendant la soumission
 */
.elementor-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
}

/* Ajoute un spinner au bouton disabled */
.elementor-button:disabled::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 8px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spinButton 0.8s linear infinite;
}

@keyframes spinButton {
    to {
        transform: rotate(360deg);
    }
}

/**
 * RESPONSIVE - Adaptations mobiles
 * 
 * Améliore l'UX sur petits écrans
 */
@media (max-width: 768px) {
    .vehicle-search-loader {
        font-size: 13px;
        padding: 10px 15px;
    }
    
    .vehicle-search-debug {
        font-size: 11px;
        padding: 10px;
    }
}

/**
 * COMPATIBILITÉ AVEC LE HEADER STICKY
 * 
 * Si le formulaire est dans un header sticky Elementor,
 * évite les problèmes de z-index
 */
.elementor-sticky--active .vehicle-search-loader {
    z-index: 1;
}

/**
 * MESSAGES D'ERREUR PERSONNALISÉS (OPTIONNEL)
 * 
 * Si vous voulez remplacer alert() par des messages HTML,
 * décommentez et utilisez ces classes dans le JavaScript
 */
/*
.vehicle-search-message {
    padding: 12px 20px;
    margin-top: 15px;
    border-radius: 6px;
    font-size: 14px;
    animation: slideIn 0.3s ease-out;
}

.vehicle-search-message--success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.vehicle-search-message--error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.vehicle-search-message--info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
*/

/**
 * AMÉLIORATION DES SELECTS - Focus
 * 
 * Ajoute un effet visuel au focus pour meilleure UX
 */
.elementor-field-type-select select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/**
 * TRANSITION DOUCE POUR LES CHANGEMENTS D'ÉTAT
 * 
 * Rend les changements visuels plus fluides
 */
.elementor-field-type-select select {
    transition: all 0.3s ease;
}

.elementor-button {
    transition: all 0.3s ease;
}