/* =========================================================
   SmartLang — Sidebar de drapeaux (fixe, repliable)
   ========================================================= */

#smartlang-sidebar {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9990;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: #ffffff;
  border: 1px solid #e3e3e3;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .12);
  padding: 6px;
  border-radius: 0 12px 12px 0;
  transition: transform .3s ease, opacity .3s ease;
  font-family: inherit;
}

/* Position gauche / droite */
#smartlang-sidebar.smartlang-left  { left: 0;  border-radius: 0 12px 12px 0; }
#smartlang-sidebar.smartlang-right { right: 0; left: auto; border-radius: 12px 0 0 12px; }

/* Bouton de repli */
#smartlang-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 6px 0;
  margin-bottom: 4px;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
}

.smartlang-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.smartlang-item a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: #333;
  transition: background .15s ease;
}

.smartlang-item a:hover { background: #f4f4f4; }

.smartlang-active a {
  background: #2d2d7a;
  color: #fff;
  font-weight: 600;
}

.smartlang-flag {
  width: 32px;
  height: 20px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
  flex: 0 0 auto;
}

.smartlang-iso {
  font-size: 13px;
  letter-spacing: .04em;
}

/* État replié : on cache la liste, on laisse juste le bouton */
#smartlang-sidebar.smartlang-collapsed .smartlang-list { display: none; }
#smartlang-sidebar.smartlang-collapsed #smartlang-toggle { margin-bottom: 0; border-bottom: none; }

/* =========================================================
   Contenu conditionnel par langue
   (ex : widgets Creative Elements dupliqués, 1 par langue)
   On donne au widget une classe CSS : sl-fr, sl-en ou sl-ar.
   SmartLang masque automatiquement les variantes hors langue active.
   ========================================================= */
.sl-lang-fr .sl-en, .sl-lang-fr .sl-ar,
.sl-lang-en .sl-fr, .sl-lang-en .sl-ar,
.sl-lang-ar .sl-fr, .sl-lang-ar .sl-en {
  display: none !important;
}

/* =========================================================
   RTL (arabe) : on bascule la barre du côté opposé
   ========================================================= */
[dir="rtl"] #smartlang-sidebar.smartlang-left  { left: auto; right: 0; border-radius: 12px 0 0 12px; }
[dir="rtl"] #smartlang-sidebar.smartlang-right { right: auto; left: 0; border-radius: 0 12px 12px 0; }
[dir="rtl"] .smartlang-item a { flex-direction: row-reverse; }

/* Mobile : barre plus discrète */
@media (max-width: 767px) {
  #smartlang-sidebar { padding: 4px; }
  .smartlang-iso { display: none; }       /* on garde juste le drapeau */
  .smartlang-flag { width: 26px; height: 17px; }
}
