/* HentaiAPK language switcher + flag icons */

.flag-icon {
	background-size: contain;
	background-position: 50%;
	background-repeat: no-repeat;
	position: relative;
	display: inline-block;
	width: 1.33333333em;
	line-height: 1em;
}

.flag-icon:before {
	content: '\00a0';
}

.flag-icon-us { background-image: url(../flags/4x3/us.svg); }
.flag-icon-jp { background-image: url(../flags/4x3/jp.svg); }
.flag-icon-es { background-image: url(../flags/4x3/es.svg); }
.flag-icon-br { background-image: url(../flags/4x3/br.svg); }
.flag-icon-ru { background-image: url(../flags/4x3/ru.svg); }
.flag-icon-kr { background-image: url(../flags/4x3/kr.svg); }

.hapk-header-tools {
	display: flex;
	align-items: center;
	gap: 2px;
	flex-shrink: 0;
	margin-left: 8px;
}

.hapk-language-switcher {
	position: relative;
	display: flex;
	align-items: center;
}

.hapk-language-btn {
	width: 40px;
	height: 40px;
	border: none;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	line-height: 1;
	transition: background 0.15s, color 0.15s;
}

.hapk-language-btn:hover,
.hapk-language-btn:focus-visible {
	background: rgba(27, 188, 155, 0.15);
	color: #1bbc9b;
	outline: none;
}

.hapk-language-icon-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.hapk-language-icon-wrap .fa-globe {
	font-size: 18px;
}

.hapk-language-current-flag {
	position: absolute;
	right: -6px;
	bottom: -4px;
	width: 12px;
	height: 9px;
	border-radius: 1px;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.hapk-language-dropdown {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	z-index: 1200;
	min-width: 200px;
	background: #1d222d;
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 8px;
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.hapk-language-dropdown.active,
.hapk-language-dropdown:not([hidden]) {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.hapk-language-dropdown[hidden] {
	display: none !important;
}

.language-dropdown-menu {
	display: flex;
	flex-direction: column;
	padding: 6px;
}

.language-option,
button.language-option {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 9px 12px;
	border: none;
	border-radius: 6px;
	background: none;
	color: #d8d8d8;
	font-size: 13px;
	font-weight: 600;
	text-align: left;
	cursor: pointer;
	box-sizing: border-box;
}

.language-option .flag-icon {
	width: 20px;
	height: 15px;
	border-radius: 2px;
	flex-shrink: 0;
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.language-option:hover,
button.language-option:hover {
	background: rgba(27, 188, 155, 0.12);
	color: #fff;
}

.language-option.is-active,
button.language-option.is-active {
	background: rgba(27, 188, 155, 0.18);
	color: #fff;
	box-shadow: inset 3px 0 0 #1bbc9b;
}

@media (min-width: 901px) {
	.hapk-header-tools {
		order: 2;
		margin-left: 6px;
	}

	#header nav {
		order: 1;
	}
}

@media (max-width: 900px) {
	#header .container {
		grid-template-columns: 48px 1fr auto !important;
	}

	.hapk-header-tools {
		grid-column: 3;
		grid-row: 1;
		justify-self: end;
		margin-left: 0;
	}

	.hapk-header-search-btn {
		display: inline-flex;
		grid-column: auto;
		grid-row: auto;
		justify-self: auto;
	}

	.hapk-language-btn {
		width: 40px;
		height: 40px;
	}

	.hapk-language-dropdown {
		right: 0;
		left: auto;
	}
}
