/* ============================================================
   css/language-switcher.css
   Premium multilingual switcher — dropdown trigger + searchable
   panel. Built entirely from the existing design tokens in
   css/style.css (:root) — no new colors or fonts introduced.
   ============================================================ */

.lang-switcher { position: relative; }

.lang-switch-trigger {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  background: var(--sky-ultra);
  border: 1.5px solid var(--sky-light);
  border-radius: 999px;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--sky-deep);
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
}
.lang-switch-trigger:hover { background: var(--sky-light); border-color: var(--sky); }
.lang-switch-trigger:focus-visible { outline: 2.5px solid var(--sky-dark); outline-offset: 2px; }
.lang-switch-trigger .lang-flag { font-size: 1.05rem; }
.lang-switch-trigger .lang-chevron { font-size: 0.65rem; transition: transform 0.25s ease; }
.lang-switcher.is-open .lang-switch-trigger .lang-chevron { transform: rotate(180deg); }

.lang-switch-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 280px;
  max-width: min(280px, 88vw);
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--sky-light);
  padding: 10px;
  z-index: 1100;
  transform-origin: top right;
  opacity: 0;
  transform: scale(0.96) translateY(-6px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.lang-switcher.is-open .lang-switch-panel {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.lang-switch-search-wrap { position: relative; margin-bottom: 8px; }
.lang-switch-search-wrap i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--gray-light); font-size: 0.8rem;
}
.lang-switch-search {
  width: 100%;
  padding: 9px 12px 9px 32px;
  border: 1.5px solid var(--sky-light);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--dark);
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}
.lang-switch-search:focus { outline: none; border-color: var(--sky-dark); }

.lang-switch-list { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  transition: background 0.15s ease;
}
.lang-option:hover, .lang-option:focus-visible { background: var(--sky-ultra); }
.lang-option:focus-visible { outline: 2px solid var(--sky-dark); outline-offset: -2px; }
.lang-option.is-selected { background: var(--sky-light); }
.lang-option .lang-flag { font-size: 1.25rem; flex-shrink: 0; }
.lang-option .lang-names { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.lang-option .lang-native {
  font-family: var(--font-body); font-weight: 600; font-size: 0.92rem; color: var(--dark);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lang-option .lang-english { font-size: 0.76rem; color: var(--gray-muted); }
.lang-option .lang-check { margin-left: auto; color: var(--sky-dark); font-size: 0.8rem; flex-shrink: 0; }
.lang-option[hidden] { display: none; }

.lang-option.is-disabled {
  cursor: default;
  opacity: 0.55;
}
.lang-option.is-disabled:hover { background: none; }
.lang-badge {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--gray-muted);
  background: var(--gray-ultra);
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}

.lang-switch-empty { padding: 16px 10px; text-align: center; color: var(--gray-muted); font-size: 0.85rem; }

/* Footer sits on a dark background — a translucent-white pill reads
   better there than the light-blue trigger used in the (light) header. */
.footer .lang-switch-trigger {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.16);
  color: #cfe8f5;
}
.footer .lang-switch-trigger:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.28); }

/* Browser-language suggestion banner (inserted by js/language-switcher.js) */
.lang-suggest-banner {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  background: var(--sky-ultra); border-bottom: 1px solid var(--sky-light);
  padding: 10px 20px; font-family: var(--font-body); font-size: 0.88rem; color: var(--dark);
  text-align: center;
}
.lang-suggest-banner .lang-suggest-btn {
  background: var(--sky-dark); color: var(--white); border: none; border-radius: 999px;
  padding: 6px 16px; font-family: var(--font-main); font-weight: 600; font-size: 0.82rem;
  cursor: pointer; transition: var(--transition);
}
.lang-suggest-banner .lang-suggest-btn:hover { background: var(--sky-darker); }
.lang-suggest-banner .lang-suggest-dismiss {
  background: none; border: none; color: var(--gray-muted); font-size: 0.82rem;
  text-decoration: underline; cursor: pointer;
}

@media (max-width: 480px) {
  .lang-switch-trigger .lang-current-name { display: none; }
  .lang-switch-panel { right: -10px; width: 260px; }
}

@media (prefers-reduced-motion: reduce) {
  .lang-switch-panel, .lang-switch-trigger .lang-chevron { transition: none; }
}

/* Not a site-wide dark mode (the rest of the site doesn't have one yet) —
   just makes sure this component doesn't look broken if that's ever added. */
@media (prefers-color-scheme: dark) {
  .lang-switch-panel { background: var(--dark2); border-color: var(--dark); }
  .lang-switch-search { background: var(--dark); border-color: var(--dark2); color: var(--white); }
  .lang-option .lang-native { color: var(--white); }
  .lang-option:hover, .lang-option:focus-visible { background: rgba(56,182,232,0.12); }
  .lang-option.is-selected { background: rgba(56,182,232,0.18); }
}
