/*--------------------------------------------------------------
   JT Falang Language Switcher - style "module Joomla" custom
---------------------------------------------------------------*/

/* Bloc global = wrapper fixe dans le flux */
.mod-jt-languageswitcher.jt-falang-switcher-custom {
    position: relative;
    display: inline-block;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    /* Réserve la place dans la navbar */
    width: 42px;   /* même largeur que la box */
    height: 42px;  /* hauteur ≈ drapeau 32px + padding */
}

/* Conteneur interne avec l’ID select-container-XXX */
/* La box visible en permanence autour du switcher */
.mod-jt-languageswitcher.jt-falang-switcher-custom [id^="select-container-"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;          /* occupe toute la zone du wrapper */
    display: inline-block;
    padding: 4px 4px 0px 4px;
    background: #ffffff;
    border-radius: 999px;
    border: 0.5px solid rgba(202, 219, 226, 0.9);
    box-shadow: 0px 3px 6px rgba(79, 104, 113, 0.25);
    box-sizing: border-box;
    transition: box-shadow 0.2s ease, border-radius 0.2s ease, padding 0.2s ease;
}

/* Effet “ça s’ouvre” au survol : la box s’allonge vers le bas */
.mod-jt-languageswitcher.jt-falang-switcher-custom [id^="select-container-"]:hover {
    border-radius: 16px;
    box-shadow: 0px 7px 16px rgba(79, 104, 113, 0.35);
    padding-bottom: 120px; /* donne l’impression que la box s’allonge vers le bas */
}

/* Le wrapper interne devient juste un flex neutre */
.mod-jt-languageswitcher.jt-falang-switcher-custom .mod-jt-languageswitcher__select {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

/* --------- Bouton langue active --------- */

.mod-jt-languageswitcher.jt-falang-switcher-custom button.active-lang {
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Conteneur d’image générique */
.mod-jt-languageswitcher.jt-falang-switcher-custom .img-cover {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Drapeau actif = rond + ombre */
.mod-jt-languageswitcher.jt-falang-switcher-custom button.active-lang .img-cover img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(79, 104, 113, 0.35);
    object-fit: cover;
    display: block;
    transition: transform 0.1s ease-out, box-shadow 0.1s ease-out;
}

/* Code langue optionnel (si show_codes = true) */
.mod-jt-languageswitcher.jt-falang-switcher-custom button.active-lang .langname-code {
    margin-left: 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #465663;
}

/* Petit effet au survol du bouton actif */
.mod-jt-languageswitcher.jt-falang-switcher-custom button.active-lang:hover .img-cover img {
    transform: scale(1.05);
    box-shadow: 0px 0px 10px rgba(79, 104, 113, 0.45);
}

/* --------- Dropdown <ul> --------- */

/* Liste déroulante cachée par défaut */
.mod-jt-languageswitcher.jt-falang-switcher-custom .mod-jt-languageswitcher__select > ul {
    position: absolute;
    top: 100%;              /* collé au bas du bouton */
    right: 0;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: none;       /* on garde la box principale comme fond */
    border-radius: 12px;
    min-width: 100%;
    box-sizing: border-box;
    display: none;
    z-index: 9999;
}

/* Ouverture au survol du bloc */
.mod-jt-languageswitcher.jt-falang-switcher-custom .mod-jt-languageswitcher__select:hover > ul {
    display: block;
}

/* Et maintien ouvert quand la souris est sur le menu lui-même */
.mod-jt-languageswitcher.jt-falang-switcher-custom .mod-jt-languageswitcher__select > ul:hover {
    display: block;
}

/* Quand on survole la box entière, on ouvre aussi le dropdown */
.mod-jt-languageswitcher.jt-falang-switcher-custom [id^="select-container-"]:hover .mod-jt-languageswitcher__select > ul {
    display: block;
}

/* Items de la liste */
.mod-jt-languageswitcher.jt-falang-switcher-custom .mod-jt-languageswitcher__select > ul li {
    padding: 4px 0;
    font-size: 14px;
}

/* Lien dans les items */
.mod-jt-languageswitcher.jt-falang-switcher-custom .mod-jt-languageswitcher__select > ul li a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

/* Drapeaux dans la liste */
.mod-jt-languageswitcher.jt-falang-switcher-custom .mod-jt-languageswitcher__select > ul li .img-cover {
    display: inline-flex;
    flex: 0 0 auto; /* le drapeau ne se fait plus écraser */
}

.mod-jt-languageswitcher.jt-falang-switcher-custom .mod-jt-languageswitcher__select > ul li .img-cover img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(79, 104, 113, 0.3);
    object-fit: cover;
    display: block;
    transition: transform 0.1s ease-out, box-shadow 0.1s ease-out;
}

/* Code langue dans la liste */
.mod-jt-languageswitcher.jt-falang-switcher-custom .mod-jt-languageswitcher__select > ul li .langname-code {
    margin-left: 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #465663;
}

/* Hover item */
.mod-jt-languageswitcher.jt-falang-switcher-custom .mod-jt-languageswitcher__select > ul li:hover {
    background: #f2f6f8;
}

/* --------- Tooltip (facultatif, mais propre) --------- */

[tooltip] {
    position: relative;
}

/* Base tooltip */
[tooltip]::before,
[tooltip]::after {
    position: absolute;
    display: none;
    opacity: 0;
    pointer-events: none;
    user-select: none;
    z-index: 100000;
    font-size: 12px;
    line-height: 1.2;
}

/* Triangle */
[tooltip]::before {
    content: "";
    border: 5px solid transparent;
}

/* Etiquette */
[tooltip]::after {
    content: attr(tooltip);
    background: #465663;
    color: #fff;
    font-family: Helvetica, Arial, sans-serif;
    border-radius: 4px;
    padding: 4px 6px;
    box-shadow: 0 0.8em 2em -0.6em rgba(0,0,0,0.4);
    white-space: nowrap;
}

/* Tooltip vers le bas */
[tooltip][flow^="down"]::before {
    top: 100%;
    left: 50%;
    border-top-width: 0;
    border-bottom-color: #465663;
    transform: translate(-50%, 0);
}

[tooltip][flow^="down"]::after {
    top: calc(100% + 6px);
    left: 50%;
    transform: translate(-50%, 0);
}

/* Tooltip vers le haut (si tu en as encore) */
[tooltip][flow^="up"]::before {
    bottom: 100%;
    left: 50%;
    border-bottom-width: 0;
    border-top-color: #465663;
    transform: translate(-50%, 0);
}

[tooltip][flow^="up"]::after {
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translate(-50%, 0);
}

/* Affichage au survol */
[tooltip]:hover::before,
[tooltip]:hover::after {
    display: block;
    animation: jt-tooltip-fade 180ms ease-out forwards;
}

/* Animation tooltip */
@keyframes jt-tooltip-fade {
    from {
        opacity: 0;
        transform: translate(-50%, 4px);
    }
    to {
        opacity: 0.9;
        transform: translate(-50%, 0);
    }
}

/* Ajustement du drapeau uniquement sur mobile */
@media (max-width: 640px) {

    /* Décalage fin du drapeau actif */
    .mod-jt-languageswitcher.jt-falang-switcher-custom button.active-lang .img-cover img {
        transform: translate(0.8px, 0.8px);  /* droite = 2px, bas = 2px */
    }

    /* Si tu veux un ajustement un peu différent pour la liste déroulante aussi */
    .mod-jt-languageswitcher.jt-falang-switcher-custom .mod-jt-languageswitcher__select > ul li .img-cover img {
        transform: translate(0.8px, 0.8px);
    }

}