/* ==========================================================================
   GOOGLE TRANSLATE - BỘ DỊCH ĐA NGÔN NGỮ (POPUP MODAL CHUẨN TRÒN 2026)
   Khắc phục 100% lỗi Google tự động đẩy top/tụt màn hình, tương thích Windows
   ========================================================================== */

/* 1. TRIỆT TIÊU TOÀN BỘ KHUNG BANNER VÀ CÁC THÀNH PHẦN TỰ SINH CỦA GOOGLE ĐẨY MÀN HÌNH */
/* Ẩn an toàn iframe banner ra ngoài màn hình, KHÔNG dùng display:none để không làm đóng băng tiến trình xử lý */
.goog-te-banner-frame,
.goog-te-banner-frame.skiptranslate,
iframe.goog-te-banner-frame {
	visibility: hidden !important;
	opacity: 0 !important;
	position: fixed !important;
	top: -9999px !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	pointer-events: none !important;
	border: none !important;
	z-index: -9999 !important;
}

/* Triệt tiêu 100% con quay loading spinner Google Translate (hình tròn trắng chữ G bị xoay liên tục) */
.VIpgJd-ZVi9od-aZ2wEe-wOHMyf,
.VIpgJd-ZVi9od-aZ2wEe-wOHMyf-ti6hGc,
.VIpgJd-ZVi9od-aZ2wEe-OiiCO,
.VIpgJd-ZVi9od-xl07Ob-lTBxNd,
.VIpgJd-ZVi9od-OR9uAe,
.VIpgJd-ZVi9od-SmfZ,
.goog-te-spinner-pos,
.goog-te-spinner,
.goog-te-spinner-animation,
#goog-gt-tt,
.goog-te-balloon-frame,
.goog-tooltip,
.goog-tooltip:hover {
	display: none !important;
	visibility: hidden !important;
	opacity: 0 !important;
	pointer-events: none !important;
	height: 0 !important;
	width: 0 !important;
	max-height: 0 !important;
	max-width: 0 !important;
	overflow: hidden !important;
}

/* 2. CỐ ĐỊNH TOP KHÔNG BỊ GOOGLE TRANSLATE ĐẨY XUỐNG 40PX */
html, body {
	top: 0px !important;
	position: static !important;
	margin-top: 0px !important;
	padding-top: 0px !important;
}

body {
	min-height: 100% !important;
}

/* Ẩn phần tử tự sinh của Google Translate ở body */
body > .skiptranslate {
	display: none !important;
}

/* Phần tử gốc render ngoài màn hình, giữ opacity thấp để JS kích hoạt sự kiện trơn tru */
#google_translate_element {
	position: fixed !important;
	top: -9999px !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0.01 !important;
	pointer-events: none !important;
	overflow: hidden !important;
	z-index: -9999 !important;
}

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

/* 3. MODAL CHỌN ĐA NGÔN NGỮ GLASSMORPHISM CAO CẤP */
.lang-modal-wrapper {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	z-index: 2147483647 !important;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
	pointer-events: none;
	padding: 16px;
	box-sizing: border-box;
	user-select: none;
	-webkit-user-select: none;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Đảm bảo luôn hiển thị trên cùng trong chế độ Fullscreen Tour */
:fullscreen .lang-modal-wrapper,
:-webkit-full-screen .lang-modal-wrapper,
:-moz-full-screen .lang-modal-wrapper,
:-ms-fullscreen .lang-modal-wrapper {
	position: fixed !important;
	z-index: 2147483647 !important;
}

.lang-modal-wrapper.active {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.lang-modal-backdrop {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(5, 10, 20, 0.75);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
}

.lang-modal-box {
	position: relative;
	width: 380px;
	max-width: 92vw;
	max-height: 85vh;
	background: linear-gradient(165deg, rgba(15, 23, 42, 0.97) 0%, rgba(10, 15, 29, 0.99) 100%);
	backdrop-filter: blur(24px);
	-webkit-backdrop-filter: blur(24px);
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 20px;
	box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 30px rgba(56, 189, 248, 0.2);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transform: scale(0.92) translateY(15px);
	transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
	color: #ffffff;
	z-index: 2;
}

.lang-modal-wrapper.active .lang-modal-box {
	transform: scale(1) translateY(0);
}

/* Header Modal */
.lang-modal-header {
	padding: 16px 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
	background: rgba(255, 255, 255, 0.02);
}

.lang-modal-title {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 14.5px;
	font-weight: 700;
	color: #38bdf8;
	letter-spacing: 0.3px;
}

.lang-modal-title-icon {
	font-size: 20px;
	line-height: 1;
}

.lang-modal-close-btn {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.15);
	color: #cbd5e1;
	font-size: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	outline: none;
	transition: all 0.25s ease;
}

.lang-modal-close-btn:hover {
	background: #ef4444;
	border-color: #ef4444;
	color: #ffffff;
	transform: rotate(90deg);
}

/* Tìm kiếm nhanh */
.lang-modal-search {
	padding: 12px 16px 8px 16px;
}

.lang-search-input {
	width: 100%;
	box-sizing: border-box;
	padding: 9px 12px 9px 34px;
	background: rgba(255, 255, 255, 0.07);
	border: 1px solid rgba(255, 255, 255, 0.15);
	border-radius: 20px;
	color: #ffffff;
	font-size: 13px;
	outline: none;
	transition: all 0.2s ease;
	font-family: inherit;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: 12px center;
}

.lang-search-input:focus {
	background-color: rgba(255, 255, 255, 0.12);
	border-color: #38bdf8;
	box-shadow: 0 0 14px rgba(56, 189, 248, 0.35);
}

.lang-search-input::placeholder {
	color: #94a3b8;
}

/* Danh sách ngôn ngữ cuộn */
.lang-modal-list {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 6px 14px 16px 14px;
	display: flex;
	flex-direction: column;
	gap: 5px;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.lang-modal-list::-webkit-scrollbar,
.lang-modal-box::-webkit-scrollbar {
	display: none;
	width: 0;
	height: 0;
}

/* Từng dòng ngôn ngữ */
.lang-option-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 9px 12px;
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.03);
	border: 1px solid rgba(255, 255, 255, 0.05);
	color: #e2e8f0;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
}

.lang-option-item:hover {
	background: rgba(56, 189, 248, 0.15);
	border-color: rgba(56, 189, 248, 0.3);
	color: #ffffff;
	transform: translateX(3px);
}

.lang-option-item.active {
	background: rgba(14, 165, 233, 0.25);
	border: 1px solid rgba(56, 189, 248, 0.45);
	color: #38bdf8;
	font-weight: 700;
}

.lang-option-left {
	display: flex;
	align-items: center;
	gap: 10px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.lang-flag {
	font-size: 18px;
	flex-shrink: 0;
	line-height: 1;
}

/* Badge mã quốc gia chuẩn ISO (Khắc phục hoàn toàn lỗi font cờ Windows) */
.lang-code-pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: 0.5px;
	padding: 2px 7px;
	border-radius: 6px;
	background: rgba(56, 189, 248, 0.12);
	color: #38bdf8;
	border: 1px solid rgba(56, 189, 248, 0.25);
	flex-shrink: 0;
	transition: all 0.2s ease;
}

.lang-option-item.active .lang-code-pill {
	background: #38bdf8;
	color: #0f172a;
	border-color: #38bdf8;
	font-weight: 800;
	box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.lang-option-item:hover .lang-code-pill {
	border-color: #38bdf8;
	background: rgba(56, 189, 248, 0.22);
}

.lang-name {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.lang-check-icon {
	color: #38bdf8;
	font-size: 14px;
	font-weight: 800;
	opacity: 0;
	flex-shrink: 0;
	margin-left: 8px;
}

.lang-option-item.active .lang-check-icon {
	opacity: 1;
}

/* 4. TOAST THÔNG BÁO CHUYỂN ĐỔI NGÔN NGỮ */
.translate-toast {
	position: fixed;
	bottom: 36px;
	left: 50%;
	transform: translateX(-50%) translateY(25px);
	background: linear-gradient(135deg, rgba(15, 23, 42, 0.96) 0%, rgba(10, 15, 29, 0.98) 100%);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	border: 1px solid rgba(56, 189, 248, 0.35);
	box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(56, 189, 248, 0.25);
	color: #ffffff;
	padding: 10px 22px;
	border-radius: 30px;
	font-size: 13.5px;
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 10px;
	z-index: 2147483647 !important;
	opacity: 0;
	pointer-events: none;
	transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
	user-select: none;
	white-space: nowrap;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.translate-toast.show {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

.translate-toast-icon {
	font-size: 18px;
	line-height: 1;
}

.translate-toast-msg {
	color: #f1f5f9;
	letter-spacing: 0.2px;
}

/* 5. RESPONSIVE CHO ĐIỆN THOẠI (82% KÍCH THƯỚC) */
@media screen and (max-width: 768px) {
	.lang-modal-box {
		width: 82vw;
		max-width: 82vw;
		max-height: 80vh;
		max-height: 80dvh;
		border-radius: 18px;
	}

	.translate-toast {
		bottom: 24px;
		font-size: 12.5px;
		padding: 8px 18px;
		max-width: 90vw;
		overflow: hidden;
		text-overflow: ellipsis;
	}
}
