/**
 * TWC language switcher — select-style dropdown (frontend + admin preview).
 */

.twc-language-switcher {
	position: relative;
	display: inline-block;
	max-width: 100%;
	font-size: 0.9375rem;
	line-height: 1.4;
	color: #3c434a;
}

.twc-language-switcher__toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	width: 100%;
	min-width: 11rem;
	max-width: 18rem;
	margin: 0;
	padding: 0.5rem 0.75rem;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	box-shadow: none;
	cursor: pointer;
	font: inherit;
	color: inherit;
	text-align: left;
}

.twc-language-switcher__toggle:hover,
.twc-language-switcher__toggle:focus {
	border-color: #8c8f94;
	outline: none;
}

.twc-language-switcher__toggle:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 1px;
}

.twc-language-switcher__toggle-label {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	flex: 1 1 auto;
	min-width: 0;
}

.twc-language-switcher__chevron {
	flex: 0 0 auto;
	width: 0.55rem;
	height: 0.55rem;
	margin-left: 0.25rem;
	border-right: 2px solid #646970;
	border-bottom: 2px solid #646970;
	transform: rotate(45deg);
	transition: transform 0.15s ease;
}

.twc-language-switcher.is-open .twc-language-switcher__chevron {
	transform: rotate(-135deg);
	margin-top: 0.25rem;
}

.twc-language-switcher__list {
	position: absolute;
	z-index: 100;
	top: calc(100% + 0.25rem);
	left: 0;
	right: 0;
	min-width: 100%;
	margin: 0;
	padding: 0.35rem 0;
	list-style: none;
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.twc-language-switcher__list[hidden] {
	display: none;
}

.twc-language-switcher__item {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	width: 100%;
	padding: 0.45rem 0.75rem;
	box-sizing: border-box;
	text-decoration: none !important;
	color: inherit;
	background: transparent;
	border: 0;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

a.twc-language-switcher__item:link,
a.twc-language-switcher__item:visited,
a.twc-language-switcher__item:hover,
a.twc-language-switcher__item:focus,
a.twc-language-switcher__item:active {
	text-decoration: none !important;
	color: inherit;
	background: #f0f0f1;
	outline: none;
}

a.twc-language-switcher__item:link,
a.twc-language-switcher__item:visited {
	background: transparent;
}

a.twc-language-switcher__item:hover,
a.twc-language-switcher__item:focus {
	background: #f0f0f1;
}

.twc-language-switcher__item.is-current {
	font-weight: 600;
}

.twc-language-switcher__flag {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	font-style: normal;
	line-height: 1;
	font-size: 1.1em;
}

.twc-language-switcher__flag-img,
.twc-i18n-lang-list__flag .twc-language-switcher__flag-img {
	display: block;
	width: 1.5rem;
	height: 1rem;
	object-fit: cover;
	border-radius: 2px;
	border: 1px solid rgba(0, 0, 0, 0.15);
	box-sizing: content-box;
	background: #fff;
}

.twc-i18n-lang-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
	gap: 0.35rem 0.75rem;
	max-height: 18rem;
	overflow: auto;
	padding: 0.65rem 0.75rem;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	background: #fff;
}

.twc-i18n-lang-list__option {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	margin: 0;
	padding: 0.2rem 0.15rem;
	cursor: pointer;
	font-size: 0.875rem;
	line-height: 1.3;
}

.twc-i18n-lang-list__option input {
	margin: 0;
	flex: 0 0 auto;
}

.twc-i18n-lang-list__flag {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	min-width: 1.5rem;
}

.twc-i18n-lang-list__flag .twc-language-switcher__flag-emoji {
	font-size: 1.15rem;
	line-height: 1;
}

.twc-i18n-lang-list__name {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.twc-i18n-lang-list--default {
	max-height: 12rem;
}

.twc-language-switcher__name {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Admin / Wizard aurrebista: dropdown bera (itxita; klik → ireki gora, orri amaieran ez mozteko) */
.twc-language-switcher--preview {
	display: inline-block;
	max-width: 14rem;
	z-index: 20;
}

.twc-language-switcher--preview .twc-language-switcher__list {
	top: auto;
	bottom: calc(100% + 0.25rem);
	box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.12);
}

.twc-language-switcher--preview.is-open .twc-language-switcher__chevron {
	transform: rotate(45deg);
	margin-top: 0;
}

.twc-language-switcher--preview .twc-language-switcher__item {
	cursor: default;
}

.twc-language-switcher.is-dropup .twc-language-switcher__list {
	top: auto;
	bottom: calc(100% + 0.25rem);
	box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.12);
}

.twc-language-switcher.is-dropup.is-open .twc-language-switcher__chevron {
	transform: rotate(45deg);
	margin-top: 0;
}

.twc-i18n-help {
	margin-top: 1.5rem;
	padding-top: 1rem;
	border-top: 1px solid #f0f0f1;
}

.twc-i18n-help__code {
	display: inline-block;
	padding: 0.35rem 0.6rem;
	background: #f6f7f7;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	font-size: 0.875rem;
}

.twc-i18n-languages {
	min-height: 14rem;
	width: 100%;
	max-width: 28rem;
}

@media (max-width: 600px) {
	.twc-language-switcher {
		font-size: 0.875rem;
		display: block;
		width: 100%;
	}

	.twc-language-switcher__toggle {
		max-width: none;
	}

	.twc-i18n-languages {
		max-width: 100%;
	}
}
