/* Sélecteur de langue avec drapeaux — s'intègre dans le header du site */
.bdg-lang-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 12px;
}

/* Bouton affichant le drapeau + code langue actuel */
.bdg-lang-switcher__current {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 0.4em 0.85em;
  cursor: pointer;
  transition: 0.2s ease;
  font-family: "Poppins", system-ui, sans-serif;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.bdg-lang-switcher__current:hover,
.bdg-lang-switcher__current:focus,
.bdg-lang-switcher__current:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.45);
  outline: none;
}

.bdg-lang-switcher__flag {
  font-size: 1.2rem;
  line-height: 1;
}

.bdg-lang-switcher__code {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
}

/* Menu déroulant — fond noir, cohérent avec le header */
.bdg-lang-switcher__menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 190px;
  background: #0b0b10;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: 0.18s ease;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bdg-lang-switcher.is-open .bdg-lang-switcher__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Boutons de langue — roses, texte blanc, largeur uniforme */
.bdg-lang-switcher__option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: linear-gradient(120deg, #ff2d95, #ff6ab8);
  border: none;
  border-radius: 9px;
  padding: 10px 14px;
  font-family: "Poppins", system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 700 !important;
  color: #fff !important;
  cursor: pointer;
  text-align: left;
  transition: 0.15s ease;
  outline: none;
}

.bdg-lang-switcher__option .bdg-lang-switcher__label {
  color: #fff !important;
  font-weight: 700 !important;
}

.bdg-lang-switcher__option:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(255, 45, 149, 0.35);
}

.bdg-lang-switcher__option.is-active {
  background: #fff;
  color: #ff2d95 !important;
}

.bdg-lang-switcher__option.is-active .bdg-lang-switcher__label {
  color: #ff2d95 !important;
}

.bdg-lang-switcher__option .bdg-lang-switcher__flag {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.bdg-lang-switcher__option .bdg-lang-switcher__label {
  flex: 1;
}

/* Petit indicateur de chargement pendant la traduction */
.bdg-lang-switcher.is-loading .bdg-lang-switcher__current::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ff2d95;
  border-radius: 50%;
  animation: bdg-lang-spin 0.6s linear infinite;
}

@keyframes bdg-lang-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Version mobile (dans le menu burger) */
@media (max-width: 1024px) {
  .bdg-lang-switcher {
    margin-left: 0;
    margin-top: 10px;
  }

  /* Le menu burger mobile est un panneau plein écran : un menu positionné en
     relatif au bouton peut sortir de l'écran selon où le bouton se trouve.
     On fixe donc le menu au centre de l'écran, indépendamment du bouton. */
  .bdg-lang-switcher__menu {
    position: fixed;
    top: 50%;
    left: 50%;
    right: auto;
    transform: translate(-50%, -45%);
    width: min(260px, 82vw);
    max-height: 70vh;
    overflow-y: auto;
    z-index: 10010; /* au-dessus du panneau mobile (.bdg-nav) */
  }

  .bdg-lang-switcher.is-open .bdg-lang-switcher__menu {
    transform: translate(-50%, -50%);
  }

  /* Fond assombri derrière le menu, pour le détacher visuellement du panneau burger */
  .bdg-lang-switcher.is-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10005;
  }

  .bdg-lang-switcher__option {
    padding: 13px 14px;
    font-size: 1rem;
  }
}

/* ============================================================
   Bouton flottant sticky (mobile uniquement) — bas droite
============================================================ */
.bdg-lang-float {
  display: none;
}

@media (max-width: 1024px) {
  .bdg-lang-float {
    display: block;
    position: fixed;
    bottom: 18px;
    right: 18px;
    z-index: 9500; /* sous le menu burger (10001+) mais au-dessus du contenu */
  }

  .bdg-lang-float__current {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(120deg, #ff2d95, #ff6ab8);
    border: none;
    border-radius: 999px;
    padding: 12px 16px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(255, 45, 149, 0.45);
    font-family: "Poppins", system-ui, sans-serif;
    outline: none;
    -webkit-tap-highlight-color: transparent;
  }

  .bdg-lang-float__flag {
    font-size: 1.25rem;
    line-height: 1;
  }

  .bdg-lang-float__code {
    font-size: 0.9rem;
    font-weight: 700 !important;
    letter-spacing: 0.5px;
    color: #fff !important;
  }

  /* Menu du bouton flottant — entièrement autonome (classes propres,
     ne dépend pas des règles du switcher header) */
  .bdg-lang-float__menu {
    position: absolute;
    bottom: calc(100% + 12px);
    right: 0;
    width: 190px;
    background: #0b0b10;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 6px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    gap: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: 0.18s ease;
    pointer-events: none;
  }

  .bdg-lang-float.is-open .bdg-lang-float__menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }

  .bdg-lang-float__option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: linear-gradient(120deg, #ff2d95, #ff6ab8);
    border: none;
    border-radius: 9px;
    padding: 13px 14px;
    font-family: "Poppins", system-ui, sans-serif;
    font-size: 1rem;
    font-weight: 700 !important;
    color: #fff !important;
    cursor: pointer;
    text-align: left;
  }

  .bdg-lang-float__option .bdg-lang-float__option-label {
    color: #fff !important;
    font-weight: 700 !important;
    flex: 1;
  }

  .bdg-lang-float__option.is-active {
    background: #fff;
  }

  .bdg-lang-float__option.is-active .bdg-lang-float__option-label {
    color: #ff2d95 !important;
  }

  .bdg-lang-float__option-flag {
    font-size: 1.1rem;
    flex-shrink: 0;
  }
}
