/**
 * 百家 Header 小部件样式
 * Author: 百家
 */

/* 基础重置 */
.baijia-header,
.baijia-header * {
	box-sizing: border-box;
}

.baijia-header ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.baijia-header a {
	text-decoration: none;
	color: inherit;
}

/* ===================== 顶部条 ===================== */
.baijia-topbar {
	background-color: #000;
	color: #fff;
	font-size: 13px;
}

.baijia-topbar-inner {
	display: flex;
	justify-content: space-between;
	align-items: center;
	max-width: 1440px;
	margin: 0 auto;
	padding: 8px 40px;
	flex-wrap: wrap;
	gap: 10px;
}

.baijia-topbar-left,
.baijia-topbar-right {
	display: flex;
	align-items: center;
	gap: 20px;
	flex-wrap: wrap;
}

.baijia-topbar-contacts {
	display: flex;
	align-items: center;
	gap: 20px;
	flex-wrap: wrap;
}

.baijia-topbar-right a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	transition: opacity 0.25s ease;
}

.baijia-topbar-right a:hover {
	opacity: 0.8;
}

/* WhatsApp 图标：绿色圆点，电话前方 */
.baijia-topbar-whatsapp {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background-color: #25d366;
	color: #fff;
	justify-content: center;
	font-size: 12px;
	line-height: 1;
}

.baijia-topbar-whatsapp i {
	font-size: 12px;
	line-height: 1;
}

.baijia-topbar-whatsapp svg {
	width: 12px;
	height: 12px;
	display: block;
	fill: currentColor;
}

.baijia-topbar-whatsapp:hover {
	background-color: #1ebe57;
	opacity: 1;
}

.baijia-topbar-socials {
	display: flex;
	align-items: center;
	gap: 14px;
}

.baijia-topbar-socials a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.25s ease, color 0.25s ease;
}

.baijia-topbar-socials a:hover {
	transform: translateY(-2px);
}

.baijia-topbar-socials a i,
.baijia-topbar-socials a svg {
	width: 14px;
	height: 14px;
	font-size: 14px;
}

/* ===================== 主页眉 ===================== */
.baijia-main-header {
	position: relative;
	background-color: #fff;
	transition: background-color 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease;
	/* 不设置 z-index，避免创建 stacking context 限制子元素（如移动菜单）的层级 */
}

.baijia-main-header-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	max-width: 1440px;
	margin: 0 auto;
	padding: 10px 40px;
	gap: 30px;
}

/* Logo */
.baijia-logo {
	flex-shrink: 0;
}

.baijia-logo-img {
	display: block;
	height: 60px;
	width: auto;
	max-width: 100%;
}

/* ===================== 主菜单 ===================== */
.baijia-nav {
	flex: 1;
	display: flex;
	justify-content: center;
}

.baijia-menu {
	display: flex;
	align-items: center;
}

.baijia-menu > li {
	position: relative;
	margin: 0 20px;
}

.baijia-menu > li > a {
	position: relative;
	display: inline-block;
	padding: 25px 0;
	font-size: 15px;
	font-weight: 500;
	color: #222;
	line-height: 1;
	transition: color 0.25s ease;
}

/* 悬停横线（左→右） */
.baijia-menu > li > a::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 18px;
	width: 100%;
	height: 2px;
	background-color: #a6ce39;
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 0.4s ease;
}

.baijia-menu > li:hover > a::after,
.baijia-menu > li.is-active > a::after {
	transform: scaleX(1);
}

.baijia-menu > li:hover > a,
.baijia-menu > li.is-active > a {
	color: #a6ce39;
}

/* 子菜单 */
.baijia-menu .sub-menu {
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 220px;
	padding: 10px 0;
	background-color: #fff;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px);
	transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
	z-index: 1001;
}

.baijia-menu > li.has-children:hover > .sub-menu,
.baijia-menu > li.has-children.open > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.baijia-menu .sub-menu a {
	display: block;
	padding: 10px 20px;
	font-size: 14px;
	color: #333;
	transition: background-color 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
}

.baijia-menu .sub-menu a:hover {
	background-color: #a6ce39;
	color: #fff;
	padding-left: 25px;
}

.baijia-submenu-arrow {
	display: none;
}

/* ===================== 右侧图标 ===================== */
.baijia-right-icons {
	display: flex;
	align-items: center;
	gap: 20px;
	flex-shrink: 0;
}

.baijia-search-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: #fff;
	transition: transform 0.25s ease, color 0.25s ease;
	line-height: 1;
}

.baijia-search-toggle:hover {
	color: #a6ce39;
}

/* 提高特异性以打败已保存的旧默认色（避免每个实例都要手动清色值） */
.baijia-header .baijia-right-icons .baijia-search-toggle {
	color: #fff !important;
}

.baijia-header .baijia-right-icons .baijia-search-toggle:hover {
	color: #a6ce39 !important;
}

.baijia-search-toggle i {
	font-size: 22px;
}

.baijia-search-toggle svg {
	width: 22px;
	height: 22px;
	display: block;
	color: inherit;
	stroke: currentColor;
	fill: none;
}

/* 搜索面板按钮里的 SVG */
.baijia-search-form button svg {
	width: 20px;
	height: 20px;
	display: block;
	color: inherit;
	stroke: currentColor;
	fill: none;
}

/* 搜索图标悬停效果：缩放（默认） */
.baijia-search-hover-scale .baijia-search-toggle:hover {
	transform: scale(1.15);
}

/* 搜索图标悬停效果：旋转 */
.baijia-search-hover-rotate .baijia-search-toggle:hover {
	transform: rotate(15deg) scale(1.1);
}

/* 搜索图标悬停效果：抖动 */
.baijia-search-hover-shake .baijia-search-toggle:hover {
	animation: baijia-shake 0.5s ease;
}

@keyframes baijia-shake {
	0%, 100% { transform: translateX(0); }
	20% { transform: translateX(-3px); }
	40% { transform: translateX(3px); }
	60% { transform: translateX(-2px); }
	80% { transform: translateX(2px); }
}

/* 搜索图标悬停效果：脉冲 */
.baijia-search-hover-pulse .baijia-search-toggle:hover {
	animation: baijia-pulse 0.8s ease infinite;
}

@keyframes baijia-pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.2); }
}

/* 搜索图标悬停效果：上下跳动 */
.baijia-search-hover-bounce .baijia-search-toggle:hover {
	animation: baijia-bounce 0.6s ease infinite;
}

@keyframes baijia-bounce {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-5px); }
}

/* 无动画 */
.baijia-search-hover-none .baijia-search-toggle:hover {
	transform: none;
}

/* 语言切换 */
.baijia-lang {
	position: relative;
}

.baijia-lang-current {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	padding: 6px 4px;
	background: transparent;
	color: #fff;
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
	transition: opacity 0.25s ease, color 0.25s ease;
}

.baijia-lang-current:hover {
	color: #a6ce39;
}

/* 提高特异性以打败已保存的旧默认色 */
.baijia-header .baijia-right-icons .baijia-lang-current {
	color: #fff !important;
}

.baijia-header .baijia-right-icons .baijia-lang-current:hover {
	color: #a6ce39 !important;
}

.baijia-lang-current img {
	width: 22px;
	height: auto;
	display: block;
	border-radius: 2px;
}

.baijia-lang-current em {
	font-style: normal;
}

.baijia-lang-dropdown {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	min-width: 140px;
	padding: 6px 0;
	background-color: #fff;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px);
	transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
	z-index: 1002;
}

.baijia-lang.has-dropdown:hover .baijia-lang-dropdown,
.baijia-lang.open .baijia-lang-dropdown {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.baijia-lang-dropdown li a {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	color: #333;
	font-size: 13px;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.baijia-lang-dropdown li a:hover {
	background-color: #f5f5f5;
	color: #a6ce39;
}

.baijia-lang-dropdown li a img {
	width: 20px;
	height: auto;
}

/* 移动端侧边栏关闭按钮（PC 下不显示） */
.baijia-nav-close {
	display: none;
}

/* 侧边栏内语言切换：PC 下不显示 */
.baijia-nav-footer {
	display: none;
}

/* PC 下顶部语言切换正常显示，侧边栏内的不显示 */
.baijia-lang-nav {
	display: none;
}

/* 移动端汉堡按钮 */
.baijia-menu-toggle {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 32px;
	height: 32px;
	padding: 0;
	background: transparent;
	border: none;
	cursor: pointer;
}

.baijia-menu-toggle span {
	display: block;
	width: 24px;
	height: 2px;
	background-color: #222;
	transition: transform 0.3s ease, opacity 0.3s ease;
}

.baijia-menu-toggle.open span:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.baijia-menu-toggle.open span:nth-child(2) {
	opacity: 0;
}

.baijia-menu-toggle.open span:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

/* ===================== 搜索面板 ===================== */
.baijia-search-panel {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background-color: #000;
	padding: 30px 40px;
	transform: translateY(-20px);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: transform 0.4s ease, opacity 0.3s ease, visibility 0.3s ease;
	z-index: 999;
}

.baijia-search-panel.open {
	transform: translateY(0);
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.baijia-search-form {
	display: flex;
	align-items: center;
	max-width: 1440px;
	margin: 0 auto;
	border-bottom: 1px solid #fff;
	padding-bottom: 8px;
}

.baijia-search-form input[type="search"] {
	flex: 1;
	background: transparent;
	border: none;
	outline: none;
	color: #fff;
	font-size: 20px;
	padding: 6px 10px;
}

.baijia-search-form input[type="search"]::placeholder {
	color: #ccc;
}

.baijia-search-form button {
	background: transparent;
	border: none;
	color: #fff;
	cursor: pointer;
	padding: 6px 10px;
	font-size: 18px;
	transition: color 0.25s ease, transform 0.25s ease;
}

.baijia-search-form button:hover {
	color: #a6ce39;
	transform: scale(1.1);
}

.baijia-search-close {
	margin-left: 10px;
}

/* ===================== 下滑吸顶 ===================== */
.baijia-header.is-sticky .baijia-main-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	background-color: #fff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
	animation: baijia-slide-down 0.35s ease;
	z-index: 990; /* 低于移动端侧边栏(99999)和遮罩(99998) */
}

/* 移动端菜单打开时，提升 header 层级以跳出可能的父级 stacking context */
.baijia-header.is-mobile-open {
	position: relative;
	z-index: 99999;
}

.baijia-sticky-placeholder {
	display: none;
	width: 100%;
}

.baijia-header.is-sticky .baijia-sticky-placeholder {
	display: block;
}

@keyframes baijia-slide-down {
	from {
		transform: translateY(-10px);
		opacity: 0.6;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

/* ===================== 响应式：平板 ===================== */
@media (max-width: 1024px) {
	.baijia-main-header-inner {
		padding: 10px 20px;
	}

	.baijia-topbar-inner {
		padding: 8px 20px;
	}

	.baijia-menu > li {
		margin: 0 12px;
	}

	.baijia-menu > li > a {
		font-size: 14px;
		padding: 20px 0;
	}
}

/* ===================== 响应式：手机 ===================== */
@media (max-width: 767px) {
	.baijia-topbar.baijia-topbar--hide-mobile {
		display: none;
	}

	.baijia-topbar-inner {
		justify-content: center;
		padding: 6px 15px;
		font-size: 12px;
	}

	.baijia-topbar-left,
	.baijia-topbar-right {
		gap: 12px;
	}

	.baijia-main-header-inner {
		padding: 10px 15px;
	}

	.baijia-menu-toggle {
		display: flex;
	}

	.baijia-nav {
		position: fixed;
		top: 0;
		left: -100%;
		display: block;                  /* 覆盖默认 flex；以免子元素左右排列 */
		flex: none;
		justify-content: flex-start;
		width: 80%;
		max-width: 320px;
		height: 100vh;
		background-color: #fff;
		box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15);
		transition: left 0.4s ease;
		padding: 70px 0 30px;
		overflow-y: auto;
		z-index: 99999;
	}

	.baijia-nav.open {
		left: 0;
	}

	/* 移动端侧边栏顶部关闭按钮 */
	.baijia-nav-close {
		position: absolute;
		top: 18px;
		right: 18px;
		width: 32px;
		height: 32px;
		display: flex;
		align-items: center;
		justify-content: center;
		background: transparent;
		border: none;
		cursor: pointer;
		padding: 0;
	}

	.baijia-nav-close::before,
	.baijia-nav-close::after {
		content: "";
		position: absolute;
		width: 22px;
		height: 2px;
		background-color: #222;
		transition: background-color 0.2s ease;
	}

	.baijia-nav-close::before {
		transform: rotate(45deg);
	}

	.baijia-nav-close::after {
		transform: rotate(-45deg);
	}

	.baijia-nav-close:hover::before,
	.baijia-nav-close:hover::after {
		background-color: #a6ce39;
	}

	.baijia-menu {
		flex-direction: column;
		align-items: stretch;
	}

	.baijia-menu > li {
		margin: 0;
		border-bottom: 1px solid #f0f0f0;
	}

	.baijia-menu > li > a {
		display: block;
		padding: 15px 24px;
	}

	.baijia-menu > li > a::after {
		display: none;
	}

	.baijia-menu .sub-menu {
		position: static;
		min-width: auto;
		opacity: 1;
		visibility: visible;
		transform: none;
		box-shadow: none;
		padding: 0;
		max-height: 0;
		overflow: hidden;
		transition: max-height 0.3s ease;
	}

	.baijia-menu > li.has-children.open > .sub-menu {
		max-height: 600px;
	}

	.baijia-submenu-arrow {
		display: block;
		position: absolute;
		top: 12px;
		right: 20px;
		width: 24px;
		height: 24px;
		cursor: pointer;
	}

	.baijia-submenu-arrow::before {
		content: "";
		position: absolute;
		top: 50%;
		left: 50%;
		width: 8px;
		height: 8px;
		border-right: 2px solid #333;
		border-bottom: 2px solid #333;
		transform: translate(-50%, -70%) rotate(45deg);
		transition: transform 0.3s ease;
	}

	.baijia-menu > li.has-children.open .baijia-submenu-arrow::before {
		transform: translate(-50%, -20%) rotate(-135deg);
	}

	.baijia-menu .sub-menu a {
		padding-left: 40px;
	}

	/* 侧边栏底部显示语言切换 */
	.baijia-nav-footer {
		display: block;
		width: 100%;
		margin-top: 20px;
		padding: 20px 24px;
		border-top: 1px solid #f0f0f0;
		box-sizing: border-box;
	}

	.baijia-lang-nav {
		display: block;
		width: 100%;
		position: static;
	}

	.baijia-lang-nav .baijia-lang-current {
		display: flex;
		align-items: center;
		gap: 10px;
		padding: 8px 0;
		justify-content: flex-start;
		color: #222;
		font-size: 14px;
	}

	.baijia-lang-nav .baijia-lang-current img {
		width: 24px;
		height: auto;
	}

	.baijia-lang-nav .baijia-lang-dropdown {
		position: static;
		opacity: 1;
		visibility: visible;
		transform: none;
		box-shadow: none;
		padding: 0;
		min-width: auto;
		margin-top: 10px;
		background: transparent;
	}

	.baijia-lang-nav .baijia-lang-dropdown li a {
		padding: 8px 0;
		background: transparent;
	}

	.baijia-lang-nav .baijia-lang-dropdown li a:hover {
		background: transparent;
		color: #a6ce39;
	}

	/* 顶部语言切换在手机端隐藏（由侧边栏承载） */
	.baijia-right-icons .baijia-lang-top {
		display: none;
	}

	.baijia-right-icons {
		gap: 14px;
	}

	.baijia-search-panel {
		padding: 20px 15px;
	}

	.baijia-search-form input[type="search"] {
		font-size: 16px;
	}
}

/* 遮罩层（移动端菜单打开时） */
.baijia-mobile-overlay {
	position: fixed;
	inset: 0;
	background-color: rgba(0, 0, 0, 0.5);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
	z-index: 99998;
}

.baijia-mobile-overlay.open {
	opacity: 1;
	visibility: visible;
}

/* Elementor 编辑器内预览修正 */
.elementor-editor-active .baijia-header.is-sticky .baijia-main-header {
	position: static;
	animation: none;
	box-shadow: none;
}
