/* Floating variant — closed by default, opens on click */

.babel-switcher {
	position: fixed;
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.babel-switcher--bottom-right {
	bottom: 20px;
	right: 20px;
}

.babel-switcher--bottom-left {
	bottom: 20px;
	left: 20px;
}

.babel-switcher--top-right {
	top: 20px;
	right: 20px;
}

.babel-switcher--top-left {
	top: 20px;
	left: 20px;
}

.babel-switcher__toggle {
	display: block;
	background: var(--babel-switcher-bg, #1d2327);
	color: var(--babel-switcher-text, #ffffff);
	border: var(--babel-switcher-border-width, 0px) solid var(--babel-switcher-border-color, transparent);
	padding: 8px 14px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.03em;
	cursor: pointer;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
	transition: opacity 0.15s ease, background 0.15s ease;
}

.babel-switcher__toggle:hover {
	opacity: 0.9;
	background: var(--babel-switcher-hover, var(--babel-switcher-bg, #1d2327));
}

.babel-switcher.is-open .babel-switcher__toggle {
	border-radius: 999px 999px 0 0;
}

.babel-switcher__list {
	display: none;
	flex-direction: column;
	gap: 2px;
	position: absolute;
	min-width: 100%;
	background: var(--babel-switcher-bg, #1d2327);
	border: var(--babel-switcher-border-width, 0px) solid var(--babel-switcher-border-color, transparent);
	padding: 6px;
	border-radius: 10px;
	box-sizing: border-box;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.babel-switcher.is-open .babel-switcher__list {
	display: flex;
}

.babel-switcher--bottom-right .babel-switcher__list,
.babel-switcher--bottom-left .babel-switcher__list {
	bottom: calc(100% + 6px);
}

.babel-switcher--top-right .babel-switcher__list,
.babel-switcher--top-left .babel-switcher__list {
	top: calc(100% + 6px);
}

.babel-switcher--bottom-right .babel-switcher__list,
.babel-switcher--top-right .babel-switcher__list {
	right: 0;
}

.babel-switcher--bottom-left .babel-switcher__list,
.babel-switcher--top-left .babel-switcher__list {
	left: 0;
}

.babel-switcher__lang {
	display: block;
	padding: 6px 12px;
	border-radius: 6px;
	color: var(--babel-switcher-text, #ffffff);
	text-decoration: none;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.03em;
	white-space: nowrap;
	opacity: 0.75;
	transition: opacity 0.15s ease, background 0.15s ease;
}

.babel-switcher__lang:hover {
	opacity: 1;
	color: var(--babel-switcher-text, #ffffff);
	background: var(--babel-switcher-hover, rgba(255, 255, 255, 0.08));
}

.babel-switcher__lang.is-active {
	background: var(--babel-switcher-active, #0073aa);
	opacity: 1;
}

/* Mobile position override — only applied when the "Position (Mobile)" setting
   is set to something other than "Same as desktop". Selector specificity
   (two classes) beats the plain .babel-switcher--{position} rules above, so
   this always wins on small screens without needing !important. */

@media (max-width: 600px) {
	.babel-switcher.babel-switcher--mobile-bottom-right {
		top: auto;
		right: 12px;
		bottom: 12px;
		left: auto;
	}

	.babel-switcher.babel-switcher--mobile-bottom-left {
		top: auto;
		right: auto;
		bottom: 12px;
		left: 12px;
	}

	.babel-switcher.babel-switcher--mobile-top-right {
		top: 12px;
		right: 12px;
		bottom: auto;
		left: auto;
	}

	.babel-switcher.babel-switcher--mobile-top-left {
		top: 12px;
		right: auto;
		bottom: auto;
		left: 12px;
	}

	.babel-switcher--mobile-bottom-right .babel-switcher__list,
	.babel-switcher--mobile-bottom-left .babel-switcher__list {
		bottom: calc(100% + 6px);
		top: auto;
	}

	.babel-switcher--mobile-top-right .babel-switcher__list,
	.babel-switcher--mobile-top-left .babel-switcher__list {
		top: calc(100% + 6px);
		bottom: auto;
	}

	.babel-switcher--mobile-bottom-right .babel-switcher__list,
	.babel-switcher--mobile-top-right .babel-switcher__list {
		right: 0;
		left: auto;
	}

	.babel-switcher--mobile-bottom-left .babel-switcher__list,
	.babel-switcher--mobile-top-left .babel-switcher__list {
		left: 0;
		right: auto;
	}
}

/* Menu item variant — a self-contained popup built from <div>s, not a bare
   <ul>, so themes (Kadence included) can't mistake it for a real submenu and
   attach their own hover/click JS to it — that's what caused the jitter and
   forced vertical stacking. Reuses the same .babel-switcher__toggle /
   .babel-switcher__list markup and JS as the floating variant; only the
   positioning and skin differ here. Colors/Border settings intentionally
   don't apply to this variant (see Settings copy) — a plain white popup is
   used instead so it stays legible regardless of the theme. */

.babel-switcher-menu-item {
	position: relative;
	list-style: none;
}

.babel-switcher--menu {
	position: relative;
	display: inline-flex;
	align-items: center;
	font-family: inherit;
	z-index: auto;
}

.babel-switcher--menu .babel-switcher__toggle {
	background: none;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	border: none;
	box-shadow: none;
	padding: 0;
	border-radius: 0;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.babel-switcher--menu .babel-switcher__toggle:hover {
	opacity: 0.75;
	background: none;
}

.babel-switcher--menu .babel-switcher__toggle::after {
	content: '';
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 4px solid currentColor;
	opacity: 0.6;
}

.babel-switcher--menu .babel-switcher__list {
	position: absolute;
	top: 100%;
	right: 0;
	margin-top: 8px;
	min-width: 110px;
	background: #ffffff;
	border: 1px solid rgba(0, 0, 0, 0.1);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
	border-radius: 6px;
	padding: 4px;
	z-index: 999;
	box-sizing: border-box;
}

.babel-switcher--menu .babel-switcher__lang {
	color: #1d2327;
	opacity: 0.75;
}

.babel-switcher--menu .babel-switcher__lang:hover {
	opacity: 1;
	color: #1d2327;
	background: rgba(0, 0, 0, 0.06);
}

.babel-switcher--menu .babel-switcher__lang.is-active {
	background: #f0f0f1;
	opacity: 1;
	font-weight: 700;
}

/* "Inline list" Menu Style — always show every language, no click-to-open popup. */

.babel-switcher--menu-list .babel-switcher__toggle {
	display: none;
}

.babel-switcher--menu-list .babel-switcher__list {
	display: flex;
	position: static;
	flex-direction: row;
	gap: 4px;
	margin: 0;
	background: none;
	border: none;
	box-shadow: none;
	padding: 0;
}

.babel-switcher--menu-list .babel-switcher__lang {
	color: inherit;
	opacity: 0.75;
	padding: 2px 6px;
	border-radius: 4px;
}

.babel-switcher--menu-list .babel-switcher__lang:hover {
	opacity: 1;
	background: rgba(127, 127, 127, 0.15);
}

.babel-switcher--menu-list .babel-switcher__lang.is-active {
	opacity: 1;
	background: rgba(127, 127, 127, 0.15);
	font-weight: 700;
}

/* On small screens, always fall back to a plain always-visible vertical list
   regardless of the "Menu Style" setting — a popup positioned absolute/right:0
   is awkward to use inside a mobile hamburger panel. */
@media (max-width: 600px) {
	.babel-switcher--menu .babel-switcher__toggle {
		display: none;
	}

	.babel-switcher--menu .babel-switcher__list {
		display: flex;
		position: static;
		flex-direction: column;
		gap: 2px;
		margin: 4px 0 0;
		background: none;
		border: none;
		box-shadow: none;
		padding: 0;
	}

	.babel-switcher--menu .babel-switcher__lang {
		color: inherit;
		opacity: 0.75;
		padding: 4px 6px;
		border-radius: 4px;
	}

	.babel-switcher--menu .babel-switcher__lang:hover {
		opacity: 1;
		background: rgba(127, 127, 127, 0.15);
	}

	.babel-switcher--menu .babel-switcher__lang.is-active {
		opacity: 1;
		background: rgba(127, 127, 127, 0.15);
		font-weight: 700;
	}
}
