/* Language switcher (templates/partials/lang_switch.html).
   Loaded by the public site, the client area and the trading terminal. The
   site and client area supply the colour tokens from nove.css / dashboard.css
   (so dark mode follows for free); the fallbacks are for the terminal, which
   has its own palette. */

.lang-switch { position: relative; display: inline-block; flex: 0 0 auto; }
.lang-switch > summary {
  list-style: none; cursor: pointer; user-select: none; -webkit-user-select: none;
  display: inline-flex; align-items: center; gap: .4rem;
  height: 38px; padding: 0 .75rem; border-radius: 999px;
  border: 1px solid var(--border, #e5e7eb); background: var(--surface, #fff);
  color: var(--ink, #191919);
  font-family: var(--font, system-ui, sans-serif); font-weight: 600; font-size: .8rem; line-height: 1;
  letter-spacing: .02em; white-space: nowrap;
  transition: border-color .15s, background .15s, color .15s;
}
.lang-switch > summary::-webkit-details-marker { display: none; }
.lang-switch > summary::marker { content: ""; }
.lang-switch > summary:hover { border-color: var(--border-bright, #cfd4dc); }
.lang-switch > summary:focus-visible { outline: 2px solid var(--brand, #ec1c24); outline-offset: 2px; }
.lang-switch .lang-globe { width: 17px; height: 17px; flex: 0 0 auto; }
.lang-switch .lang-caret { width: 12px; height: 12px; flex: 0 0 auto; opacity: .55; transition: transform .15s; }
.lang-switch[open] .lang-caret { transform: rotate(180deg); }
.lang-switch .lang-name { display: none; }

.lang-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 120;
  min-width: 210px; margin: 0; padding: .4rem;
  border-radius: 14px; border: 1px solid var(--border, #e5e7eb);
  background: var(--surface, #fff);
  box-shadow: 0 24px 48px -16px rgba(25, 25, 25, .25), 0 4px 10px rgba(25, 25, 25, .06);
  animation: langIn .14s ease-out;
}
@keyframes langIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .lang-panel { animation: none; } }
.lang-title {
  margin: .35rem .65rem .4rem; font-family: var(--font, system-ui, sans-serif);
  font-size: .64rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted, #6b7280);
}
.lang-opt {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: .9rem;
  padding: .62rem .7rem; border: 0; border-radius: 10px; background: transparent;
  color: var(--ink, #191919); cursor: pointer; text-align: left;
  font-family: var(--font, system-ui, sans-serif); font-size: .9rem; font-weight: 500; line-height: 1.2;
}
.lang-opt:hover, .lang-opt:focus-visible { background: var(--surface-2, #f3f4f6); outline: none; }
.lang-opt.is-current { font-weight: 700; }
.lang-opt-code { font-size: .68rem; font-weight: 600; letter-spacing: .08em; color: var(--muted, #6b7280); }
.lang-check { width: 16px; height: 16px; flex: 0 0 auto; color: var(--brand, #ec1c24); }

/* Every header shows the compact globe + code ("VI"); the open menu lists
   each language by its full name. A full name in the bar pushed the public
   navigation off one line at common laptop widths. */
/* Phones: the globe and the code only, and a panel that cannot run off-screen. */
@media (max-width: 560px) {
  .lang-switch > summary { height: 36px; padding: 0 .6rem; gap: .3rem; }
  .lang-switch .lang-caret { display: none; }
  .lang-panel { position: fixed; top: auto; right: 12px; left: auto; margin-top: 8px; max-width: calc(100vw - 24px); }
}

/* Client area: the same height and corner as the notification bell beside it. */
.lang-app > summary { height: 38px; border-radius: 12px; color: var(--muted, #6b7280); }
.lang-app > summary:hover { color: var(--ink, #191919); }
@media (max-width: 760px) { .lang-app > summary { height: 36px; border-radius: 10px; } }

/* Trading terminal: dark navy on desktop, white on phones and in light mode. */
.lang-terminal > summary {
  height: 36px; border-radius: 8px; padding: 0 .6rem;
  border-color: #1E293B; background: rgba(255, 255, 255, .06); color: #F1F5F9;
  font-family: "Inter", system-ui, sans-serif;
}
.lang-terminal > summary:hover { background: rgba(255, 255, 255, .1); border-color: #263248; }
.lang-terminal .lang-panel { background: #0F172A; border-color: #1E293B; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .6); }
.lang-terminal .lang-opt { color: #F1F5F9; font-family: "Inter", system-ui, sans-serif; }
.lang-terminal .lang-opt:hover, .lang-terminal .lang-opt:focus-visible { background: rgba(255, 255, 255, .07); }
.lang-terminal .lang-title, .lang-terminal .lang-opt-code { color: #94A3B8; font-family: "Inter", system-ui, sans-serif; }
.lang-terminal .lang-check { color: #DDF83B; }
body.t-light .lang-terminal > summary { background: #F3F4F6; border-color: #E5E7EB; color: #0B1120; }
body.t-light .lang-terminal .lang-panel { background: #fff; border-color: #E5E7EB; box-shadow: 0 24px 48px -16px rgba(15, 23, 42, .25); }
body.t-light .lang-terminal .lang-opt { color: #0B1120; }
body.t-light .lang-terminal .lang-opt:hover { background: #F3F4F6; }
body.t-light .lang-terminal .lang-check { color: #E8352C; }
@media (max-width: 1023px) {
  .lang-terminal > summary { height: 28px; padding: 0 .45rem; gap: .25rem; border-radius: 999px; background: #F3F4F6; border-color: #E5E7EB; color: #0B1120; font-size: .68rem; }
  .lang-terminal > summary .lang-globe { width: 14px; height: 14px; }
  .lang-terminal > summary .lang-caret { display: none; }
  .lang-terminal .lang-panel { background: #fff; border-color: #E5E7EB; box-shadow: 0 24px 48px -16px rgba(15, 23, 42, .25); }
  .lang-terminal .lang-opt { color: #0B1120; }
  .lang-terminal .lang-opt:hover { background: #F3F4F6; }
  .lang-terminal .lang-check { color: #E8352C; }
}

/* The globe needs ~60px in the terminal's phone header; on phones the red N
   mark alone carries the brand, so the words make room instead of the
   connection pill sliding over them. (#terminal raises specificity over the
   terminal page's own inline phone rules, which load after this file.) */
@media (max-width: 480px) {
  #terminal #t-header .t-logo-word { display: none; }
}
