/* ---------------------------------------------------------------------------
   Infra 360 - small shared controls used on every page (map, viewer, login,
   account): the dark-mode switch and the language flags. Styled through
   tokens.css only. Behaviour lives in theme.js (.theme-toggle) and i18n.js
   (.lang-flags / .lang-pick).
--------------------------------------------------------------------------- */

/* Switch row: <button class="theme-toggle sw-row" role="switch" aria-checked>
   <span data-i18n="theme.dark">Dark mode</span><span class="sw"></span></button>
   Same pill as the Layers menu's .lm-sw so on/off reads the same everywhere. */
.sw-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  font: 500 13px var(--sans);
  color: var(--text);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
}

.sw {
  width: 28px;
  height: 16px;
  border-radius: 99px;
  background: var(--track);
  position: relative;
  flex: 0 0 auto;
  transition: background 0.15s;
}

.sw::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.15s;
}

[aria-checked='true'] > .sw {
  background: var(--mint);
}

[aria-checked='true'] > .sw::after {
  left: 14px;
}

.sw-row:focus-visible {
  outline: none;
}

.sw-row:focus-visible .sw {
  outline: 2px solid var(--mint-line);
  outline-offset: 2px;
}

/* Language flags: <div class="lang-flags"></div> - i18n.js fills it with one
   button per language (SVG flags, not emoji: Windows renders flag emoji as
   letters). The active language is full colour with a mint ring, the other
   dimmed. */
.lang-flags {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lang-pick {
  width: 30px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  opacity: 0.45;
  overflow: hidden;
  display: grid;
  place-items: center;
  transition: opacity 0.15s, box-shadow 0.15s;
}

.lang-pick svg {
  display: block;
  width: 28px;
  height: 20px;
  border-radius: 3px;
}

.lang-pick:hover {
  opacity: 0.8;
}

.lang-pick[aria-pressed='true'] {
  opacity: 1;
  border-color: var(--mint);
  box-shadow: 0 0 0 2px var(--mint-tint);
}

.lang-pick:focus-visible {
  outline: 2px solid var(--mint-line);
  outline-offset: 2px;
}

/* Inside the Account dropdown: a static row with the label left, flags right */
.um-static {
  cursor: default;
  justify-content: space-between;
}

.um-static > span:first-of-type {
  flex: 1 1 auto;
}
