/**
 * BESTNET Translator — Floating Language Switcher
 * Scoped under #bnt-lang-switcher / .bnt-ls to avoid theme collisions.
 */

#bnt-lang-switcher.bnt-ls {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99990;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP",
		"Noto Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
	direction: ltr;
}

/* Collapsed pill button */
.bnt-ls__toggle {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 10px 14px;
	background: #1e0d6f; /* hostiko dark blue */
	color: #fff;
	border: none;
	border-radius: 999px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
	transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.bnt-ls__toggle:hover {
	background: #294df0; /* hostiko accent */
	transform: translateY(-1px);
	box-shadow: 0 12px 30px rgba(41, 77, 240, 0.32);
}
.bnt-ls__toggle:focus-visible {
	outline: 3px solid rgba(41, 77, 240, 0.5);
	outline-offset: 2px;
}
.bnt-ls__globe { flex: 0 0 auto; }
.bnt-ls__toggle-flag {
	flex: 0 0 auto;
	width: 20px;
	height: 14px;
	border-radius: 3px;
	object-fit: cover;
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.45);
	display: block;
}
.bnt-ls__current { letter-spacing: 0.02em; }
.bnt-ls__caret {
	flex: 0 0 auto;
	transition: transform 0.2s ease;
	opacity: 0.85;
}
.bnt-ls.is-open .bnt-ls__caret { transform: rotate(180deg); }

/* Expanding menu */
.bnt-ls__menu {
	position: absolute;
	right: 0;
	bottom: calc(100% + 10px);
	min-width: 190px;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 16px 44px rgba(15, 23, 42, 0.20), 0 2px 8px rgba(15, 23, 42, 0.08);
	padding: 6px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px) scale(0.97);
	transform-origin: bottom right;
	transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.bnt-ls.is-open .bnt-ls__menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
}

.bnt-ls__menu ul {
	list-style: none;
	margin: 0;
	padding: 0;
}
.bnt-ls__menu li { margin: 0; padding: 0; }

.bnt-ls__menu a {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border-radius: 9px;
	color: #0f172a;
	text-decoration: none;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	transition: background 0.12s ease, color 0.12s ease;
}
.bnt-ls__menu a:hover {
	background: #eef2ff;
	color: #1e0d6f;
}
.bnt-ls__menu li.is-active a {
	background: #f1f5ff;
	color: #294df0;
	font-weight: 800;
	cursor: default;
}

.bnt-ls__flag {
	flex: 0 0 auto;
	width: 16px;
	height: 11px;
	border-radius: 2px;
	object-fit: cover;
	box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.10);
}
.bnt-ls__name { flex: 1 1 auto; white-space: nowrap; }
.bnt-ls__check { flex: 0 0 auto; color: #294df0; }

/* "Home fallback" entries get a subtle dim so users know it's not a direct page */
.bnt-ls__menu a[data-fallback="1"] .bnt-ls__name {
	opacity: 0.72;
	font-style: italic;
}

/* Hindi / CJK label rendering safety */
.bnt-ls__menu a[lang="hi"] .bnt-ls__name { font-family: "Noto Sans Devanagari", sans-serif; }

/* Avoid colliding with the BetterDocs "Instant Answers" launcher (a 48x48 floating
   button pinned bottom-right). When it's present, stack the switcher just above it so
   the two widgets don't overlap. Pages without the launcher keep the default position. */
body:has(.betterdocs-ia-launcher-wrapper) #bnt-lang-switcher.bnt-ls {
	bottom: 80px;
}

/* Mobile tweaks */
@media (max-width: 640px) {
	#bnt-lang-switcher.bnt-ls {
		right: 14px;
		bottom: 14px;
	}
	body:has(.betterdocs-ia-launcher-wrapper) #bnt-lang-switcher.bnt-ls {
		bottom: 72px;
	}
	.bnt-ls__toggle {
		padding: 11px 14px;
	}
	.bnt-ls__menu {
		min-width: 170px;
	}
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
	.bnt-ls__toggle,
	.bnt-ls__menu,
	.bnt-ls__caret { transition: none; }
}

/* RTL UI safety (switch to bottom-left) */
html[dir="rtl"] #bnt-lang-switcher.bnt-ls {
	right: auto;
	left: 20px;
}
html[dir="rtl"] .bnt-ls__menu {
	right: auto;
	left: 0;
	transform-origin: bottom left;
}
