/* Styles personnalisés pour les champs avec autocomplétion Tom Select */

/* Conteneur principal Tom Select */
.ts-control {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 12px;
    min-height: 42px;
    font-size: 14px;
    line-height: 1.5;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.ts-control:hover {
    border-color: #9ca3af;
}

.ts-control.focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

/* Input de recherche */
.ts-control input {
    background: transparent;
    border: none;
    outline: none;
    font-size: 14px;
    color: #374151;
    padding: 0;
    margin: 0;
    min-width: 20px;
}

.ts-control input::placeholder {
    color: #9ca3af;
}

/* Items sélectionnés */
.ts-control .ts-item {
    background: #3b82f6;
    color: #ffffff;
    border-radius: 4px;
    padding: 4px 8px;
    margin: 2px 4px 2px 0;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ts-control .ts-item .ts-remove {
    color: #ffffff;
    cursor: pointer;
    font-weight: bold;
    margin-left: 4px;
}

.ts-control .ts-item .ts-remove:hover {
    color: #fbbf24;
}

/* Dropdown des options */
.ts-dropdown {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
}

/* Options dans le dropdown */
.ts-dropdown .ts-option {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    font-size: 14px;
    transition: background-color 0.15s ease;
}

.ts-dropdown .ts-option:last-child {
    border-bottom: none;
}

.ts-dropdown .ts-option:hover {
    background-color: #f3f4f6;
}

.ts-dropdown .ts-option.active {
    background-color: #3b82f6;
    color: #ffffff;
}

.ts-dropdown .ts-option.selected {
    background-color: #e5e7eb;
    color: #374151;
}

/* Message "Aucun résultat" */
.ts-dropdown .ts-no-results {
    padding: 12px;
    color: #6b7280;
    font-style: italic;
    text-align: center;
}

/* Indicateur de chargement */
.ts-control .ts-loading {
    color: #6b7280;
    font-style: italic;
}

/* Styles pour les formulaires existants */
.form-control.ts-control {
    width: 100%;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-control.ts-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.form-select.ts-control {
    width: 100%;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-select.ts-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

/* Styles pour les formulaires de clients */
.form-input.ts-control {
    width: 100%;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-input.ts-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

/* Responsive */
@media (max-width: 768px) {
    .ts-control {
        font-size: 16px; /* Évite le zoom sur iOS */
    }
    
    .ts-dropdown {
        max-height: 200px;
    }
    
    .ts-dropdown .ts-option {
        padding: 12px;
        font-size: 16px;
    }
}

/* Animation pour l'ouverture du dropdown */
.ts-dropdown {
    animation: ts-dropdown-fade-in 0.15s ease-out;
}

@keyframes ts-dropdown-fade-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Styles pour les champs désactivés */
.ts-control.disabled {
    background-color: #f9fafb;
    color: #6b7280;
    cursor: not-allowed;
    opacity: 0.6;
}

.ts-control.disabled input {
    cursor: not-allowed;
}

/* Styles pour les erreurs de validation */
.ts-control.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Styles pour les champs requis */
.ts-control.required::after {
    content: " *";
    color: #ef4444;
    font-weight: bold;
}

/* Amélioration de l'accessibilité */
.ts-control:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ts-dropdown .ts-option:focus {
    background-color: #3b82f6;
    color: #ffffff;
    outline: none;
}

/* Styles pour les groupes d'options */
.ts-dropdown .ts-optgroup {
    padding: 8px 12px 4px;
    font-weight: 600;
    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e5e7eb;
}

.ts-dropdown .ts-optgroup:last-child {
    border-bottom: none;
}

/* Styles pour les options dans un groupe */
.ts-dropdown .ts-optgroup .ts-option {
    padding-left: 24px;
    font-size: 13px;
}




