/* Shared workspace header controls. */
:root {
  --workspace-header-control-height: 36px;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-inline-size: 0;
  max-inline-size: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.language-switcher__field {
  position: relative;
  display: flex;
  align-items: center;
  min-inline-size: 0;
}

.language-switcher__field::before {
  position: absolute;
  inset-inline-start: 9px;
  z-index: 1;
  inline-size: 18px;
  block-size: 11px;
  border-radius: 2px;
  background: center / 100% 100% no-repeat url("../images/languages/en.13e79de6928a.svg");
  content: "";
  pointer-events: none;
}

.language-switcher__field[data-active-language="vi"]::before {
  background-image: url("../images/languages/vi.916795728a5c.svg");
}

@supports selector(:has(*)) {
  .language-switcher__field:has(option[value="en"]:checked)::before {
    background-image: url("../images/languages/en.13e79de6928a.svg");
  }

  .language-switcher__field:has(option[value="vi"]:checked)::before {
    background-image: url("../images/languages/vi.916795728a5c.svg");
  }
}

.workspace-header-select,
.workspace-header-apply,
.workspace-home-link {
  box-sizing: border-box;
  min-block-size: var(--workspace-header-control-height);
  max-inline-size: 100%;
  padding: 0 10px;
  border: 1px solid var(--workspace-home-border, #cbd5e1);
  border-radius: var(--radius, 8px);
  background: var(--workspace-home-background, #fff);
  color: var(--workspace-home-foreground, #334155);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.25;
}

.workspace-header-select {
  inline-size: max-content;
  cursor: pointer;
}

.language-switcher__select {
  min-inline-size: 7.65rem;
  padding-inline-start: 33px;
}

.workspace-header-apply,
.workspace-home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.workspace-home-link {
  min-inline-size: 4.5rem;
}

:is(.workspace-header-select, .workspace-header-apply, .workspace-home-link):hover {
  border-color: var(--workspace-home-hover-border, #93c5fd);
  background: var(--workspace-home-hover-background, #eff6ff);
  color: var(--workspace-home-hover-foreground, #1e3a8a);
}

:is(.workspace-header-select, .workspace-header-apply, .workspace-home-link):focus-visible {
  outline: 2px solid var(--workspace-header-focus, #165aae);
  outline-offset: 2px;
}

@supports (appearance: base-select) and selector(::picker(select)) {
  .workspace-header-select,
  .workspace-header-select::picker(select) {
    appearance: base-select;
  }

  .language-switcher__field::before {
    display: none;
  }

  .workspace-header-select {
    align-items: center;
    gap: 6px;
    padding-inline: 9px;
  }

  .language-switcher__select > button {
    display: contents;
  }

  .language-switcher__select :is(selectedcontent, option) {
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
  }

  .language-switcher__select img {
    flex: none;
    inline-size: 18px;
    block-size: 11px;
    border-radius: 2px;
  }

  .workspace-header-select::picker-icon {
    margin-inline-start: auto;
    color: inherit;
    font-size: 0.7rem;
  }

  .workspace-header-select::picker(select) {
    margin-block-start: 4px;
    padding: 4px;
    border: 1px solid var(--workspace-home-border, #cbd5e1);
    border-radius: 8px;
    background: var(--workspace-home-background, #fff);
    color: var(--workspace-home-foreground, #334155);
  }

  .workspace-header-select option {
    min-block-size: var(--workspace-header-control-height);
    padding: 5px 7px;
    border-radius: 5px;
  }

  .workspace-header-select option:is(:checked, :hover, :focus) {
    background: var(--workspace-home-hover-background, #eff6ff);
    color: var(--workspace-home-hover-foreground, #1e3a8a);
  }

  .workspace-header-select option::checkmark {
    order: 1;
    margin-inline-start: auto;
  }

  @media (max-width: 360px) {
    .workspace-header-select {
      padding-inline: 6px;
    }
  }
}

@media (max-width: 760px), (any-pointer: coarse) {
  :root {
    --workspace-header-control-height: 44px;
  }
}

@media (max-width: 400px) {
  .language-switcher__select {
    min-inline-size: 7rem;
  }

  .workspace-header-apply {
    padding-inline: 8px;
  }
}

@media (max-width: 360px) {
  .language-switcher {
    gap: 4px;
  }

  :is(.workspace-header-select, .workspace-header-apply, .workspace-home-link) {
    min-inline-size: 0;
    font-size: 0.75rem;
  }

  :is(.workspace-header-apply, .workspace-home-link) {
    min-inline-size: var(--workspace-header-control-height);
    padding-inline: 4px;
  }
}

@media print {
  .language-switcher {
    display: none !important;
  }
}
