/* SWI Multi-Lang — language switcher */
.swiml-switcher {
  display: block;
  font-size: 0.9375rem;
  line-height: 1.4;
}

.swiml-switcher__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.swiml-switcher--stacked .swiml-switcher__list {
  flex-direction: column;
  align-items: flex-start;
}

.swiml-switcher__item a,
.swiml-switcher__dropdown-toggle,
.swiml-switcher__dropdown-menu a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  transition:
    opacity 0.15s ease,
    background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.swiml-switcher__item a:hover,
.swiml-switcher__item a:focus-visible,
.swiml-switcher__dropdown-toggle:hover,
.swiml-switcher__dropdown-toggle:focus-visible,
.swiml-switcher__dropdown-menu a:hover,
.swiml-switcher__dropdown-menu a:focus-visible {
  opacity: 1;
  outline: none;
}

.swiml-switcher__flag {
  display: inline-block;
  vertical-align: middle;
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
}

.swiml-switcher__flag--code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 15px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.swiml-switcher__label {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  flex-shrink: 0;
}

/* Dropdown */
.swiml-switcher__dropdown {
  position: relative;
  display: inline-block;
  width: auto;
  max-width: 100%;
  vertical-align: middle;
}

.swiml-switcher__dropdown-toggle {
  width: auto;
  max-width: 100%;
  justify-content: space-between;
  cursor: pointer;
  font: inherit;
  color: inherit;
  background: transparent;
  text-align: left;
  box-sizing: border-box;
}

.swiml-switcher__dropdown-current {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  overflow: visible;
}

.swiml-switcher__dropdown-caret {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 0.35rem;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.65;
  flex-shrink: 0;
}

.swiml-switcher__dropdown-menu {
  position: absolute;
  z-index: 100;
  top: calc(100% + 4px);
  bottom: auto;
  left: 0;
  right: auto;
  width: max-content;
  min-width: 100%;
  max-width: min(90vw, 20rem);
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 0.375rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  max-height: 60vh;
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
}

/* Open upward when near the bottom of the viewport */
.swiml-switcher__dropdown.is-open-up .swiml-switcher__dropdown-menu {
  top: auto;
  bottom: calc(100% + 4px);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12);
}

.swiml-switcher__dropdown-menu[hidden] {
  display: none;
}

.swiml-switcher__dropdown-menu .swiml-switcher__item {
  margin: 0;
}

.swiml-switcher__dropdown-menu a {
  display: flex;
  width: 100%;
  padding: 0.45rem 0.75rem;
  border: none;
  border-radius: 0;
  opacity: 0.85;
  box-sizing: border-box;
  white-space: nowrap;
}

.swiml-switcher__dropdown-menu .swiml-switcher__item.is-active a,
.swiml-switcher__dropdown-menu a[aria-selected="true"] {
  opacity: 1;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.05);
}

.swiml-switcher__dropdown.is-open .swiml-switcher__dropdown-caret {
  transform: rotate(180deg);
}

/* Pill */
.swiml-switcher--style-pill .swiml-switcher__item a,
.swiml-switcher--style-pill .swiml-switcher__dropdown-toggle {
  padding: 0.35rem 0.65rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  opacity: 0.72;
}

.swiml-switcher--style-pill .swiml-switcher__item.is-active a,
.swiml-switcher--style-pill .swiml-switcher__item a[aria-current="true"] {
  opacity: 1;
  font-weight: 600;
  background: color-mix(in srgb, currentColor 12%, transparent);
}

/* Minimal */
.swiml-switcher--style-minimal .swiml-switcher__item a,
.swiml-switcher--style-minimal .swiml-switcher__dropdown-toggle {
  padding: 0.2rem 0.45rem;
  border: none;
  opacity: 0.65;
}

.swiml-switcher--style-minimal .swiml-switcher__item.is-active a,
.swiml-switcher--style-minimal .swiml-switcher__item a[aria-current="true"] {
  opacity: 1;
  font-weight: 600;
}

/* Tabs */
.swiml-switcher--style-tabs .swiml-switcher__list {
  gap: 0;
  border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
  border-radius: 0.5rem;
  overflow: hidden;
}

.swiml-switcher--style-tabs .swiml-switcher__item a {
  padding: 0.45rem 0.75rem;
  border: none;
  border-right: 1px solid color-mix(in srgb, currentColor 20%, transparent);
  border-radius: 0;
  opacity: 0.75;
  background: color-mix(in srgb, currentColor 4%, transparent);
}

.swiml-switcher--style-tabs .swiml-switcher__item:last-child a {
  border-right: none;
}

.swiml-switcher--style-tabs .swiml-switcher__item.is-active a,
.swiml-switcher--style-tabs .swiml-switcher__item a[aria-current="true"] {
  opacity: 1;
  font-weight: 600;
  background: color-mix(in srgb, currentColor 14%, transparent);
}

.swiml-switcher--style-tabs .swiml-switcher__dropdown-toggle {
  padding: 0.45rem 0.75rem;
  border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
  border-radius: 0.5rem;
  background: color-mix(in srgb, currentColor 4%, transparent);
}

/* Buttons */
.swiml-switcher--style-buttons .swiml-switcher__item a,
.swiml-switcher--style-buttons .swiml-switcher__dropdown-toggle {
  padding: 0.4rem 0.75rem;
  border: none;
  border-radius: 0.375rem;
  opacity: 1;
  background: color-mix(in srgb, currentColor 10%, transparent);
}

.swiml-switcher--style-buttons .swiml-switcher__item a:hover,
.swiml-switcher--style-buttons .swiml-switcher__item a:focus-visible,
.swiml-switcher--style-buttons .swiml-switcher__dropdown-toggle:hover,
.swiml-switcher--style-buttons .swiml-switcher__dropdown-toggle:focus-visible {
  background: color-mix(in srgb, currentColor 18%, transparent);
}

.swiml-switcher--style-buttons .swiml-switcher__item.is-active a,
.swiml-switcher--style-buttons .swiml-switcher__item a[aria-current="true"] {
  font-weight: 600;
  background: #2271b1;
  color: #fff;
}

/* Underline */
.swiml-switcher--style-underline .swiml-switcher__item a,
.swiml-switcher--style-underline .swiml-switcher__dropdown-toggle {
  padding: 0.25rem 0.35rem;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  opacity: 0.65;
}

.swiml-switcher--style-underline .swiml-switcher__item.is-active a,
.swiml-switcher--style-underline .swiml-switcher__item a[aria-current="true"] {
  opacity: 1;
  font-weight: 600;
  border-bottom-color: currentColor;
}

/* Badges (compact codes) */
.swiml-switcher--style-badges .swiml-switcher__list {
  gap: 0.35rem;
}

.swiml-switcher--style-badges .swiml-switcher__item a,
.swiml-switcher--style-badges .swiml-switcher__dropdown-toggle {
  min-width: auto;
  justify-content: center;
  padding: 0.35rem 0.55rem;
  border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
  border-radius: 0.3rem;
  opacity: 0.8;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0.02em;
}

.swiml-switcher--style-badges .swiml-switcher__item.is-active a,
.swiml-switcher--style-badges .swiml-switcher__item a[aria-current="true"] {
  opacity: 1;
  background: color-mix(in srgb, currentColor 15%, transparent);
  border-color: currentColor;
}

.swiml-switcher--style-badges .swiml-switcher__label {
  font-size: inherit;
}

/* Global fixed switcher */
.swiml-switcher-global {
  position: fixed;
  z-index: var(--swiml-z, 99999);
  max-width: min(100vw - 2rem, 24rem);
  width: max-content;
  padding: 0.5rem 0.65rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.swiml-switcher-global .swiml-switcher__dropdown {
  max-width: 100%;
}

.swiml-switcher-global--top-left {
  top: var(--swiml-offset-y, 16px);
  left: var(--swiml-offset-x, 16px);
}

.swiml-switcher-global--top-center {
  top: var(--swiml-offset-y, 16px);
  left: 50%;
  transform: translateX(-50%);
}

.swiml-switcher-global--top-right {
  top: var(--swiml-offset-y, 16px);
  right: var(--swiml-offset-x, 16px);
}

.swiml-switcher-global--bottom-left {
  bottom: var(--swiml-offset-y, 16px);
  left: var(--swiml-offset-x, 16px);
}

.swiml-switcher-global--bottom-center {
  bottom: var(--swiml-offset-y, 16px);
  left: 50%;
  transform: translateX(-50%);
}

.swiml-switcher-global--bottom-right {
  bottom: var(--swiml-offset-y, 16px);
  right: var(--swiml-offset-x, 16px);
}

/* Admin preview: contained inside preview frame, not viewport-fixed */
.swiml-switcher-global.swiml-switcher-global--preview {
  position: absolute;
  z-index: 2;
}

@media (prefers-color-scheme: dark) {
  .swiml-switcher-global:not(.swiml-switcher-global--preview) {
    background: rgba(30, 30, 30, 0.94);
    border-color: rgba(255, 255, 255, 0.12);
    color: #f0f0f0;
  }

  .swiml-switcher__dropdown-menu {
    background: #2a2a2a;
    border-color: rgba(255, 255, 255, 0.12);
    color: #f0f0f0;
  }

  .swiml-switcher__dropdown-menu .swiml-switcher__item.is-active a,
  .swiml-switcher__dropdown-menu a[aria-selected="true"] {
    background: rgba(255, 255, 255, 0.08);
  }

  .swiml-switcher--style-buttons .swiml-switcher__item.is-active a,
  .swiml-switcher--style-buttons .swiml-switcher__item a[aria-current="true"] {
    background: #3582c4;
  }
}
