/* ========================================================================== 
   Toy Max — English / Arabic language switcher
   ========================================================================== */

.tmx-lang-source {
	display: none !important;
}

.tmx-lang-desktop-host,
.tmx-lang-switcher {
	position: relative;
}

.tmx-lang-desktop-host {
	display: inline-flex;
	align-items: center;
	margin-inline-start: 10px;
}

.tmx-lang-trigger {
	display: inline-flex;
	height: 28px;
	align-items: center;
	gap: 6px;
	padding: 0 10px;
	border: 1px solid rgba(255, 255, 255, .42);
	border-radius: 999px;
	background: rgba(255, 255, 255, .13);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
	color: #fff;
	cursor: pointer;
	font: 800 11px/1 Poppins, Arial, sans-serif;
	letter-spacing: .04em;
	transition: background-color .22s ease, border-color .22s ease, transform .22s ease;
}

.tmx-lang-trigger:is(:hover, :focus-visible),
.tmx-lang-switcher.is-open .tmx-lang-trigger {
	border-color: #ffd324;
	background: rgba(255, 255, 255, .22);
	color: #fff;
	outline: none;
	transform: translateY(-1px);
}

.tmx-lang-trigger:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.tmx-lang-globe,
.tmx-lang-caret {
	flex: none;
}

.tmx-lang-caret {
	transition: transform .22s ease;
}

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

.tmx-lang-dropdown {
	position: absolute;
	top: calc(100% + 8px);
	inset-inline-end: 0;
	z-index: 10020;
	display: grid;
	width: 164px;
	gap: 3px;
	padding: 7px;
	border: 1px solid rgba(11, 45, 111, .1);
	border-radius: 15px;
	background:
		linear-gradient(90deg, #ffd324 0 33.33%, #5ccdf4 33.33% 66.66%, #f33a53 66.66% 100%) top / 100% 4px no-repeat,
		#fff;
	box-shadow: 0 18px 38px rgba(11, 45, 111, .18), 0 4px 12px rgba(11, 45, 111, .08);
	opacity: 0;
	pointer-events: none;
	transform: translateY(-6px) scale(.97);
	transform-origin: top right;
	visibility: hidden;
	transition: opacity .22s ease, transform .25s cubic-bezier(.22, 1, .36, 1), visibility .22s;
}

.tmx-lang-switcher.is-open .tmx-lang-dropdown {
	opacity: 1;
	pointer-events: auto;
	transform: translateY(0) scale(1);
	visibility: visible;
}

@media (min-width: 1025px) and (hover: hover) {
	.tmx-lang-switcher:hover .tmx-lang-dropdown {
		opacity: 1;
		pointer-events: auto;
		transform: translateY(0) scale(1);
		visibility: visible;
	}
}

.tmx-lang-option {
	display: grid;
	grid-template-columns: 24px 1fr 18px;
	min-height: 42px;
	align-items: center;
	gap: 9px;
	padding: 7px 9px;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: #0b2d6f;
	cursor: pointer;
	font: 700 12px/1.2 Poppins, Arial, sans-serif;
	text-align: start;
	transition: background-color .18s ease, transform .18s ease;
}

.tmx-lang-option:is(:hover, :focus-visible) {
	background: #f2f8ff;
	outline: none;
	transform: translateX(2px);
}

.tmx-lang-option.is-active {
	background: #fff7cf;
	color: #082b63;
}

.tmx-lang-flag {
	display: inline-flex;
	width: 24px;
	height: 24px;
	overflow: hidden;
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 0 0 1px rgba(11, 45, 111, .12), 0 3px 8px rgba(11, 45, 111, .1);
}

.tmx-lang-flag-svg {
	display: block;
	width: 100%;
	height: 100%;
}

.tmx-lang-check {
	display: grid;
	width: 18px;
	height: 18px;
	place-items: center;
	border-radius: 50%;
	background: #25b76b;
	color: #fff;
	font-size: 10px;
	opacity: 0;
	transform: scale(.6);
	transition: opacity .18s ease, transform .18s ease;
}

.tmx-lang-option.is-active .tmx-lang-check {
	opacity: 1;
	transform: scale(1);
}

.tmx-lang-mobile-host {
	display: none;
}

/* Dynamic Arabic/RTL safeguards required by WoodMart's stretched sections. */
html[dir="rtl"] body,
html.tmx-lang-ar body {
	direction: rtl;
}

/* Swap the actual mark while preserving WoodMart's native desktop/mobile widths. */
html[dir="rtl"] .site-logo .wd-logo > img,
html.tmx-lang-ar .site-logo .wd-logo > img,
html[dir="rtl"] .tmx-brand-logo,
html.tmx-lang-ar .tmx-brand-logo {
	content: url("https://toymaxqa.com/wp-content/uploads/2026/11/toymax-logo-2026-ar-header.webp");
	opacity: 1 !important;
}

@media (max-width: 1024px) {
	html[dir="rtl"] .mobile-nav .wd-heading::before,
	html.tmx-lang-ar .mobile-nav .wd-heading::before {
		background-image: url("https://toymaxqa.com/wp-content/uploads/2026/11/toymax-logo-2026-ar-header.webp");
		background-position: right center;
	}
}

html[dir="rtl"] [class*="wd-section-stretch"],
html.tmx-lang-ar [class*="wd-section-stretch"] {
	right: calc(50% - 50vw + var(--wd-scroll-w, 0px) / 2 + var(--wd-sticky-nav-w, 0px) / 2) !important;
	left: auto !important;
	margin-inline: 0 !important;
}

html[dir="rtl"] .whb-general-header .wd-header-cart .wd-tools-inner .wd-tools-icon,
html.tmx-lang-ar .whb-general-header .wd-header-cart .wd-tools-inner .wd-tools-icon {
	position: relative !important;
}

html[dir="rtl"] .whb-general-header .wd-header-cart .wd-tools-icon .wd-cart-number,
html.tmx-lang-ar .whb-general-header .wd-header-cart .wd-tools-icon .wd-cart-number {
	right: auto !important;
	left: -7px !important;
}

html[dir="rtl"] .tmx-lang-dropdown,
html.tmx-lang-ar .tmx-lang-dropdown {
	right: auto;
	left: 0;
	transform-origin: top left;
}

@media (max-width: 1024px) {
	.tmx-lang-desktop-host {
		display: none !important;
	}

	.mobile-nav > .tmx-lang-mobile-host {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 10px;
		margin: 10px 14px 4px;
		padding: 8px 8px 8px 13px;
		border: 1px solid rgba(11, 45, 111, .1);
		border-radius: 16px;
		background: linear-gradient(135deg, #fff8d8 0%, #eef8ff 100%);
		box-shadow: 0 7px 18px rgba(11, 45, 111, .07);
	}

	.tmx-lang-mobile-label {
		color: #0b2d6f;
		font: 800 11px/1.2 Poppins, Arial, sans-serif;
		white-space: nowrap;
	}

	.tmx-lang-mobile-host .tmx-lang-trigger {
		display: none;
	}

	.tmx-lang-mobile-host .tmx-lang-dropdown {
		position: static;
		display: flex;
		width: auto;
		gap: 4px;
		padding: 0;
		border: 0;
		background: transparent;
		box-shadow: none;
		opacity: 1;
		pointer-events: auto;
		transform: none;
		visibility: visible;
	}

	.tmx-lang-mobile-host .tmx-lang-option {
		display: flex;
		min-width: 58px;
		min-height: 38px;
		justify-content: center;
		gap: 6px;
		padding: 5px 8px;
		border: 1px solid rgba(11, 45, 111, .08);
		background: #fff;
		box-shadow: 0 3px 8px rgba(11, 45, 111, .06);
	}

	.tmx-lang-mobile-host .tmx-lang-option.is-active {
		border-color: #ffd324;
		background: #ffd324;
		box-shadow: inset 0 -3px 0 #dca900;
	}

	.tmx-lang-mobile-host .tmx-lang-flag {
		width: 22px;
		height: 22px;
	}

	.tmx-lang-mobile-host .tmx-lang-name,
	.tmx-lang-mobile-host .tmx-lang-check {
		display: none;
	}
}

@media (max-width: 374px) {
	.mobile-nav > .tmx-lang-mobile-host {
		margin-inline: 10px;
		padding-inline-start: 10px;
	}

	.tmx-lang-mobile-label {
		font-size: 10px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tmx-lang-trigger,
	.tmx-lang-caret,
	.tmx-lang-dropdown,
	.tmx-lang-option,
	.tmx-lang-check {
		transition: none !important;
	}
}
