/* FOUC qarşısını al — i18n yüklənənə qədər səhifə görünməsin.
   `html.i18n-ready` class i18n.js init() tamamlayanda əlavə olunur.
   Bütün body-ni gizlədirik (təkcə [data-i18n] elementlərini deyil) ki,
   sidebar nav-da permission yoxlamasının nəticəsi də stabilləşsin —
   QR Scanner kimi conditional element-lər anlıq parıldamasın.
   3 saniyə failsafe i18n.js-də qoyulur ki, network xətası halında görünməz qalmasın. */
html:not(.i18n-ready) body {
  visibility: hidden;
}

/* i18n language selector — modern glassmorphism pill + menu */

.i18n-lang-wrap {
  position: relative;
  display: inline-block;
  font-family: inherit;
}

.i18n-lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  color: inherit;
  font: inherit;
  font-size: 0.85em;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.i18n-lang-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.i18n-lang-wrap.open .i18n-lang-toggle {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
}

.i18n-lang-toggle > svg {
  flex-shrink: 0;
  opacity: 0.55;
  transition: transform 0.2s;
}

.i18n-lang-wrap.open .i18n-lang-toggle > svg {
  transform: rotate(180deg);
}

.i18n-lang-flag {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.i18n-lang-flag svg {
  display: block;
  border-radius: 3px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.15);
  width: 20px;
  height: 14px;
}

.i18n-lang-cur {
  letter-spacing: 0.5px;
  font-weight: 700;
}

/* Dropdown menu — modern card with subtle shadow */
.i18n-lang-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: #ffffff;
  color: #1e293b;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  box-shadow:
    0 4px 6px -2px rgba(0, 0, 0, 0.04),
    0 12px 28px -4px rgba(0, 0, 0, 0.12);
  padding: 6px;
  z-index: 1000;
  opacity: 0;
  transform: translateY(-6px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}

.i18n-lang-wrap.open .i18n-lang-menu {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.i18n-lang-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.9em;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.i18n-lang-item:hover {
  background: #f8fafc;
}

.i18n-lang-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(79, 70, 229, 0.04));
  color: #4338ca;
  font-weight: 600;
}

.i18n-lang-item.active::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4338ca;
  margin-left: auto;
  flex-shrink: 0;
}

.i18n-lang-item-flag {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.i18n-lang-item-flag svg {
  display: block;
  border-radius: 3px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.12);
  width: 24px;
  height: 17px;
}

.i18n-lang-item-full {
  flex: 1;
  text-align: left;
  font-weight: 500;
}

.i18n-lang-item-code {
  opacity: 0.4;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.8px;
}

.i18n-lang-item.active .i18n-lang-item-code {
  display: none;
}

/* Inline variant (sidebar / dashboard footer) */
.i18n-lang-inline {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.i18n-lang-btn {
  padding: 5px 12px;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.74em;
  font-weight: 700;
  letter-spacing: 0.6px;
  cursor: pointer;
  border-radius: 999px;
  opacity: 0.55;
  transition: all 0.18s;
}

.i18n-lang-btn:hover {
  opacity: 0.9;
}

.i18n-lang-btn.active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Sidebar (qaranlıq fon) */
.sidebar .i18n-lang-inline {
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.12);
}
.sidebar .i18n-lang-btn.active {
  background: rgba(99, 102, 241, 0.35);
  color: #ffffff;
}

/* Landing navbar — "Giriş" düyməsi ilə eyni konsept:
   transparent fon, yarı şəffaf ağ haşiyə, incə hover effekti. */
.public-navbar .i18n-lang-toggle {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.85);
  box-shadow: none;
  padding: 6px 14px;
  font-size: 0.82em;
  font-weight: 500;
  border-radius: 8px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.public-navbar .i18n-lang-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
  color: #ffffff;
  transform: none;
}

.public-navbar .i18n-lang-wrap.open .i18n-lang-toggle {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.55);
  color: #ffffff;
}

.public-navbar .i18n-lang-toggle > svg {
  opacity: 0.7;
  color: currentColor;
}

.public-navbar .i18n-lang-cur {
  color: inherit;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.public-navbar .i18n-lang-flag svg {
  width: 18px;
  height: 13px;
  box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.25);
}

/* Auth səhifələri (login, register) üçün */
.auth-form-side .i18n-lang-toggle {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(15, 23, 42, 0.1);
  color: #0f172a;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.auth-form-side .i18n-lang-toggle:hover {
  background: #ffffff;
  border-color: rgba(99, 102, 241, 0.3);
}

/* Compact mode — flag only + code */
.i18n-lang-toggle.compact {
  padding: 6px 10px;
}
