/* This file styles the shared language selector in a small and quiet way. */
.liftstyleLangSwitch {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: 100%;
  z-index: 40;
}

/* This keeps the language control on a real surface instead of a transparent glass look. */
:root {
  --liftstyle-lang-surface: #ffffff;
  --liftstyle-lang-surface-strong: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --liftstyle-lang-surface: #182235;
    --liftstyle-lang-surface-strong: #182235;
  }
}

/* This is the small fallback used only when a page has no good header area. */
.liftstyleLangSwitch.isFloating {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 140;
}

/* This keeps dedicated slots aligned without adding extra visual weight. */
[data-language-switcher-slot] {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  max-width: 100%;
}

/* This keeps fallback placements aligned with the rest of the page. */
.topbarInner > .liftstyleLangSwitch,
.nav > .liftstyleLangSwitch,
.page > .liftstyleLangSwitch,
.recoveryCard > .liftstyleLangSwitch {
  margin-left: auto;
}

/* This places the selector at the top of simple pages when no custom slot exists. */
.page > .liftstyleLangSwitch,
.recoveryCard > .liftstyleLangSwitch {
  justify-self: end;
}

/* This removes the large grid gap when the selector is the first item in a page layout. */
.page > .liftstyleLangSwitch {
  margin-bottom: calc(-1 * var(--section-gap, 48px) + 12px);
}

/* This keeps the recovery page spacing compact and clean. */
.recoveryCard > .liftstyleLangSwitch {
  margin-bottom: -2px;
}

/* This is the compact trigger shown in landing pages and settings. */
.liftstyleLangTrigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--line) 90%, transparent);
  border-radius: 999px;
  background: var(--liftstyle-lang-surface);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(8px);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

/* This keeps the short language code easy to scan. */
.liftstyleLangTriggerValue {
  letter-spacing: 0.08em;
}

/* This keeps full language names natural inside the app settings row. */
.liftstyleLangSwitch[data-layout="settings-row"] .liftstyleLangTriggerValue {
  letter-spacing: 0;
}

/* This gives the trigger a small visual cue without making it loud. */
.liftstyleLangChevron {
  font-size: 11px;
  line-height: 1;
}

/* This styles the open menu with a small card look. */
.liftstyleLangMenu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  gap: 4px;
  min-width: 160px;
  max-width: min(180px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--line) 90%, transparent);
  border-radius: 16px;
  background: var(--liftstyle-lang-surface-strong);
  box-shadow: 0 22px 38px rgba(15, 23, 42, 0.16);
}

/* This lets the menu open upward when there is not enough space below. */
.liftstyleLangSwitch[data-direction="up"] .liftstyleLangMenu {
  top: auto;
  bottom: calc(100% + 8px);
}

/* This hides the menu when it is closed. */
.liftstyleLangMenu[hidden] {
  display: none;
}

/* This styles one choice inside the language menu. */
.liftstyleLangOption {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

/* This highlights the current active language. */
.liftstyleLangOption.isActive {
  background: color-mix(in srgb, var(--ink) 10%, transparent);
  color: var(--ink);
}

/* This keeps keyboard navigation visible on the language control. */
.liftstyleLangTrigger:focus-visible,
.liftstyleLangOption:focus-visible {
  outline: 2px solid rgba(31, 122, 140, 0.42);
  outline-offset: 2px;
}

/* This removes extra chrome in the settings row so it reads like one preference. */
.liftstyleLangSwitch[data-layout="settings-row"] .liftstyleLangTrigger {
  min-height: 36px;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 12px;
  background: var(--liftstyle-lang-surface);
  box-shadow: none;
  backdrop-filter: none;
  color: inherit;
  font-size: 13px;
  justify-content: flex-end;
}

/* This keeps the app selector compact when it lives near the close button. */
.liftstyleLangSwitch[data-layout="app-toolbar"] .liftstyleLangTrigger {
  min-height: 40px;
  padding: 0 10px;
  border-radius: 14px;
  background: var(--liftstyle-lang-surface);
  border-color: var(--line);
  box-shadow: none;
  backdrop-filter: none;
}

/* This keeps the landing selector especially discreet near the micro header. */
.liftstyleLangSwitch[data-layout="landing-hero"] .liftstyleLangTrigger {
  min-height: 32px;
  padding: 5px 9px;
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.12);
}

/* This keeps the landing language menu on a plain white card for maximum contrast. */
.liftstyleLangSwitch[data-layout="landing-hero"] .liftstyleLangMenu {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
}

/* This keeps landing language options dark enough even when the browser is in dark mode. */
.liftstyleLangSwitch[data-layout="landing-hero"] .liftstyleLangOption {
  color: #475569;
}

.liftstyleLangSwitch[data-layout="landing-hero"] .liftstyleLangOption.isActive {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

@media (max-width: 720px) {
  .liftstyleLangSwitch.isFloating {
    top: 10px;
    right: 10px;
  }

  /* This keeps the mobile menu attached to the trigger instead of sending it to the bottom. */
  .liftstyleLangMenu {
    top: calc(100% + 6px);
    min-width: 148px;
    max-width: min(180px, calc(100vw - 20px));
  }

  .liftstyleLangSwitch[data-direction="up"] .liftstyleLangMenu {
    bottom: calc(100% + 6px);
  }

  .liftstyleLangSwitch[data-layout="settings-row"] .liftstyleLangTrigger {
    justify-content: space-between;
    width: 100%;
  }
}
