/* Variables pour correspondre au thème de l'application */
:root {
    --select2-violet: #7215DB;
    --select2-violet-hover: #a98cff;
    --select2-orange: #FF6F20;
    --select2-dark-bg: #212529;
    --select2-dark-border: #495057;
    --select2-light-border: #dee2e6;
}

/* SINGLE SELECT */
.select2-container--default .select2-selection--single {
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 127, 39, 0.3);
    border-radius: 4px;
    height: 38px;
}
.select2-container--default .select2-selection--single .select2-selection__clear {
    margin-right: 36px;
    margin-top: 5px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #2c3e50;
    line-height: 36px;
    padding-left: 12px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 30px;
    right: 13px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--select2-orange) transparent transparent;
    border-width: 10px 7px 0;
}
.bg-dark .select2-container--default .select2-selection--single {
    border: 1px solid rgba(130, 26, 249, 0.3);
}
.select2-container--default .select2-selection--single .select2-selection__arrow b, #changeLocModal .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--select2-orange) transparent transparent;
}
.bg-dark .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--select2-violet) transparent transparent;
}
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{
   border-color: transparent transparent var(--select2-orange) transparent;
   border-width: 0 8px 10px 7px;
}
.select2-container--default .select2-selection--single:focus, .select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #ff7f27;
    box-shadow: 0 0 0 0.2rem rgba(255, 127, 39, 0.25);
}
.select2-container--default .select2-selection--single{
    background-color: white !important;
}
.bg-dark .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{
   border-color: transparent transparent var(--select2-violet) transparent;
}

/* MULTI SELECT */
.select2-container--default .select2-selection--multiple .select2-selection__choice__display {
    padding-right: 0;
}
.select2-container--default .select2-selection--multiple {
    border: none; /* Suppression de toutes les bordures */
    border-radius: 0;
    min-height: auto; /* Hauteur automatique */
    background-color: transparent; /* Fond transparent */
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding: 0; /* Suppression du padding */
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: none; /* Suppression de l'ombre */
}
/* Flèche pour les sélections multiples - dans la zone de recherche blanche */
.select2-container--default .select2-selection--multiple .select2-search--inline::after, #changeLocModal .select2-container--default .select2-selection--multiple .select2-search--inline::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 10px solid var(--select2-orange); /* Couleur orange comme les champs simples */
    pointer-events: none;
    z-index: 1;
}
/* Flèche pour les sélections multiples ouvertes - dans la zone de recherche */
.select2-container--default.select2-container--open .select2-selection--multiple .select2-search--inline::after {
    border-top: none;
    border-bottom: 10px solid var(--select2-orange);
}
.select2-container--default.select2-container--focus .select2-selection--multiple {
    border: none; /* Pas de bordure au focus */
    box-shadow: none; /* Pas d'ombre au focus */
    outline: none;
}
/* Zone de recherche avec fond blanc - seul élément visible */
.select2-container--default .select2-selection--multiple .select2-search--inline {
    order: -1; /* Place la recherche en premier */
    margin-bottom: 8px; /* Espace pour les tags en dessous */
    width: 100% !important;
    background-color: white;
    border-radius: 4px;
    padding: 0;
    border: 1px solid rgba(255, 127, 39, 0.3); /* Bordure comme les champs simples */
    position: relative;
    height: 38px; /* Hauteur exacte d'un champ simple */
}
/* Focus sur la zone de recherche */
.select2-container--default.select2-container--focus .select2-selection--multiple .select2-search--inline {
    border-color: #ff7f27;
    box-shadow: 0 0 0 0.2rem rgba(255, 127, 39, 0.25);
}
/* Container pour les tags sélectionnés */
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    min-height: 24px;
}
/* Tags sélectionnés avec le violet du thème - positionnés sous la recherche */
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: var(--select2-violet);
    border: 1px solid var(--select2-violet);
    color: white;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
/* Bouton de suppression des tags */
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ff6b6b;
}
/* Placeholder quand aucun tag n'est sélectionné */
.select2-container--default .select2-selection--multiple .select2-selection__placeholder {
    color: #999;
    font-style: italic;
    margin-top: 4px;
}
/* Adaptation pour le thème sombre (body avec classe bg-dark) */
.bg-dark .select2-container--default .select2-selection--multiple {
    background-color: transparent; /* Garde le fond transparent */
    border: none;
    color: white;
}
/* Zone de recherche sur thème sombre - avec bordure violette */
.bg-dark .select2-container--default .select2-selection--multiple .select2-search--inline {
    border: 1px solid rgba(130, 26, 249, 0.3);
}
.bg-dark .select2-container--default.select2-container--focus .select2-selection--multiple .select2-search--inline {
    border-color: var(--select2-violet);
    box-shadow: 0 0 0 0.2rem rgba(103, 47, 203, 0.25);
}
/* Flèche violette pour les sélections multiples sur thème sombre - dans la zone de recherche */
.bg-dark .select2-container--default .select2-selection--multiple .select2-search--inline::after {
    border-top-color: var(--select2-violet);
}
.bg-dark .select2-container--default.select2-container--open .select2-selection--multiple .select2-search--inline::after {
    border-bottom-color: var(--select2-violet);
}
/* Zone de recherche reste blanche même sur thème sombre pour la lisibilité */
.bg-dark .select2-container--default .select2-selection--multiple .select2-search--inline {
    background-color: white !important;
    border-color: #e9ecef;
}
.bg-dark .select2-container--default .select2-selection--multiple .select2-selection__placeholder {
    color: #999;
}
.bg-dark .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    background-color: var(--select2-violet);
    color: white;
}
/* Animation de focus smooth */
.select2-container--default .select2-selection--multiple {
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}


/* DROPDOWN */
.select2-dropdown {
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(103, 47, 203, 0.15);
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.body_user .select2-dropdown {
    border: 2px solid var(--select2-violet);
}
.bg-dark .select2-dropdown {
    background-color: var(--select2-dark-bg);
    border-color: var(--select2-violet);
    color: white;
}
.select2-dropdown {
    border: 1px solid rgba(255, 127, 39, 0.3);
    border-radius: 4px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid rgba(255, 127, 39, 0.3);
}
.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: #ff7f27;
    box-shadow: 0 0 0 0.1rem rgba(255, 127, 39, 0.25);
}


.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #ff7f27;
    color: white;
}
.body_user .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--select2-violet);
}


.select2-container--default .select2-results__option--selected {
    background-color: rgba(255, 127, 39, 0.1);
    color: #2c3e50;
}
.select2-container--default .select2-results__option {
    padding: 8px 12px;
    font-size: 14px;
}
.bg-dark .select2-container--default .select2-results__option {
    background-color: var(--select2-dark-bg);
    color: white;
}
.bg-dark .select2-container--default .select2-results__option:hover {
    background-color: var(--select2-violet);
}


.select2-container--default .select2-search--inline .select2-search__field {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    padding: 8px 25px 8px 12px; /* Padding comme un champ simple avec place pour la flèche */
    border: none !important;
    background-color: white !important;
    color: #495057;
    width: 100% !important;
    margin: 0;
    outline: none;
    border-radius: 4px;
    height: 36px; /* Hauteur pour s'adapter au conteneur de 38px */
    line-height: 20px;
}
.select2-container--default .select2-search--inline .select2-search__field::placeholder {
    color: #999;
    font-style: normal;
    font-size: 14px;
    line-height: 20px;
}
.select2-container .select2-search--inline .select2-search__field {
    height: 37px !important;
}
.select2-container--default .select2-search--inline {
    background-color: rgba(255, 255, 255, 0.9) !important;
}
.select2-container--default .select2-search--inline .select2-search__field {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    padding: 0px;
}
.bg-dark .select2-container--default .select2-search--inline .select2-search__field {
    background-color: white !important;
    color: #495057 !important;
    border: none !important;
}
.bg-dark .select2-container--default .select2-search--inline .select2-search__field::placeholder {
    color: #999 !important;
}
.select2-container .select2-search--inline .select2-search__field {
    vertical-align: center;
    height: 24px;
}


textarea.select2-search__field {
    padding: 8px 12px !important;
}

/* Responsive -  mobile */
@media (max-width: 768px) {
    .select2-container--default .select2-selection--multiple {
        min-height: 60px; 
    }
    .select2-container--default .select2-selection--multiple .select2-selection__choice {
        padding: 8px 14px;
        font-size: 15px;
    }
    .select2-container--default .select2-search--inline .select2-search__field {
        padding: 10px 14px;
        font-size: 14px;
    }
}
