/* Styles pour le sélecteur de langue personnalisé */
.custom-language-selector {
    position: relative;
    display: inline-block;
    cursor: pointer;
    margin-left: 20px; /* Aligner avec les autres éléments de la nav */
    z-index: 10; /* Assurer qu'il est au-dessus des autres éléments si superposés */
    font-family: var(--font-body);
}

.selected-language {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--text-muted);
    border-radius: 8px;
    gap: 10px;
    transition: all 0.2s ease;
    user-select: none; /* Éviter la sélection du texte */
}

.selected-language:hover {
    background-color: rgba(var(--accent-one), 0.1);
    border-color: var(--accent-one);
}

.selected-language img {
    width: 24px;
    height: 24px;
    border-radius: 3px;
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.selected-language span {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
}

.custom-select-arrow {
    margin-left: auto; /* Pousser la flèche à droite */
    color: var(--text-secondary);
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

/* Options de langue (menu déroulant) */
.language-options {
    list-style: none;
    margin: 0;
    padding: 0;
    position: absolute;
    top: 100%; /* Juste en dessous de l'élément sélectionné */
    left: 0;
    right: 0;
    background-color: var(--bg-secondary);
    border: 1px solid var(--accent-one);
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    overflow: hidden; /* Pour les coins arrondis */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.custom-language-selector.open .language-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-language-selector.open .selected-language .custom-select-arrow {
    transform: rotate(180deg); /* Faire pivoter la flèche */
}

.language-options li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 400;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.language-options li:hover {
    background-color: rgba(var(--accent-one), 0.15);
    color: var(--accent-one);
}

.language-options li img {
    width: 24px;
    height: 24px;
    border-radius: 3px;
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Style pour l'option active dans le dropdown */
.language-options li.active {
    background-color: var(--accent-one); /* Couleur de fond pour l'actif */
    color: var(--bg-primary); /* Texte en contraste */
    font-weight: 600;
}

.language-options li.active img {
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .custom-language-selector {
        width: auto; /* Laisser la largeur s'adapter au contenu */
        max-width: 200px; /* Limite la largeur pour ne pas prendre tout l'espace s'il y a de la place */
        margin-left: auto;
        margin-right: auto;
        margin-top: 15px;
    }
    .selected-language, .language-options {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;
    }
    .selected-language {
        justify-content: center;
    }

    .selected-language span {
        display: inline;
        font-size: 0.9rem;
    }

    .selected-language img {
        width: 28px;
        height: 28px;
    }

    .language-options li {
        justify-content: center;
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .selected-language, .language-options {
        width: 100%;
    }
}