/* 前台语言切换器样式（与模板无关，放 /static 便于任何模板复用）
 *
 * 结构由 apps/common/function.php 的 lang_switch_front_html() 生成：
 *   .lang-switch > .language-switcher > .language-btn + .language-dropdown > .language-list > .language-item
 * 交互与 translate.js 初始化在 /static/js/lang-switch.js，模板只需引用本文件 + 那个 js。
 *
 * 依赖：font-awesome（地球图标 .fa-globe）与 bootstrap 的 .navbar-text 布局；缺失时也能正常显示。
 */

/* ---------- 语言切换按钮：地球图标 + Language + ▼ ---------- */
.lang-switch {
	padding-left: .5rem;
}
.lang-switch .language-switcher {
	position: relative;
	display: inline-block;
}
.lang-switch .language-btn {
	display: flex;
	align-items: center;
	cursor: pointer;
	font-size: 14px;
	color: #6c757d;
	padding: 4px 6px;
	border-radius: 4px;
	white-space: nowrap;
	user-select: none;
	transition: background .15s, color .15s;
}
.lang-switch .language-btn:hover {
	background: rgba(5, 121, 242, .08);
	color: #0579f2;
}
.lang-switch .language-btn .globe-icon {
	font-size: 16px;
	line-height: 1;
}
.lang-switch .language-btn .current-lang {
	margin-left: 5px;
}
.lang-switch .language-btn .arrow-icon {
	margin-left: 5px;
	font-size: 10px;
	line-height: 1;
	transition: transform .3s;
}

/* ---------- 下拉面板（三列国旗语言） ---------- */
.lang-switch .language-dropdown {
	display: none;
	position: absolute;
	top: calc(100% + 5px);
	right: 0;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
	z-index: 1030;
}
.lang-switch .language-dropdown.active {
	display: block;
}
.lang-switch .language-list {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 5px;
	padding: 10px;
	max-height: 230px;
	overflow-y: auto;
}
.lang-switch .language-list.show-all {
	max-height: 400px;
}
.lang-switch .language-item {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 8px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 13px;
	color: #333;
}
.lang-switch .language-item.hidden {
	display: none;
}
.lang-switch .language-item:hover {
	background: #f5f5f5;
}
.lang-switch .language-item img {
	width: 16px;
	height: 12px;
	object-fit: cover;
	border-radius: 1px;
	flex: 0 0 auto;
}
.lang-switch .language-item a {
	color: inherit;
	text-decoration: none;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}
.lang-switch .more-languages {
	text-align: center;
	padding: 8px;
	border-top: 1px solid #eee;
	cursor: pointer;
	color: #666;
	font-size: 13px;
}
.lang-switch .more-languages:hover {
	color: #333;
	background: #f5f5f5;
}
.lang-switch .language-list::-webkit-scrollbar {
	width: 6px;
}
.lang-switch .language-list::-webkit-scrollbar-track {
	background: #f1f1f1;
}
.lang-switch .language-list::-webkit-scrollbar-thumb {
	background: #ccc;
	border-radius: 3px;
}
.lang-switch .language-list::-webkit-scrollbar-thumb:hover {
	background: #999;
}

/* ---------- 移动端：面板左对齐、两列 ---------- */
@media (max-width: 991px) {
	.lang-switch {
		padding-left: 0;
		margin-top: .5rem;
	}
	.lang-switch .language-dropdown {
		left: auto;
		right: 0;
	}
	.lang-switch .language-list {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* ---------- 切换中提示（js/lang-switch.js）
  客户端翻译是逐段请求，首次切换要 1~4 秒；用顶部白色小卡片 + 蓝色不确定进度条给出反馈，
  延迟 250ms 出现（缓存命中的快速切换不闪），翻译完成自动淡出。*/
.lang-toast {
	position: fixed;
	left: 50%;
	top: 18px;
	transform: translate(-50%, -12px);
	z-index: 9999;
	min-width: 210px;
	max-width: 80vw;
	padding: 12px 18px 14px;
	background: #fff;
	border: 1px solid #eef1f5;
	border-radius: 12px;
	box-shadow: 0 10px 30px rgba(15, 23, 42, .16);
	opacity: 0;
	pointer-events: none;
	transition: opacity .18s ease, transform .18s ease;
}
.lang-toast.show {
	opacity: 1;
	transform: translate(-50%, 0);
}
.lang-toast-text {
	font-size: 13.5px;
	line-height: 20px;
	color: #1f2937;
	text-align: center;
	white-space: nowrap;
}
.lang-toast-text b {
	color: #0579f2;
	font-weight: 600;
}
.lang-toast-bar {
	position: relative;
	height: 3px;
	margin-top: 10px;
	border-radius: 2px;
	background: #eef2f7;
	overflow: hidden;
}
.lang-toast-bar::after {
	content: "";
	position: absolute;
	left: -40%;
	top: 0;
	width: 40%;
	height: 100%;
	border-radius: 2px;
	background: linear-gradient(90deg, #3b9df8, #0579f2);
	animation: langToastRun 1.05s ease-in-out infinite;
}
@keyframes langToastRun {
	0% { left: -40%; }
	100% { left: 100%; }
}

/* 当前语种面板项高亮 */
.lang-switch .language-item.is-current {
	background: rgba(43, 124, 211, .08);
	color: #2b7cd3;
	font-weight: 600;
}
