/* ============================================================
   LynQ — Language Switcher Styles (i18n.css)
   Companion stylesheet for assets/js/i18n.js
   ============================================================ */

/* ── Wrapper ── */
.i18n-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  font-size: 0.875rem;
  user-select: none;
  z-index: 1050;
}

/* ── Toggle button ── */
.i18n-switcher__toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  color: inherit;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  line-height: 1.2;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.i18n-switcher__toggle:hover,
.i18n-switcher__toggle:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.6);
  outline: none;
}

.i18n-switcher__chevron {
  font-size: 0.7em;
  line-height: 1;
  transition: transform 0.2s;
  margin-left: 2px;
}

.i18n-switcher.open .i18n-switcher__chevron {
  transform: rotate(180deg);
}

/* ── Dropdown list ── */
.i18n-switcher__list {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  min-width: 160px;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 1051;
}

.i18n-switcher.open .i18n-switcher__list {
  display: block;
  animation: i18n-fade-down 0.15s ease;
}

/* RTL: open to the left */
[dir="rtl"] .i18n-switcher__list {
  right: auto;
  left: 0;
}

@keyframes i18n-fade-down {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Option ── */
.i18n-switcher__option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  cursor: pointer;
  color: #333333;
  transition: background 0.1s;
}

.i18n-switcher__option:hover {
  background: #f5f5f5;
}

.i18n-switcher__option.active {
  background: #eef4ff;
  font-weight: 600;
  color: #1a73e8;
}

.i18n-switcher__option.active::after {
  content: '✓';
  margin-left: auto;
  color: #1a73e8;
  font-size: 0.8em;
}

[dir="rtl"] .i18n-switcher__option.active::after {
  margin-left: 0;
  margin-right: auto;
}

.i18n-switcher__flag {
  font-size: 1.15em;
  line-height: 1;
  flex-shrink: 0;
}

.i18n-switcher__name {
  flex: 1;
  font-size: 0.875rem;
}

.i18n-switcher__code {
  font-size: 0.75rem;
  color: #888;
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* ── Dark header variant ──
   Add class="i18n-switcher--dark" when placing on a dark background */
.i18n-switcher--dark .i18n-switcher__toggle {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
}

/* ── Light header variant ──
   Add class="i18n-switcher--light" when placing on a light background */
.i18n-switcher--light .i18n-switcher__toggle {
  color: #333333;
  border-color: rgba(0, 0, 0, 0.2);
}

.i18n-switcher--light .i18n-switcher__toggle:hover,
.i18n-switcher--light .i18n-switcher__toggle:focus-visible {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.4);
}

/* ── RTL body overrides ── */
[dir="rtl"] .i18n-switcher__chevron {
  margin-left: 0;
  margin-right: 2px;
}

/* ── Mobile navbar switcher (visible only on small screens) ── */
#lang-switcher-mobile {
  display: none;
}

@media only screen and (max-width: 991px) {
  #lang-switcher-mobile {
    display: inline-flex;
    position: absolute;
    right: 15px;
    left: auto;
    top: 50%;
    transform: translateY(-50%);
  }

  [dir="rtl"] #lang-switcher-mobile {
    right: auto;
    left: 15px;
  }
}
