/* EOND Translator widget — flag-icon edition */

.eond-translator {
	display: inline-flex !important;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	line-height: 1;
	position: relative;
	visibility: visible !important;
	opacity: 1 !important;
}

.eond-translator[hidden] {
	display: none !important;
}

/* Menu-item wrap mode: blend into theme nav items */
li.eond-translator-item {
	list-style: none !important;
	padding: 0 12px;
	display: inline-flex !important;
	align-items: center;
	position: relative;
}

/* Fixed presets */
.eond-translator.is-fixed {
	position: fixed;
}

.eond-translator.is-fixed.pos-top-right {
	top: var(--eond-top, 33px);
	right: var(--eond-right, 16px);
}

.eond-translator.is-fixed.pos-top-left {
	top: var(--eond-top, 33px);
	left: var(--eond-left, 16px);
}

.eond-translator.is-fixed.pos-bottom-right {
	bottom: var(--eond-bottom, 16px);
	right: var(--eond-right, 16px);
}

.eond-translator.is-fixed.pos-bottom-left {
	bottom: var(--eond-bottom, 16px);
	left: var(--eond-left, 16px);
}

/* Globe icon — 배경 자동 감지로 다크/라이트 모드 자동 적용
   .eond-translator--on-dark  : 어두운 헤더 위 → 흰 글로브
   .eond-translator--on-light : 밝은 헤더 위 → 검은 글로브
   클래스 없을 때 (감지 실패 fallback) → 자기완결형 흰 원 + 검은 글로브 */
.eond-translator__icon {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	margin: 0;
	border-radius: 50%;
	cursor: pointer;
	user-select: none;
	transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
	-webkit-tap-highlight-color: transparent;

	/* Fallback (감지 클래스가 아직 없을 때): 흰 원 + 검은 글로브 자기완결형 */
	background: #fff;
	color: #111;
	box-shadow:
		0 1px 3px rgba(0, 0, 0, 0.18),
		0 0 0 1px rgba(0, 0, 0, 0.08);
}

.eond-translator__icon:active {
	transform: scale(0.96);
}

.eond-translator__icon svg {
	width: 20px;
	height: 20px;
	vertical-align: middle;
	pointer-events: none;
	color: currentColor;
	fill: currentColor;
}

/* 라이트 헤더 (밝은 배경) — 검은 글로브, 배경은 헤더와 자연스럽게 어울리도록 투명 */
.eond-translator--on-light .eond-translator__icon {
	background: transparent;
	color: #111;
	box-shadow: none;
}
.eond-translator--on-light .eond-translator__icon:hover,
.eond-translator--on-light .eond-translator__icon:focus-visible {
	background-color: rgba(0, 0, 0, 0.06);
	box-shadow: none;
	outline: none;
}
.eond-translator--on-light .eond-translator__icon svg {
	filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.12));
}

/* 다크 헤더 (어두운 배경/투명 헤더) — 흰 글로브, 배경 투명 */
.eond-translator--on-dark .eond-translator__icon {
	background: transparent;
	color: #fff;
	box-shadow: none;
}
.eond-translator--on-dark .eond-translator__icon:hover,
.eond-translator--on-dark .eond-translator__icon:focus-visible {
	background-color: rgba(255, 255, 255, 0.12);
	box-shadow: none;
	outline: none;
}
.eond-translator--on-dark .eond-translator__icon svg {
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

/* fallback 모드 (감지 클래스 둘 다 없을 때) hover */
.eond-translator:not(.eond-translator--on-dark):not(.eond-translator--on-light) .eond-translator__icon:hover,
.eond-translator:not(.eond-translator--on-dark):not(.eond-translator--on-light) .eond-translator__icon:focus-visible {
	background-color: #f3f4f6;
	box-shadow:
		0 2px 6px rgba(0, 0, 0, 0.22),
		0 0 0 1px rgba(0, 0, 0, 0.1);
	outline: none;
}

/* Hide Google's select visually but keep it in DOM (translation engine) */
#eond-translator #google_language_translator {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
	pointer-events: none !important;
	opacity: 0 !important;
}

#eond-translator .goog-te-combo,
#eond-translator .goog-te-gadget {
	position: absolute !important;
	left: -9999px !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

/* Suppress Google's translate banner globally */
.goog-te-banner-frame.skiptranslate {
	display: none !important;
}

body {
	top: 0 !important;
}

/* Flag-icon panel (popover) */
.eond-translator__panel {
	position: absolute;
	top: 100%;
	right: 0;
	margin-top: 8px;
	min-width: 160px;
	max-width: calc(100vw - 24px);
	background: #fff;
	color: #1f2937;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 10px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
	padding: 6px;
	z-index: 99999;
	font-size: 13px;
	line-height: 1.4;
}

/* 부모 overflow:hidden 회피용 — JS가 패널을 body로 옮긴 상태.
   좌표는 JS가 inline style 로 직접 지정한다. */
.eond-translator__panel--detached {
	position: fixed !important;
	top: auto;
	right: auto;
	margin: 0;
	z-index: 100000 !important;
}

.eond-translator__panel[hidden] {
	display: none !important;
}

/* Panel anchored to the left side when widget sits at left edge */
.eond-translator.is-fixed.pos-top-left .eond-translator__panel,
.eond-translator.is-fixed.pos-bottom-left .eond-translator__panel {
	right: auto;
	left: 0;
}

/* When widget is at bottom of viewport, open upward */
.eond-translator.is-fixed.pos-bottom-right .eond-translator__panel,
.eond-translator.is-fixed.pos-bottom-left .eond-translator__panel {
	top: auto;
	bottom: 100%;
	margin-top: 0;
	margin-bottom: 8px;
}

.eond-translator__langs {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
}

.eond-translator__langs li {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
}

.eond-translator__lang {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 8px 10px;
	background: transparent;
	border: 0;
	border-radius: 6px;
	font-size: 13px;
	font-family: inherit;
	color: #1f2937;
	cursor: pointer;
	text-align: left;
	text-decoration: none;
	transition: background-color 0.12s ease;
}

.eond-translator__lang:hover,
.eond-translator__lang:focus-visible {
	background-color: rgba(0, 0, 0, 0.06);
	outline: none;
}

.eond-translator__lang.is-active {
	background-color: rgba(0, 0, 0, 0.08);
	font-weight: 600;
}

.eond-translator__flag {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	font-size: 18px;
	line-height: 1;
	width: 22px;
	height: 16px;
	overflow: hidden;
	border-radius: 2px;
}

.eond-translator__flag img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.eond-translator__name {
	flex: 1 1 auto;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.eond-translator__name small {
	color: #6b7280;
	font-weight: normal;
	margin-left: 4px;
}

/* 모바일 옵션: 국기만 표시 (언어명 텍스트 숨김) */
.eond-translator--no-labels .eond-translator__name {
	display: none;
}

.eond-translator--no-labels .eond-translator__lang {
	justify-content: center;
	padding: 8px;
}

.eond-translator--no-labels .eond-translator__panel {
	min-width: 0;
}

/* Notranslate visual harmonization */
.notranslate {
	border-radius: 5px;
}

/* Mobile tweaks — keep the trigger compact and the panel within viewport.
   Position offset 자체는 JS가 viewport width에 따라 --eond-top/right/bottom/left 변수를
   데스크탑/모바일 값으로 갈아끼우므로 여기서는 시각적 보정만 한다. */
@media (max-width: 782px) {
	.eond-translator {
		font-size: 14px;
	}

	.eond-translator__icon {
		width: 36px;
		height: 36px;
	}

	.eond-translator__icon svg {
		width: 22px;
		height: 22px;
	}

	.eond-translator__panel {
		min-width: 180px;
		font-size: 14px;
	}

	.eond-translator__lang {
		padding: 10px 12px;
	}
}
