/* Système de sélecteurs custom avec dropdown */

.custom-select {
    position: relative;
    width: 100%;
    background: #ffffff;
    border: 1px solid #cdd7e0;
    border-radius: 8px;
    color: #1f2d3a;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
    z-index: 1000; /* S'assurer que le sélecteur a un z-index élevé */
}

.custom-select.active {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.20);
    z-index: 10001; /* Z-index encore plus élevé quand actif */
}

.select-header {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f5f7fa;
    font-weight: 500;
    position: relative;
}

.select-header .option-left {
    font-weight: 600;
    color: #1f2d3a;
    flex: 1;
}

.select-header .option-right {
    font-size: 13px;
    color: #5c6d7a;
    font-style: italic;
    text-align: right;
    margin-left: 16px;
    margin-right: 35px;
    flex-shrink: 0;
    max-width: 50%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.select-header::after {
    content: '▼';
    font-size: 12px;
    color: var(--primary-color);
    transform: rotate(0deg);
    transition: transform 0.2s ease;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
}

.custom-select.active .select-header::after {
    transform: translateY(-50%) rotate(180deg);
}

.select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #cdd7e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 9999;
    display: none;
}

.custom-select.active .select-dropdown {
    display: block;
    z-index: 10000;
}

.select-options {
    padding: 0;
}

.select-optgroup {
    background: #f1f5f9;
    color: #334455;
    font-weight: 700;
    font-style: normal;
    padding: 8px 16px;
    border-bottom: 1px solid #d0dae2;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 11px;
}

.select-option {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #e6edf3;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    color: #1f2d3a;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.select-option:hover {
    background: #f5f7fa;
    color: #1f2d3a;
}

.select-option.selected {
    background: var(--primary-color);
    color: #c4b5fd;
}

.option-left {
    font-weight: 600;
    color: #1f2d3a;
}

.option-right {
    font-size: 13px;
    color: #94a3b8;
    font-style: italic;
    text-align: right;
    margin-left: 16px;
}

.select-option:hover .option-right {
    color: #c4b5fd;
}

/* Styles pour les sélecteurs actifs/inactifs */
.custom-select.active-selector {
    border: 2px solid var(--secondary-color) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25) !important;
    background: #ffffff !important;
}

.custom-select.active-selector .select-header {
    color: #ffffff !important;
    font-weight: 600 !important;
}

.custom-select.active-selector .select-option {
    background: #f1f5f9 !important;
    color: #1f2d3a !important;
    font-weight: 500 !important;
}

.custom-select.inactive-selector {
    border: 2px solid var(--border-color) !important;
    background: #ffffff !important;
}

.custom-select.inactive-selector .select-header {
    color: #4b5d6a !important;
    font-weight: 500 !important;
}

.custom-select.inactive-selector .select-option {
    background: #ffffff !important;
    color: #5a6b78 !important;
    font-weight: 400 !important;
}

/* Styles pour les menus non sélectionnés (placeholders) - moins voyants */
.custom-select .select-header .option-left:only-child,
.custom-select .select-header .option-left[data-is-placeholder="true"] {
    opacity: 0.6; /* Transparence pour rendre moins voyant */
    color: #9ca3af !important; /* Couleur grise plus discrète */
    font-weight: 400 !important; /* Poids de police plus léger */
}

/* Style spécifique quand le menu n'a pas de sélection (texte placeholder) */
.custom-select:not(.has-selection) .select-header .option-left {
    opacity: 0.6; /* Transparence pour le placeholder */
    color: #9ca3af !important; /* Couleur grise discrète */
    font-weight: 400 !important; /* Poids de police plus léger */
}

/* Style pour restaurer l'apparence normale quand une option est sélectionnée */
.custom-select.has-selection .select-header .option-left {
    opacity: 1; /* Opacité normale */
    color: #1f2d3a !important; /* Couleur normale */
    font-weight: 600 !important; /* Poids de police normal */
}

/* Surlignage des correspondances dans le texte */
.search-highlight {
    background: var(--warning-color);
    color: #1f2937;
    font-weight: 600;
    padding: 1px 2px;
    border-radius: 2px;
}

/* ===== CHAMP DE RECHERCHE PRÉDICTIVE ===== */
.search-input-container {
    padding: 4px 8px;
    background: #eef3f7;
    border-bottom: 1px solid #d0dae2;
    position: sticky;
    top: 0;
    z-index: 1002;
}

.search-input {
    width: 100% !important;
    background: #ffffff !important;
    border: 1px solid #c3ced6 !important;
    border-radius: 4px !important;
    padding: 4px 8px !important;
    color: #334450 !important;
    font-size: 13px !important;
    font-family: inherit;
    outline: none !important;
    transition: all 0.2s ease;
    line-height: 1.2 !important;
    height: 28px !important;
    box-sizing: border-box;
    margin: 0 !important;
    vertical-align: top;
    max-width: none !important;
}

.search-input:focus {
    background: #ffffff !important;
    color: #1f2d3a !important;
    border: 1px solid var(--secondary-color) !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25) !important;
}

.search-input::placeholder {
    color: var(--border-color);
    font-style: italic;
    font-size: 12px;
}

/* Options filtrées cachées */
.select-option.filtered-hidden {
    display: none !important;
}

/* Message quand aucun résultat */
.no-results-message {
    padding: 16px;
    text-align: center;
    color: #4b5d6a;
    font-style: italic;
    font-size: 13px;
    background: #f1f5f9;
    border-bottom: 1px solid #d0dae2;
}

/* Correction spécifique pour le second menu - forcer l'opacité complète */
#themeRoute .select-dropdown {
    background: rgb(30, 41, 59) !important;
    backdrop-filter: none !important;
}

#themeRoute .select-option {
    background: rgb(30, 41, 59) !important;
}

#themeRoute .select-option:hover {
    background: rgb(74, 58, 119) !important;
}

#themeRoute .select-optgroup {
    background: rgb(15, 23, 42) !important;
}

/* Correction de lisibilité: appliquer le même thème sombre au menu "Endpoint par route" */
#apiRoute .select-dropdown {
    background: rgb(30, 41, 59) !important;
    backdrop-filter: none !important;
}

#apiRoute .select-option {
    background: rgb(30, 41, 59) !important;
    color: #ffffff !important;
}

#apiRoute .select-option:hover {
    background: rgb(74, 58, 119) !important;
}

#apiRoute .select-optgroup {
    background: rgb(15, 23, 42) !important;
    color: #ffd700 !important;
}

#apiRoute .option-right {
    color: #a5b4fc !important;
}
