/**
 * Effektiv Translate — Language Switcher v1.11
 *
 * Snygg dropdown-design med flaggor och nativa språknamn.
 * Twemoji-fallback för konstiga emoji-renderingar.
 */

/* ============================================================
 * Base container
 * ============================================================ */
.et-switcher {
	font-family: var(--et-switcher-font-family, inherit);
	font-size: var(--et-switcher-font-size, 14px);
	font-weight: var(--et-switcher-font-weight, 500);
	position: relative;
	display: inline-block;
	line-height: 1;
}

/* Position variants — fixed by default */
.et-switcher--bottom-right { position: fixed; bottom: 20px; right: 20px; z-index: var(--et-switcher-z-index, 99998); }
.et-switcher--bottom-left  { position: fixed; bottom: 20px; left: 20px;  z-index: var(--et-switcher-z-index, 99998); }
.et-switcher--top-right    { position: fixed; top: 80px; right: 20px;    z-index: var(--et-switcher-z-index, 99998); }
.et-switcher--top-left     { position: fixed; top: 80px; left: 20px;     z-index: var(--et-switcher-z-index, 99998); }
.et-switcher--right-middle { position: fixed; top: 50%; right: 0; transform: translateY(-50%); z-index: var(--et-switcher-z-index, 99998); }
.et-switcher--left-middle  { position: fixed; top: 50%; left: 0; transform: translateY(-50%); z-index: var(--et-switcher-z-index, 99998); }
.et-switcher--inline       { position: relative; }

/* ============================================================
 * Toggle button (the pill)
 * ============================================================ */
.et-switcher__toggle {
	display: inline-flex;
	align-items: center;
	gap: var(--et-switcher-gap, 8px);
	background: var(--et-switcher-bg, #fff);
	color: var(--et-switcher-text, #111);
	border: var(--et-switcher-border-width, 1px) solid var(--et-switcher-border-color, #ddd);
	border-radius: var(--et-switcher-radius, 999px);
	padding: var(--et-switcher-padding, 8px 14px);
	cursor: pointer;
	font: inherit;
	line-height: 1.2;
	transition: all 0.18s ease;
	box-shadow: var(--et-switcher-shadow, none);
	white-space: nowrap;
}
.et-switcher__toggle:hover {
	background: var(--et-switcher-hover-bg, #f5f5f5);
	color: var(--et-switcher-hover-text, #000);
}
.et-switcher__toggle:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

/* Chevron */
.et-switcher__chevron {
	transition: transform 0.2s ease;
	opacity: 0.7;
}
.et-switcher[aria-expanded="true"] .et-switcher__chevron,
.et-switcher__toggle[aria-expanded="true"] .et-switcher__chevron {
	transform: rotate(180deg);
}

/* ============================================================
 * Flags
 * ============================================================ */
.et-switcher__flag {
	display: inline-flex;
	align-items: center;
	line-height: 1;
}
.et-switcher__flag--emoji {
	font-size: 1.15em;
	/* Twemoji fallback (Windows browsers with no emoji flag support) */
	font-family: "Twemoji Country Flags", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.et-switcher__flag--img {
	width: 20px;
	height: 15px;
	object-fit: cover;
	border-radius: 2px;
	display: inline-block;
	vertical-align: middle;
}

/* ============================================================
 * Dropdown menu
 * ============================================================ */
.et-switcher__menu {
	list-style: none;
	margin: 0;
	padding: 6px;
	position: absolute;
	bottom: calc(100% + 8px);
	right: 0;
	min-width: 180px;
	background: var(--et-popup-bg, #fff);
	color: var(--et-popup-text, #111);
	border-radius: var(--et-popup-radius, 12px);
	box-shadow: var(--et-popup-shadow, 0 6px 24px rgba(0,0,0,0.16));
	opacity: 0;
	visibility: hidden;
	transform: translateY(4px);
	transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
	z-index: 100;
}
/* Top-positioned switchers open menu downwards */
.et-switcher--top-right .et-switcher__menu,
.et-switcher--top-left .et-switcher__menu {
	bottom: auto;
	top: calc(100% + 8px);
	transform: translateY(-4px);
}
.et-switcher--bottom-left .et-switcher__menu,
.et-switcher--top-left .et-switcher__menu,
.et-switcher--left-middle .et-switcher__menu {
	right: auto;
	left: 0;
}
.et-switcher--inline .et-switcher__menu {
	top: calc(100% + 8px);
	bottom: auto;
	transform: translateY(-4px);
}
.et-switcher.is-open .et-switcher__menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.et-switcher__menu li { margin: 0; padding: 0; list-style: none; }

.et-switcher__option {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	color: inherit;
	text-decoration: none;
	border-radius: 8px;
	transition: background 0.12s ease;
	font-size: 14px;
	line-height: 1.3;
}
.et-switcher__option:hover,
.et-switcher__option:focus-visible {
	background: var(--et-switcher-hover-bg, #f5f5f5);
	color: var(--et-switcher-hover-text, #000);
	text-decoration: none;
	outline: none;
}
.et-switcher__option.is-active {
	background: var(--et-switcher-active-bg, #f0f0f0);
	color: var(--et-switcher-active-text, #111);
	font-weight: 600;
}
.et-switcher__option .et-switcher__flag { flex: 0 0 auto; }

/* ============================================================
 * Mobile
 * ============================================================ */
@media (max-width: 600px) {
	.et-switcher--bottom-right,
	.et-switcher--bottom-left,
	.et-switcher--top-right,
	.et-switcher--top-left {
		bottom: 12px;
		right: 12px;
		left: auto;
	}
	.et-switcher--bottom-left,
	.et-switcher--top-left { left: 12px; right: auto; }
	.et-switcher__toggle { padding: 8px 12px; font-size: 13px; }
}

/* ============================================================
 * V1.12: Meny-integration
 * ============================================================
 * När switchern läggs i en WordPress-meny använder den standard
 * .menu-item + .sub-menu-struktur. Temat hanterar då font, färg,
 * hover och sub-menu-dropdown automatiskt.
 * Vi lägger bara till minimal CSS för flagg-storlek och layout.
 */
.et-menu-switcher > a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.et-menu-switcher .sub-menu a {
	display: flex;
	align-items: center;
	gap: 8px;
}
.et-menu-switcher img,
.et-menu-switcher .et-switcher__flag--img {
	width: 20px;
	height: 15px;
	object-fit: cover;
	border-radius: 2px;
	flex: 0 0 auto;
	vertical-align: middle;
}
/* Se till att sub-menu bilder inte kollapsar när tema-CSS sätter img-storlekar */
.et-menu-switcher .sub-menu img {
	max-width: 20px;
}
