/**
 * Frontend (and shared) styles for the Valu Google Translate block.
 */

.valu-gtranslate {
	position: relative;
	display: inline-block;
	/* Default icon colour, overridden inline from the block's iconColor. */
	--valu-gt-color: #012169;
}

/**
 * Machine-translation notice: a low, full-width ribbon injected at the very top
 * of the page (above the header) while a translation is active. Background is
 * set inline from the icon colour; text is white.
 */
.valu-gtranslate-notice {
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 100%;
	min-height: 34px;
	margin: 0;
	padding: 5px 16px;
	color: #fff;
	font-size: 14px;
	line-height: 1.25;
	text-align: center;
}

/* Cookie-consent box shown in place of the menu when consent is missing. */
.valu-gtranslate__consent {
	position: absolute;
	z-index: 1000;
	top: calc(100% + 6px);
	left: 0;
	box-sizing: border-box;
	width: 280px;
	max-width: min(92vw, 320px);
	margin: 0;
	padding: 12px;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 6px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);
}

.valu-gtranslate.menu-align-right .valu-gtranslate__consent {
	left: auto;
	right: 0;
}

.valu-gtranslate__consent[hidden] {
	display: none;
}

.valu-gtranslate__consent-text {
	margin: 0 0 10px;
	color: #1a1a1a;
	font-size: 14px;
	line-height: 1.35;
}

.valu-gtranslate__consent-btn {
	display: inline-block;
	margin: 0;
	padding: 0.5em 0.9em;
	color: #fff;
	background: var(--valu-gt-color);
	border: 0;
	border-radius: 4px;
	font-size: 14px;
	line-height: 1.2;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.valu-gtranslate__consent-btn:hover {
	opacity: 0.92;
}

.valu-gtranslate__consent-btn:focus-visible {
	outline: 2px solid var(--valu-gt-color);
	outline-offset: 2px;
}

/* Trigger: icon-only button, transparent so it sits nicely in a header. */
.valu-gtranslate__toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0.35em;
	background: transparent;
	border: 0;
	border-radius: 4px;
	color: var(--valu-gt-color);
	line-height: 0;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.valu-gtranslate__toggle:hover,
.valu-gtranslate__toggle:focus-visible {
	background: rgba(1, 33, 105, 0.08);
}

.valu-gtranslate__toggle:focus-visible {
	outline: 2px solid var(--valu-gt-color);
	outline-offset: 2px;
}

.valu-gtranslate__icon {
	display: block;
	width: 24px;
	height: 24px;
	fill: currentColor;
}

/* Dropdown menu. */
.valu-gtranslate__menu {
	position: absolute;
	z-index: 1000;
	top: calc(100% + 6px);
	left: 0;
	/* The menu is the scroll container, so its width tracks the widest item.
	   Widths are viewport-aware so the dropdown never exceeds the screen. */
	min-width: min(200px, calc(100vw - 16px));
	max-width: min(92vw, 360px);
	max-height: min(70vh, 420px);
	overflow-x: hidden;
	overflow-y: auto;
	margin: 0;
	padding: 0;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 6px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);
}

.valu-gtranslate.menu-align-right .valu-gtranslate__menu {
	left: auto;
	right: 0;
}

.valu-gtranslate__menu[hidden] {
	display: none;
}

/* Search field, pinned to the top while the list scrolls (all-languages mode). */
.valu-gtranslate__search {
	position: sticky;
	top: 0;
	z-index: 1;
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	/* Extra left padding makes room for the search icon. */
	padding: 0.55em 0.7em 0.55em 2.2em;
	font-size: 0.9em;
	color: #1a1a1a;
	/* Search icon as a self-contained inline SVG (no external request). */
	background-color: #fff;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: 0.65em center;
	background-size: 16px 16px;
	border: 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.12);
	/* Match the dropdown's rounded top corners so the focus ring follows them. */
	border-radius: 5px 5px 0 0;
}

.valu-gtranslate__search:focus-visible {
	outline: 2px solid var(--valu-gt-color);
	outline-offset: -2px;
}

.valu-gtranslate__list {
	margin: 0;
	padding: 4px;
	list-style: none;
}

.valu-gtranslate__list li {
	margin: 0;
	padding: 0;
}

.valu-gtranslate__list li[hidden] {
	display: none;
}

.valu-gtranslate__item {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0.5em 0.75em;
	background: transparent;
	border: 0;
	border-radius: 4px;
	color: #1a1a1a;
	font-size: 0.95em;
	line-height: 1.3;
	text-align: left;
	white-space: nowrap;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.valu-gtranslate.menu-align-right .valu-gtranslate__item {
	text-align: right;
}

.valu-gtranslate__item:hover {
	background: rgba(1, 33, 105, 0.08);
}

.valu-gtranslate__item:focus-visible {
	background: rgba(1, 33, 105, 0.08);
	outline: 2px solid var(--valu-gt-color);
	outline-offset: -2px;
}

.valu-gtranslate__item.is-active {
	font-weight: 700;
	color: var(--valu-gt-color);
}

.valu-gtranslate__item.is-restore {
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
	margin-bottom: 4px;
	padding-bottom: 0.6em;
}

/* Screen-reader-only helper (in case the theme doesn't define it). */
.valu-gtranslate .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/**
 * Hide Google Translate's own chrome (top banner, tooltips, icon) so only our
 * custom UI shows. These selectors are stable across Google's widget versions.
 */
.goog-te-banner-frame.skiptranslate,
.goog-te-gadget-icon,
#goog-gt-tt,
.goog-te-balloon-frame,
div#goog-gt- {
	display: none !important;
}

/* The loading spinner Google parks in the top-left corner while translating.
   Newer widget versions use obfuscated VIpgJd-* class names for it. */
.goog-te-spinner-pos,
.goog-te-spinner,
.goog-te-spinner-animation,
.VIpgJd-ZVi9od-aZ2wEe-wOHMyf,
.VIpgJd-ZVi9od-aZ2wEe-OiiCO {
	display: none !important;
}

iframe.skiptranslate,
.skiptranslate iframe {
	visibility: hidden !important;
	display: none !important;
}

#google_translate_element {
	display: none !important;
}

.goog-text-highlight {
	background: none !important;
	box-shadow: none !important;
}

/* Google pushes the body down for its banner; keep the layout intact. */
body {
	top: 0 !important;
	position: static !important;
}
