/* ==============================================
   Custom Header Widget
   ============================================== */

/* --- Reset & Container --- */
.custom-header-wrapper {
	width: 100%;
	position: relative;
	z-index: 999;
}

.custom-header-container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 20px;
	display: flex;
	align-items: center;
	height: 100%;
	box-sizing: border-box;
}

/* --- Top Bar --- */
.custom-header-topbar {
	width: 100%;
}

.topbar-info-items {
	display: flex;
	align-items: center;
	flex: 1;
	min-width: 0;
}

.topbar-info-item {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	color: inherit;
	transition: opacity .3s;
	line-height: 1;
}

.topbar-info-item:hover {
	opacity: .75;
}

.topbar-info-item .topbar-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.topbar-info-item .topbar-icon img,
.topbar-info-item .topbar-icon svg {
	display: block;
	object-fit: contain;
}

.topbar-info-item .topbar-icon i {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.topbar-info-item .topbar-text {
	white-space: nowrap;
}

/* --- Language Switcher --- */
.topbar-language {
	position: relative;
	margin-left: auto;
	flex-shrink: 0;
	padding-left: 20px;
}

.language-current {
	display: flex;
	align-items: center;
	cursor: pointer;
	gap: 6px;
	user-select: none;
}

.language-current .language-flag {
	display: block;
	border-radius: 2px;
}

.language-current .language-code {
	font-weight: 600;
}

.language-current .language-arrow {
	display: flex;
	transition: transform .3s;
}

.topbar-language:hover .language-arrow {
	transform: rotate(180deg);
}

/* Dropdown */
.language-dropdown {
	position: absolute;
	top: 100%;
	right: 0;
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition: all .3s ease;
	z-index: 1000;
	padding-top: 12px;
}

.topbar-language:hover .language-dropdown {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.language-dropdown-arrow {
	position: absolute;
	top: 4px;
	right: 20px;
	width: 0;
	height: 0;
	border-left: 8px solid transparent;
	border-right: 8px solid transparent;
	border-bottom: 8px solid #fff;
	z-index: 1;
}

.language-dropdown-inner {
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 4px 24px rgba(0, 0, 0, .18);
	padding: 10px;
	max-height: 300px;
	overflow-y: auto;
}

.language-dropdown-inner::-webkit-scrollbar {
	width: 4px;
}

.language-dropdown-inner::-webkit-scrollbar-thumb {
	background: #ccc;
	border-radius: 4px;
}

.language-dropdown-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 2px;
}

.language-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	text-decoration: none;
	color: #333;
	border-radius: 6px;
	transition: background .2s;
	white-space: nowrap;
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
}

.language-item:hover {
	background: #f0f0f0;
}

.language-item .lang-flag {
	display: block;
	flex-shrink: 0;
	border-radius: 2px;
}

/* --- Bottom Navbar --- */
.custom-header-navbar {
	width: 100%;
	transition: background-color .35s ease, box-shadow .35s ease;
	z-index: 998;
}

.custom-header-navbar.is-sticky {
	position: fixed !important;
	top: 0;
	left: 0;
	width: 100%;
	animation: chSlideDown .4s ease;
}

.custom-header-navbar.is-sticky.has-shadow {
	box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
}

@keyframes chSlideDown {
	from {
		transform: translateY(-100%);
	}
	to {
		transform: translateY(0);
	}
}

/* Placeholder (prevents content jump) */
.custom-header-navbar-placeholder {
	display: none;
	width: 100%;
}

.custom-header-navbar-placeholder.active {
	display: block;
}

/* Logo */
.navbar-logo {
	flex-shrink: 0;
	display: flex;
	align-items: center;
}

.navbar-logo a {
	display: flex;
	align-items: center;
}

.navbar-logo img {
	display: block;
	height: auto;
}

/* Menu */
.navbar-menu {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
}

.navbar-menu-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	height: 100%;
}

.navbar-menu-list li {
	position: relative;
	height: 100%;
	display: flex;
	align-items: center;
}

.navbar-menu-list > li > a {
	display: flex;
	align-items: center;
	text-decoration: none;
	transition: color .3s;
	white-space: nowrap;
	font-weight: 500;
	height: 100%;
	color: #fff;
}

.navbar-menu-list > li > a:hover,
.navbar-menu-list > li.current-menu-item > a,
.navbar-menu-list > li.current-menu-ancestor > a {
	color: #2b4182;
}

/* Submenu arrow - handled by injected .submenu-arrow SVG */

/* Submenu (Level 1) */
.navbar-menu-list .sub-menu {
	position: absolute;
	top: 100%;
	left: 0;
	list-style: none;
	margin: 0;
	padding: 0;
	background: #fff;
	box-shadow: 0 8px 30px rgba(0, 0, 0, .12);
	border-radius: 0;
	min-width: 200px;
	width: max-content;
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition: all .25s ease;
	z-index: 100;
	display: flex;
	flex-direction: column;
}

.navbar-menu-list li:hover > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.navbar-menu-list .sub-menu li {
	height: auto;
	position: relative;
}

.navbar-menu-list .sub-menu li a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 28px;
	color: #1f2937;
	text-decoration: none;
	white-space: nowrap;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
	transition: background .2s, color .2s;
	width: 100%;
	box-sizing: border-box;
}

.navbar-menu-list .sub-menu li a:hover {
	background: #2b4182;
	color: #fff;
}

.navbar-menu-list .sub-menu li a:hover .submenu-arrow {
	color: #fff;
}

/* Sub-menu arrow icon (injected SVG) */
.submenu-arrow {
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
	color: inherit;
	transition: transform .25s;
}

/* Sub-menu level: push arrow to far right */
.navbar-menu-list .sub-menu li.menu-item-has-children > a > .submenu-arrow {
	margin-left: auto;
	padding-left: 20px;
}

.submenu-arrow svg {
	width: 7px;
	height: 12px;
	display: block;
}

/* Top-level: rotate right-arrow 90deg so it points DOWN */
.navbar-menu-list > li.menu-item-has-children > a > .submenu-arrow {
	padding-left: 5px;
	display: inline-flex;
	align-items: center;
	height: 100%;
}

.navbar-menu-list > li.menu-item-has-children > a > .submenu-arrow svg {
	width: 12px;
	height: 12px;
	transform: rotate(90deg);
	transition: transform .25s;
	position: relative;
	top: 1px;
}

.navbar-menu-list > li.menu-item-has-children:hover > a > .submenu-arrow svg {
	transform: rotate(270deg);
}

/* Nested sub-menu (Level 2+) */
.navbar-menu-list .sub-menu .sub-menu {
	top: 0;
	left: 100%;
	border-radius: 0;
	min-width: auto;
	width: max-content;
}

.navbar-menu-list .sub-menu .sub-menu li a {
	font-weight: 400;
	font-size: 14px;
	color: #374151;
	padding: 10px 28px;
	white-space: nowrap;
}

.navbar-menu-list .sub-menu .sub-menu li a:hover {
	background: #2b4182;
	color: #fff;
}

/* --- Navbar Actions --- */
.navbar-actions {
	display: flex;
	align-items: center;
	margin-left: auto;
	flex-shrink: 0;
	gap: 0;
}

/* Search expanding form
   ------------------------------------------------
   - Form is a positioning context; icon stays anchored on right
   - Input is absolutely positioned with right: 0 (same right edge as icon)
   - On active: input width grows leftward, icon ends up wrapped inside input
   - Icon has z-index above input, so click target stays the same
*/
.navbar-search-form {
	position: relative;
	display: inline-flex;
	align-items: center;
	height: 40px;
	box-sizing: border-box;
	z-index: 1;
	transition: background-color .3s;
}

.navbar-search-form.is-active {
	background-color: transparent;
}

.navbar-search-input {
	position: absolute;
	top: 0;
	right: 0;
	height: 100%;
	width: 0;
	min-width: 0;
	padding: 0;
	margin: 0;
	border: 1px solid transparent;
	border-radius: 0;
	outline: none;
	background-color: transparent;
	color: #fff;
	font-size: 14px;
	box-sizing: border-box;
	opacity: 0;
	pointer-events: none;
	transition: width .35s ease, padding .35s ease, opacity .25s ease, border-color .35s ease, background-color .35s ease;
	box-shadow: none !important;
	z-index: 1;
}

.navbar-search-input::-webkit-search-cancel-button,
.navbar-search-input::-webkit-search-decoration {
	-webkit-appearance: none;
	display: none;
}

.navbar-search-form.is-active .navbar-search-input {
	width: 240px;
	padding: 0 40px 0 16px;
	opacity: 1;
	pointer-events: auto;
	border-color: rgba(255,255,255,.6);
	background-color: transparent;
	color: #fff;
}

.navbar-search {
	position: relative;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	cursor: pointer;
	color: inherit;
	user-select: none;
	transition: opacity .3s, color .3s;
	border-radius: 50%;
}

.navbar-search-form.is-active .navbar-search {
	color: #2b4182;
}

.navbar-search:hover {
	opacity: .75;
}

.navbar-search:focus {
	outline: none;
}

.navbar-search i,
.navbar-search svg {
	display: block;
	pointer-events: none;
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.navbar-cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	font-weight: 600;
	transition: all .3s;
	white-space: nowrap;
	cursor: pointer;
	user-select: none;
	line-height: 1.2;
	box-sizing: border-box;
}

.navbar-cta:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
}

/* --- Mobile Toggle --- */
.navbar-mobile-toggle {
	display: none;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: 5px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 6px;
	margin-left: 10px;
}

.navbar-mobile-toggle span {
	display: block;
	width: 22px;
	height: 2px;
	background: #fff;
	border-radius: 2px;
	transition: all .3s;
}

.navbar-mobile-toggle.active span:nth-child(1) {
	transform: rotate(45deg) translate(5px, 5px);
}

.navbar-mobile-toggle.active span:nth-child(2) {
	opacity: 0;
}

.navbar-mobile-toggle.active span:nth-child(3) {
	transform: rotate(-45deg) translate(5px, -5px);
}

/* ==============================================
   Responsive
   ============================================== */
@media (max-width: 991px) {

	/* --- 隐藏顶栏 --- */
	.custom-header-topbar {
		display: none !important;
	}

	/* --- Navbar 重排：logo左、语言+汉堡右 --- */
	.custom-header-navbar .custom-header-container {
		justify-content: space-between;
	}

	/* 语言切换移入 navbar：汉堡菜单左边 */
	.navbar-mobile-lang {
		display: flex;
		align-items: center;
		margin-left: auto;
		margin-right: 4px;
	}
	.navbar-mobile-lang .topbar-language { padding-left: 0; margin-left: 0; }
	.navbar-mobile-lang .language-current { color: #fff; }

	/* PC端隐藏 navbar-actions 里的搜索和CTA（移到菜单内） */
	.navbar-actions {
		display: none !important;
	}

	.navbar-mobile-toggle {
		display: flex;
	}

	/* --- 侧滑菜单面板（从左侧展开 70%） --- */
	.navbar-menu {
		position: fixed;
		top: 0;
		left: 0;
		width: 70%;
		height: 100vh;
		background: #1a1a1a;
		flex-direction: column;
		justify-content: flex-start;
		padding: 60px 0 20px;
		transform: translateX(-100%);
		transition: transform .35s ease;
		z-index: 9999;
		overflow-y: auto;
		box-shadow: 4px 0 20px rgba(0, 0, 0, .3);
	}

	.navbar-menu.is-open {
		transform: translateX(0);
	}

	/* --- 菜单内搜索框（最顶部） --- */
	.navbar-menu .mobile-menu-search {
		display: block;
		padding: 0 20px 16px;
		order: -2;
	}

	.navbar-menu .mobile-menu-search input {
		width: 100%;
		padding: 10px 14px;
		border: 1px solid rgba(255,255,255,.3);
		border-radius: 4px;
		background: rgba(255,255,255,.08);
		color: #fff;
		font-size: 14px;
		outline: none;
		box-sizing: border-box;
	}

	.navbar-menu .mobile-menu-search input::placeholder {
		color: rgba(255,255,255,.5);
	}

	/* --- 菜单列表（全白色） --- */
	.navbar-menu-list {
		flex-direction: column;
		width: 100%;
		height: auto;
		order: -1;
	}

	.navbar-menu-list li {
		height: auto;
		width: 100%;
		flex-direction: column;
	}

	.navbar-menu-list > li > a {
		padding: 12px 24px;
		width: 100%;
		box-sizing: border-box;
		height: auto;
		color: #fff;
	}

	.navbar-menu-list > li > a:hover {
		color: #2b4182;
	}

	.navbar-menu-list .sub-menu {
		position: static;
		opacity: 1;
		visibility: visible;
		transform: none;
		box-shadow: none;
		border-radius: 0;
		background: rgba(255, 255, 255, .05);
		min-width: 100%;
		width: 100%;
		max-height: 0;
		overflow: hidden;
		transition: max-height .35s ease;
	}

	.navbar-menu-list .sub-menu.is-open {
		max-height: 1000px;
	}

	.navbar-menu-list .sub-menu li a {
		padding-left: 40px;
		color: #fff;
	}

	.navbar-menu-list .sub-menu li a:hover {
		background: rgba(255, 255, 255, .08);
		color: #2b4182;
	}

	.navbar-menu-list .sub-menu .sub-menu li a {
		padding-left: 56px;
		color: rgba(255,255,255,.85);
	}

	.submenu-arrow {
		margin-left: auto;
		color: #fff;
		padding: 8px 12px;
		cursor: pointer;
	}

	.navbar-menu-list > li.menu-item-has-children > a > .submenu-arrow svg {
		transform: rotate(90deg);
		transition: transform .3s;
	}

	.navbar-menu-list > li.menu-item-has-children > a > .submenu-arrow.is-open svg {
		transform: rotate(270deg);
	}

	.navbar-menu-list .sub-menu li.menu-item-has-children > a > .submenu-arrow svg {
		transition: transform .3s;
	}

	.navbar-menu-list .sub-menu li.menu-item-has-children > a > .submenu-arrow.is-open svg {
		transform: rotate(90deg);
	}

	.navbar-menu-list .sub-menu .sub-menu {
		left: 0;
		top: 0;
	}

	/* --- 菜单内CTA按钮（隐藏） --- */
	.navbar-menu .mobile-menu-cta {
		display: none;
	}

	.navbar-menu .mobile-menu-cta .navbar-cta {
		display: flex;
		width: 100%;
		justify-content: flex-start;
		padding-top: 6px;
		padding-bottom: 6px;
		font-size: 13px;
	}

	/* --- 菜单内联系信息（底部） --- */
	.navbar-menu .mobile-menu-info {
		display: block;
		padding: 16px 20px 0;
		order: 2;
		border-top: 1px solid rgba(255,255,255,.12);
		margin-top: auto;
	}

	.mobile-menu-info .mobile-info-item {
		display: flex;
		align-items: flex-start;
		gap: 10px;
		padding: 8px 0;
		color: rgba(255,255,255,.7);
		font-size: 12px;
		line-height: 1.5;
	}

	.mobile-menu-info .mobile-info-icon {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		flex-shrink: 0;
		width: 14px;
		height: 14px;
		margin-top: 2px;
	}

	.mobile-menu-info .mobile-info-icon svg {
		width: 14px;
		height: 14px;
		fill: rgba(255,255,255,.7);
	}

	.mobile-menu-info .mobile-info-text {
		white-space: normal;
		word-break: break-word;
	}

	/* --- 遮罩 --- */
	.navbar-menu-overlay {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		background: rgba(0, 0, 0, .5);
		z-index: 9998;
		opacity: 0;
		visibility: hidden;
		transition: all .3s;
	}

	.navbar-menu-overlay.active {
		opacity: 1;
		visibility: visible;
	}
}

/* 桌面端隐藏移动专用元素 */
@media (min-width: 992px) {
	.navbar-mobile-lang { display: none; }
	.navbar-menu .mobile-menu-search { display: none; }
	.navbar-menu .mobile-menu-cta { display: none; }
	.navbar-menu .mobile-menu-info { display: none; }
}
