/* ---- Button that opens the menu ---- */

.vietmap-lang-switch {
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
	font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
	line-height: 1;
	white-space: nowrap;
	user-select: none;
	transition: opacity .2s;
}

.vietmap-lang-switch__toggle {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	margin: 0;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	transition: background-color .15s, opacity .15s;
}

.vietmap-lang-switch__icon {
	display: block;
	opacity: .85;
}

.vietmap-lang-switch__globe {
	display: inline-flex;
	flex: none;
}

/* Flags are 4:3 (flag-icons); a thin inner line keeps white flags visible on white. */
.vietmap-lang-switch__flag {
	display: block;
	flex: none;
	width: 16px;
	height: 12px;
	border-radius: 2px;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, .12);
	object-fit: cover;
}

.vietmap-lang-switch__caret {
	flex: none;
	transition: transform .15s;
}

.vietmap-lang-switch--open .vietmap-lang-switch__caret {
	transform: rotate(180deg);
}

.vietmap-lang-switch--busy {
	opacity: .6;
	pointer-events: none;
}

/* Left of "© YYYY Bitrix24": follows the footer text color, so it fits light and dark themes. */
.vietmap-lang-switch--footer {
	margin: 0 10px 0 0;
	font-size: 11px;
}

.vietmap-lang-switch--footer .vietmap-lang-switch__toggle {
	padding: 3px 8px;
	border: 1px solid currentColor;
	border-radius: 11px;
	opacity: .8;
}

.vietmap-lang-switch--footer .vietmap-lang-switch__toggle:hover,
.vietmap-lang-switch--footer .vietmap-lang-switch__toggle:focus-visible,
.vietmap-lang-switch--footer.vietmap-lang-switch--open .vietmap-lang-switch__toggle {
	opacity: 1;
	outline: none;
}

/* Floating button: used when chosen in the settings, or when no footer copyright is found. */
.vietmap-lang-switch--floating {
	position: fixed;
	/* Under Bitrix24 popups and side panels (sliders). */
	z-index: 900;
	font-size: 12px;
}

.vietmap-lang-switch--floating .vietmap-lang-switch__toggle {
	padding: 8px 12px;
	border-radius: 18px;
	background: rgba(255, 255, 255, .96);
	box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
	color: #525c69;
}

.vietmap-lang-switch--floating .vietmap-lang-switch__toggle:hover,
.vietmap-lang-switch--floating .vietmap-lang-switch__toggle:focus-visible {
	color: #2067b0;
	outline: none;
}

/* The right edge is kept free for the Bitrix24 messenger bar. */
.vietmap-lang-switch--bottom-right {
	right: 76px;
	bottom: 16px;
}

.vietmap-lang-switch--bottom-left {
	left: 16px;
	bottom: 16px;
}

.vietmap-lang-switch--top-right {
	right: 76px;
	top: 12px;
}

/* ---- Menu (in <body>, positioned by JS) ---- */

.vietmap-lang-menu {
	position: fixed;
	/* Above the footer and the floating button. */
	z-index: 1100;
	box-sizing: border-box;
	min-width: 180px;
	max-height: calc(100vh - 12px);
	overflow-y: auto;
	padding: 6px 0;
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 6px 24px rgba(0, 0, 0, .18), 0 0 0 1px rgba(0, 0, 0, .04);
	font: 13px/1.2 "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
	animation: vietmap-lang-menu-in .12s ease-out;
}

.vietmap-lang-menu[hidden] {
	display: none;
}

.vietmap-lang-menu__item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	padding: 8px 14px 8px 30px;
	border: 0;
	background: transparent;
	color: #333;
	font: inherit;
	text-align: left;
	cursor: pointer;
	position: relative;
}

.vietmap-lang-menu__item:hover,
.vietmap-lang-menu__item:focus-visible,
.vietmap-lang-menu__item:focus {
	background: #f1f4f6;
	outline: none;
}

.vietmap-lang-menu__item-main {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.vietmap-lang-menu__item .vietmap-lang-switch__flag {
	width: 20px;
	height: 15px;
}

.vietmap-lang-menu__item .vietmap-lang-switch__globe {
	justify-content: center;
	width: 20px;
	color: #a8adb4;
}

.vietmap-lang-menu__item-code {
	color: #a8adb4;
	font-size: 11px;
	font-weight: 600;
}

.vietmap-lang-menu__item--active {
	color: #2067b0;
	font-weight: 600;
}

/* Check mark in front of the current language. */
.vietmap-lang-menu__item--active::before {
	content: "";
	position: absolute;
	left: 13px;
	top: 50%;
	width: 5px;
	height: 9px;
	margin-top: -6px;
	border: solid currentColor;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

@keyframes vietmap-lang-menu-in {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

.vietmap-lang-menu--up {
	animation-name: vietmap-lang-menu-in-up;
}

@keyframes vietmap-lang-menu-in-up {
	from {
		opacity: 0;
		transform: translateY(4px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@media print {
	.vietmap-lang-switch,
	.vietmap-lang-menu {
		display: none;
	}
}
