/*!
 * Multi-Manual Translator
 * Copyright (c) Optivanse IT. All rights reserved.
 */

/**
 * Language switcher styles. Shared by the floating widget, the shortcode and
 * the sidebar widget. Colours come from CSS variables set inline from settings.
 */

.mt-switcher {
	--mt-bg: #111827;
	--mt-fg: #ffffff;
	--mt-radius: 10px;
	font-size: 14px;
	line-height: 1.4;
	box-sizing: border-box;
}

.mt-switcher *,
.mt-switcher *::before,
.mt-switcher *::after {
	box-sizing: inherit;
}

.mt-flag {
	font-size: 1.05em;
	line-height: 1;
}

/* ---- Inline and list ------------------------------------------------- */

.mt-switcher .mt-items {
	display: flex;
	gap: 6px;
	align-items: center;
	flex-wrap: wrap;
}

.mt-switcher[data-style="list"] .mt-items {
	flex-direction: column;
	align-items: stretch;
	gap: 2px;
}

.mt-switcher .mt-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	border-radius: var( --mt-radius );
	text-decoration: none;
	color: inherit;
	transition: background-color 0.15s ease, opacity 0.15s ease;
}

.mt-switcher .mt-item:hover,
.mt-switcher .mt-item:focus-visible {
	background: rgba( 0, 0, 0, 0.07 );
	text-decoration: none;
}

.mt-switcher .mt-item.is-current {
	font-weight: 600;
	background: rgba( 0, 0, 0, 0.06 );
}

/* ---- Dropdown -------------------------------------------------------- */

.mt-switcher[data-style="dropdown"] {
	position: relative;
	display: inline-block;
}

.mt-switcher .mt-toggle {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 9px 13px;
	border: 0;
	border-radius: var( --mt-radius );
	background: var( --mt-bg );
	color: var( --mt-fg );
	font: inherit;
	cursor: pointer;
	box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.18 );
}

.mt-switcher .mt-toggle:hover {
	filter: brightness( 1.12 );
}

.mt-switcher .mt-caret {
	font-size: 10px;
	opacity: 0.8;
	transition: transform 0.18s ease;
}

.mt-switcher .mt-toggle[aria-expanded="true"] .mt-caret {
	transform: rotate( 180deg );
}

.mt-switcher .mt-menu {
	position: absolute;
	z-index: 99;
	top: calc( 100% + 6px );
	left: 0;
	min-width: 100%;
	margin: 0;
	padding: 5px;
	list-style: none;
	background: #fff;
	border-radius: var( --mt-radius );
	box-shadow: 0 8px 28px rgba( 0, 0, 0, 0.16 );
	opacity: 0;
	visibility: hidden;
	transform: translateY( -6px );
	transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
	white-space: nowrap;
}

.mt-switcher.is-open .mt-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY( 0 );
}

.mt-switcher .mt-menu li {
	margin: 0;
	list-style: none;
}

.mt-switcher .mt-menu a {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	border-radius: calc( var( --mt-radius ) - 3px );
	color: #111827;
	text-decoration: none;
}

.mt-switcher .mt-menu a:hover,
.mt-switcher .mt-menu a:focus-visible {
	background: #f1f5f9;
}

.mt-switcher .mt-menu a.is-current {
	font-weight: 600;
	background: #eef2ff;
}

/* ---- Native select --------------------------------------------------- */

.mt-switcher .mt-select {
	padding: 8px 10px;
	border-radius: var( --mt-radius );
	border: 1px solid rgba( 0, 0, 0, 0.18 );
	background: #fff;
	font: inherit;
	max-width: 100%;
}

/* ---- Floating container ---------------------------------------------- */

.mt-floating {
	position: fixed;
	z-index: 99990;
}

.mt-floating.mt-pos-bottom-right {
	right: 20px;
	bottom: 20px;
}

.mt-floating.mt-pos-bottom-left {
	left: 20px;
	bottom: 20px;
}

.mt-floating.mt-pos-top-right {
	right: 20px;
	top: 20px;
}

.mt-floating.mt-pos-top-left {
	left: 20px;
	top: 20px;
}

/* Menus near the bottom of the screen must open upward. */
.mt-floating.mt-opens-up .mt-menu {
	top: auto;
	bottom: calc( 100% + 6px );
	transform: translateY( 6px );
}

.mt-floating.mt-opens-up .mt-switcher.is-open .mt-menu {
	transform: translateY( 0 );
}

/* Right anchored floats align their menu to the right edge. */
.mt-floating.mt-pos-bottom-right .mt-menu,
.mt-floating.mt-pos-top-right .mt-menu {
	left: auto;
	right: 0;
}

/* The floating list and inline variants need their own surface. */
.mt-floating .mt-switcher[data-style="list"],
.mt-floating .mt-switcher[data-style="inline"] {
	background: var( --mt-bg );
	color: var( --mt-fg );
	padding: 6px;
	border-radius: var( --mt-radius );
	box-shadow: 0 2px 12px rgba( 0, 0, 0, 0.2 );
}

.mt-floating .mt-switcher[data-style="list"] .mt-item:hover,
.mt-floating .mt-switcher[data-style="inline"] .mt-item:hover,
.mt-floating .mt-switcher[data-style="list"] .mt-item.is-current,
.mt-floating .mt-switcher[data-style="inline"] .mt-item.is-current {
	background: rgba( 255, 255, 255, 0.16 );
}

@media screen and ( max-width: 600px ) {
	.mt-floating {
		bottom: 12px;
	}

	.mt-floating.mt-pos-bottom-right,
	.mt-floating.mt-pos-top-right {
		right: 12px;
	}

	.mt-floating.mt-pos-bottom-left,
	.mt-floating.mt-pos-top-left {
		left: 12px;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.mt-switcher .mt-menu,
	.mt-switcher .mt-caret,
	.mt-switcher .mt-item {
		transition: none;
	}
}
