/* Language dropdown — globe + label trigger, outlined tech style */

/* Logo palette: cyan #00b8ff + green #2ea01a (see mobile-nav.css) */
.lang-switcher {
	--lang-globe: #00b8ff;
	position: relative;
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
	z-index: 20;
}

/*
 * Arabic / RTL: desktop nav only (64em+). Unscoped flex on .header__links was
 * overriding .hide-for-mobile { display: none } on small screens and broke the
 * mobile header (desktop links + switcher overlapping logo / hamburger).
 */
@media (min-width: 64em) {
	html[dir="rtl"] .header__links {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		column-gap: clamp(1rem, 2.5vw, 2.25rem);
		row-gap: 0.5rem;
	}

	html[dir="rtl"] .header__links > a {
		order: 1;
		margin-left: 0 !important;
	}

	html[dir="rtl"] .header__links > .lang-switcher {
		order: 2;
		flex-shrink: 0;
	}
}

/* Mobile drawer top bar: close on the right, language on the left (RTL) */
html[dir="rtl"] .header__menu-top .header__menu-close {
	order: 1;
}

html[dir="rtl"] .header__menu-top .lang-switcher {
	order: 2;
}

@supports (color: color-mix(in srgb, white, black)) {
	.lang-switcher {
		--lang-globe: color-mix(in srgb, #00b8ff 58%, #2ea01a 42%);
	}
}

.lang-switcher__btn {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	min-height: 2.25rem;
	padding: 0.35rem 0.65rem 0.35rem 0.5rem;
	margin: 0;
	font-family: inherit;
	font-size: 0.8125rem;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0.02em;
	color: #26233c;
	background: transparent;
	border: 1px solid rgba(38, 35, 60, 0.28);
	border-radius: 8px;
	box-shadow: none;
	cursor: pointer;
	transition:
		background 0.18s ease,
		border-color 0.18s ease,
		color 0.18s ease;
	-webkit-tap-highlight-color: transparent;
}

.lang-switcher__btn:hover {
	background: rgba(38, 35, 60, 0.04);
	border-color: rgba(38, 35, 60, 0.42);
}

.lang-switcher.is-open .lang-switcher__btn {
	background: rgba(0, 184, 255, 0.06);
	border-color: rgba(0, 184, 255, 0.45);
	color: #1a1730;
}

/* Outline globe — brand cyan/green (Noonixo logo) */
.lang-switcher__globe {
	display: block;
	flex-shrink: 0;
	color: var(--lang-globe);
}

.lang-switcher__label {
	max-width: 8rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.lang-switcher__caret {
	flex-shrink: 0;
	width: 12px;
	height: 12px;
	opacity: 0.55;
	transition: transform 0.2s ease;
}

.lang-switcher__caret path {
	stroke-width: 1.5;
}

.lang-switcher.is-open .lang-switcher__caret {
	transform: rotate(180deg);
}

.lang-switcher__list {
	position: absolute;
	top: calc(100% + 4px);
	inset-inline-end: 0;
	min-width: 9.25rem;
	max-width: min(13rem, calc(100vw - 2rem));
	margin: 0;
	padding: 0.2rem;
	list-style: none;
	background: rgba(255, 255, 255, 0.98);
	border: 1px solid rgba(38, 35, 60, 0.18);
	border-radius: 8px;
	box-shadow: 0 6px 20px rgba(38, 35, 60, 0.09);
	z-index: 10001;
}

.lang-switcher__list[hidden] {
	display: none !important;
}

.lang-switcher__list li {
	margin: 0;
	padding: 0;
}

.lang-switcher__item {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	box-sizing: border-box;
	min-height: 2.125rem;
	padding: 0.35rem 0.5rem;
	border-radius: 5px;
	font-size: 0.8125rem;
	font-weight: 600;
	color: #1a1730 !important;
	text-decoration: none !important;
	text-align: center;
	transition: background 0.15s ease;
}

.lang-switcher__item:hover,
.lang-switcher__item:focus-visible {
	background: rgba(0, 184, 255, 0.1);
	outline: none;
}

.lang-switcher__item.is-active {
	background: rgba(0, 184, 255, 0.12);
	cursor: default;
}

/* Mobile drawer: one control, full width next to close */
.header__menu-top .lang-switcher {
	flex: 1;
	min-width: 0;
	max-width: calc(100% - 3.5rem);
	/* below .lang-switcher z-index:20 so it does not sit above the close */
	z-index: 1;
}

.header__menu-top .lang-switcher__btn {
	width: 100%;
	justify-content: space-between;
	box-sizing: border-box;
	min-height: 44px;
	padding: 0.5rem 0.75rem;
}

.header__menu-top .lang-switcher__list {
	inset-inline-start: 0;
	inset-inline-end: 0;
	width: 100%;
	max-width: none;
}

.header__menu-top .lang-switcher__item {
	min-height: 42px;
	padding: 0.45rem 0.6rem;
	font-size: 0.8125rem;
}

.lang-switcher__btn:focus-visible {
	outline: 2px solid rgba(0, 184, 255, 0.75);
	outline-offset: 2px;
}

.lang-switcher__item:focus-visible {
	outline: 2px solid rgba(0, 184, 255, 0.75);
	outline-offset: 0;
}

/* Dark theme */
html[data-theme="dark"] .lang-switcher__btn {
	color: #e8eaf0;
	border-color: rgba(255, 255, 255, 0.22);
	background: rgba(0, 0, 0, 0.15);
}

html[data-theme="dark"] .lang-switcher__btn:hover {
	background: rgba(255, 255, 255, 0.06);
	border-color: rgba(255, 255, 255, 0.32);
}

html[data-theme="dark"] .lang-switcher.is-open .lang-switcher__btn {
	background: rgba(0, 184, 255, 0.12);
	border-color: rgba(0, 184, 255, 0.4);
	color: #f0f4fc;
}

html[data-theme="dark"] .lang-switcher__list {
	background: rgba(26, 24, 42, 0.98);
	border-color: rgba(255, 255, 255, 0.12);
	box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .lang-switcher__item {
	color: #e8eaf0 !important;
}

html[data-theme="dark"] .lang-switcher__item:hover,
html[data-theme="dark"] .lang-switcher__item:focus-visible {
	background: rgba(0, 184, 255, 0.15);
}

html[data-theme="dark"] .lang-switcher__item.is-active {
	background: rgba(0, 184, 255, 0.18);
}

@media (prefers-reduced-motion: reduce) {
	.lang-switcher__caret,
	.lang-switcher__btn,
	.lang-switcher__item {
		transition: none;
	}
}
