/* ── LANGUAGE DROPDOWN ── */
.lang-dropdown {
  position: relative;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.3s;
  white-space: nowrap;
}

.lang-toggle:hover {
  border-color: rgba(53, 217, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

.lang-dropdown.open .lang-toggle {
  border-color: rgba(53, 217, 255, 0.4);
  background: rgba(53, 217, 255, 0.08);
}

.lang-globe {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.lang-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.5;
  transition: transform 0.3s;
}

.lang-dropdown.open .lang-chevron {
  transform: rotate(180deg);
}

/* ── MENU ── */
.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  width: 220px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  background: rgba(8, 16, 28, 0.97);
  border: 1px solid rgba(53, 217, 255, 0.12);
  border-radius: 14px;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 0 20px rgba(53, 217, 255, 0.06);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  transition: max-height 0.35s ease, opacity 0.25s ease;
  z-index: 100;
}

.lang-dropdown.open .lang-menu {
  max-height: 380px;
  opacity: 1;
}

/* ── SEARCH ── */
.lang-search-wrap {
  padding: 10px 12px 6px;
}

.lang-search {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: white;
  font-size: 13px;
  outline: none;
  transition: border-color 0.3s;
  -webkit-appearance: none;
  appearance: none;
}

.lang-search::-webkit-search-decoration,
.lang-search::-webkit-search-cancel-button,
.lang-search::-webkit-search-results-button,
.lang-search::-webkit-search-results-decoration {
  display: none;
}

.lang-search::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.lang-search:focus {
  border-color: rgba(53, 217, 255, 0.35);
}

/* ── LIST ── */
.lang-list {
  list-style: none;
  margin: 0;
  padding: 4px 6px 8px;
  max-height: 290px;
  overflow-y: auto;
  /* يمنع تسرّب التمرير لصفحة الخلفية عند الوصول لحافة القائمة على الجوال */
  overscroll-behavior: contain;
}

.lang-list::-webkit-scrollbar {
  width: 4px;
}

.lang-list::-webkit-scrollbar-track {
  background: transparent;
}

.lang-list::-webkit-scrollbar-thumb {
  background: rgba(53, 217, 255, 0.2);
  border-radius: 4px;
}

.lang-option {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-option:hover {
  background: rgba(53, 217, 255, 0.08);
  color: white;
}

.lang-option.active {
  background: rgba(53, 217, 255, 0.12);
  color: var(--cyan);
  font-weight: 700;
}

.lang-option.active::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(53, 217, 255, 0.5);
  flex-shrink: 0;
}

.lang-option.hidden {
  display: none;
}

/* وضوح التركيز للتنقّل بلوحة المفاتيح (tabindex أُضيف على كل خيار) */
.lang-option:focus-visible {
  outline: 2px solid var(--cyan, #35d9ff);
  outline-offset: -2px;
  background: rgba(53, 217, 255, 0.08);
}

.lang-toggle:focus-visible {
  outline: 2px solid var(--cyan, #35d9ff);
  outline-offset: 2px;
}

/* ── COMING SOON MODAL ── */
.lang-soon-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s;
}

.lang-soon-modal.show {
  opacity: 1;
}

.lang-soon-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.lang-soon-card {
  position: relative;
  text-align: center;
  padding: 40px 36px 32px;
  border-radius: 22px;
  width: min(88%, 380px);
  background: linear-gradient(180deg, rgba(10, 20, 35, 0.97), rgba(4, 10, 20, 0.99));
  border: 1px solid rgba(53, 217, 255, 0.15);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.4), 0 0 24px rgba(53, 217, 255, 0.08);
  transform: scale(0.9);
  transition: transform 0.3s;
}

.lang-soon-modal.show .lang-soon-card {
  transform: scale(1);
}

.lang-soon-icon {
  font-size: 42px;
  margin-bottom: 16px;
}

.lang-soon-title {
  color: var(--cyan, #35d9ff);
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 12px;
}

.lang-soon-text {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 24px;
}

.lang-soon-btn {
  padding: 11px 36px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--cyan, #35d9ff), var(--cyan-2, #00fff0));
  color: #00131e;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.3s;
}

.lang-soon-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 18px rgba(53, 217, 255, 0.3);
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .lang-menu {
    width: 200px;
    inset-inline-end: auto;
    inset-inline-start: 0;
  }

  .lang-toggle {
    padding: 6px 10px;
    font-size: 12px;
  }

  .lang-globe { width: 16px; height: 16px; }
  .lang-chevron { width: 12px; height: 12px; }
}

@media (max-width: 400px) {
  .lang-menu {
    position: fixed;
    top: auto;
    bottom: 0;
    inset-inline-start: 0;
    inset-inline-end: 0;
    width: 100%;
    max-height: 0;
    border-radius: 18px 18px 0 0;
    /* مسافة آمنة أسفل شاشة اللمس (Home Indicator) — تمنع تلامس آخر عنصر
       في القائمة مع منطقة إيماءة الإغلاق على آيفون */
    padding-bottom: env(safe-area-inset-bottom);
  }

  .lang-dropdown.open .lang-menu {
    max-height: 60vh;
  }
}
