/*
 * Custom Select Styles - Recréation complète (aucune transparence sur le dropdown ouvert)
 *
 * - Menu fermé (header) : glassmorphism (semi-transparent, flou)
 * - Dropdown ouvert : fond noir opaque, texte blanc, aucune transparence
 * - Options : fond noir opaque, hover gris foncé, sélection gris plus clair
 * - Responsive, police Montserrat
 */

.custom-select {
    position: relative;
    width: 100%;
    background: rgba(255,255,255,0.18);
    border: none !important; /* Suppression de la bordure violette sur le conteneur */
    border-radius: 10px;
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    backdrop-filter: blur(16px);
    z-index: 1000;
    margin-bottom: 18px;
}

.select-header {
    background: #cfd3e6 !important; /* couleur extraite de la capture d'écran */
    backdrop-filter: blur(18px) !important;
    border-radius: 10px;
    font-weight: 600;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    font-family: 'Montserrat', sans-serif;
    position: relative;
    transition: background 0.2s;
    border: none !important; /* Suppression de la bordure violette */
    box-shadow: 0 2px 8px 0 rgba(120,120,180,0.08);
}

.custom-select,
.select-header {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.custom-select:focus,
.custom-select:active,
.custom-select:hover,
.select-header:focus,
.select-header:active,
.select-header:hover {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.select-header .option-left {
    font-weight: 700;
    color: #fff;
    flex: 1;
    font-size: 13px; /* Réduction supplémentaire de la taille de la police */
}
.select-header .option-right {
    font-size: 13px;
    color: #c7d2fe;
    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: 13px;
    color: #e0e7ff;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    transition: transform 0.2s;
}
.custom-select.active .select-header::after {
    transform: translateY(-50%) rotate(180deg);
}

/* Dropdown (menu ouvert) : fond noir opaque, aucune transparence */
.select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #000;
    border: 1.5px solid rgba(255,255,255,0.18);
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 2000;
    display: none;
    box-shadow: 0 8px 32px rgba(0,0,0,0.40);
}
.custom-select.active .select-dropdown {
    display: block;
}

.select-options {
    padding: 0;
    margin: 0;
    list-style: none;
    background: #000;
}

.select-optgroup {
    background: #000;
    color: #ffd700; /* Gold color for optgroup labels */
    font-weight: 700;
    font-style: normal;
    padding: 8px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.10);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 12px;
}

.select-option {
    padding: 14px 18px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #000;
    color: #fff;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    font-size: 13px; /* Ajout de la taille de police pour les options */
}
.select-option:hover {
    background: #18181b;
    color: #fff;
}
.select-option.selected {
    background: #23232a;
    color: #fff;
}

.option-left {
    font-weight: 600;
    color: #fff;
}
.option-right {
    font-size: 13px;
    color: #a5b4fc;
    font-style: italic;
    text-align: right;
    margin-left: 16px;
}

/* Champ de recherche dans le dropdown */
.search-input-container {
    padding: 7px 14px;
    background: #111;
    border-bottom: 1px solid rgba(255,255,255,0.10);
    position: sticky;
    top: 0;
    z-index: 1002;
}
.search-input {
    width: 100%;
    background: #222;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 5px;
    padding: 7px 12px;
    color: #fff;
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    outline: none;
    transition: background 0.2s, border 0.2s;
    line-height: 1.2;
    height: 32px;
    box-sizing: border-box;
    margin: 0;
}
.search-input:focus {
    background: #18181b;
    border-color: #a5b4fc;
    color: #fff;
}
.search-input::placeholder {
    color: #a5b4fc;
    font-style: italic;
    font-size: 13px;
}

/* Message aucun résultat */
.no-results-message {
    padding: 16px;
    text-align: center;
    color: #a5b4fc;
    font-style: italic;
    font-size: 13px;
    background: #000;
    border-bottom: 1px solid rgba(255,255,255,0.10);
    font-family: 'Montserrat', sans-serif;
}

/* Surlignage dans la recherche */
.search-highlight {
    background: #ffd700;
    color: #000;
    font-weight: 600;
    padding: 1px 2px;
    border-radius: 2px;
}

/*
 * FINAL OVERRIDE: Remove all violet borders from custom select (closed and open)
 * This will forcibly remove any border from .custom-select and .select-header, regardless of specificity or !important in other files.
 */
.custom-select,
.custom-select:focus,
.custom-select:active,
.custom-select:hover,
.custom-select.has-selection,
.custom-select.active,
.select-header,
.select-header:focus,
.select-header:active,
.select-header:hover {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Remove any border from .custom-select added by .active-selector, .inactive-selector, or any other state */
.custom-select.active-selector,
.custom-select.inactive-selector {
    border: none !important;
    box-shadow: none !important;
}

/* Remove border from dropdown as well (for safety) */
.select-dropdown {
    border: none !important;
}

/* Remove border from header arrow if any */
.select-header::after {
    border: none !important;
    box-shadow: none !important;
}

/*
 * Différencier la couleur de fond du header selon l'état sélectionné ou non
 */
.custom-select:not(.has-selection) .select-header {
    background: #363151 !important; /* couleur identique à l'encart réponse json */
    color: #f1f5fa !important;
}

.custom-select.has-selection .select-header {
    background: #4e6b5f !important; /* couleur claire pour sélectionné, comme la capture */
    color: #fff !important;
}

/*
 * Améliore la visibilité du texte de droite dans le header sélectionné
 */
.custom-select.has-selection .select-header .option-right {
    color: #a5b4fc !important; /* bleu lavande clair, bien lisible sur #cfd3e6 */
    opacity: 1 !important;
}

.custom-select:not(.has-selection) .select-header .option-right {
    color: #b6c2e1 !important; /* gris bleuté clair, bien lisible sur #1a2036 */
    opacity: 1 !important;
}

/*
 * Bouton "Exécuter" : fond identique à l'encart réponse JSON (#0f172a)
 */
button[type="submit"],
button#execute-btn,
button#executer-btn,
button[onclick="executeEndpoint()"] {
    background: #4f6a5f !important;
    color: #fff !important;
    border: 1px solid #b6b6d6 !important;
    box-shadow: none !important;
}
