/**
 * V2 Header Search — 下拉面板及内部元素（输入框由主题 style.css 接管）
 */

.hcm-v2-search__input-wrap {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
}

/* 下拉面板 */
.hcm-v2-search__dropdown {
	position: absolute;
	top: 120%;
	right: 0;
	width: 500px;
	max-width: calc(100vw - 24px);
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
	padding: 20px;
	z-index: 9999;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-10px);
	transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
	box-sizing: border-box;
}

.hcm-v2-search__dropdown.is-open {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

/* Tabs 样式 */
.hcm-v2-search__tabs {
	display: flex;
	gap: 8px;
	margin-bottom: 24px;
	padding-bottom: 16px;
	border-bottom: 1px solid #f1f1f1;
	overflow-x: auto;
	scrollbar-width: none;
}

.hcm-v2-search__tabs::-webkit-scrollbar {
	display: none;
}

.hcm-v2-tab {
	white-space: nowrap;
	padding: 5px 16px;
	font-size: 14px;
	font-weight: 500;
	border-radius: 20px;
	cursor: pointer;
	background: #fff;
	border: 1px solid #e0e0e0;
	color: #333;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.hcm-v2-tab.active {
	background: #111;
	color: #fff;
	border-color: #111;
}

.hcm-v2-tab:focus:not(:focus-visible) {
	outline: none;
}

.hcm-v2-tab:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(31, 185, 99, 0.15);
}

/* 热门搜索标题与 Chips */
.hcm-v2-search__title {
	font-size: 16px;
	font-weight: 600;
	margin: 0 0 16px;
	color: #111;
}

.hcm-v2-search__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.hcm-v2-chip {
	display: flex;
	align-items: center;
	gap: 6px;
	background: #f5f5f5;
	padding: 8px 12px;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 500;
	color: #333;
	cursor: pointer;
}

.hcm-v2-chip:hover {
	background: #e8e8e8;
}

.hcm-v2-chip__icon {
	flex-shrink: 0;
}

/* 加载 / 空状态 */
.hcm-v2-search__loading,
.hcm-v2-search__empty {
	padding: 32px 16px;
	text-align: center;
	color: #888;
	font-size: 14px;
}

.hcm-v2-search__loading::after {
	content: '';
	display: inline-block;
	width: 18px;
	height: 18px;
	margin-left: 8px;
	border: 2px solid #ddd;
	border-top-color: #111;
	border-radius: 50%;
	animation: hcm-v2-search-spin 0.7s linear infinite;
	vertical-align: middle;
}

@keyframes hcm-v2-search-spin {
	to {
		transform: rotate(360deg);
	}
}

/* 修正结果区滚动条位置 */
.hcm-v2-search__results {
	max-height: 400px;
	overflow-y: auto;
	/* 利用负边距向右拉伸，抵消外层的 padding */
	margin-right: -20px;
	/* 将内容重新推回正常位置，让出滚动条空间 */
	padding-right: 20px;
}

/* 自定义 Webkit 滚动条样式 (大厂标配) */
.hcm-v2-search__results::-webkit-scrollbar {
	width: 6px; /* 极细滚动条 */
}

.hcm-v2-search__results::-webkit-scrollbar-track {
	background: transparent; /* 轨道透明 */
}

.hcm-v2-search__results::-webkit-scrollbar-thumb {
	background-color: #d1d5db; /* 浅灰色滑块 */
	border-radius: 10px; /* 圆角滑块 */
}

.hcm-v2-search__results::-webkit-scrollbar-thumb:hover {
	background-color: #9ca3af; /* 悬停时加深 */
}

/* FotMob 分组赛程列表 */
.hcm-v2-search-group {
	margin-bottom: 20px;
}

.hcm-v2-search-group:last-child {
	margin-bottom: 0;
}

.hcm-v2-search-group__head {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 10px;
	font-size: 13px;
	font-weight: 600;
	color: #666;
}

.hcm-v2-search-group__logo {
	width: 18px;
	height: 18px;
	object-fit: contain;
	flex-shrink: 0;
}

.hcm-v2-search-match {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 8px;
	border-radius: 10px;
	text-decoration: none;
	color: inherit;
	transition: background 0.15s ease;
}

.hcm-v2-search-match:hover {
	background: #f5f5f5;
}

.hcm-v2-search-match__teams {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.hcm-v2-search-match__row {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.hcm-v2-search-match__row img {
	width: 18px;
	height: 18px;
	object-fit: contain;
	flex-shrink: 0;
}

.hcm-v2-search-match__name {
	font-size: 14px;
	font-weight: 500;
	color: #111;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.hcm-v2-search-match__meta {
	flex-shrink: 0;
	text-align: right;
	min-width: 52px;
}

.hcm-v2-search-match__score {
	font-size: 15px;
	font-weight: 700;
	color: #111;
	line-height: 1.2;
}

.hcm-v2-search-match__status {
	font-size: 11px;
	color: #888;
	margin-top: 2px;
}

html.dark-mode .hcm-v2-search-match:hover,
body.dark-mode .hcm-v2-search-match:hover {
	background: rgba(255, 255, 255, 0.06);
}

html.dark-mode .hcm-v2-search-match__name,
html.dark-mode .hcm-v2-search-match__score,
body.dark-mode .hcm-v2-search-match__name,
body.dark-mode .hcm-v2-search-match__score {
	color: #fff;
}

html.dark-mode .hcm-v2-search-group__head,
body.dark-mode .hcm-v2-search-group__head {
	color: #aaa;
}

/* FotMob 球员列表 */
.hcm-v2-search__player-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 0;
	cursor: pointer;
	transition: background 0.2s;
	text-decoration: none;
	color: inherit;
}

.hcm-v2-search__player-item:hover {
	background: #f9fafb;
	border-radius: 8px;
}

.hcm-v2-search__player-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	object-fit: cover;
	background: #f1f1f1;
	flex-shrink: 0;
}

.hcm-v2-search__player-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.hcm-v2-search__player-name {
	font-size: 15px;
	color: #111;
	font-weight: 500;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.hcm-v2-search__player-team {
	font-size: 13px;
	color: #666;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

html.dark-mode .hcm-v2-search__player-item:hover,
body.dark-mode .hcm-v2-search__player-item:hover {
	background: rgba(255, 255, 255, 0.06);
}

html.dark-mode .hcm-v2-search__player-name,
body.dark-mode .hcm-v2-search__player-name {
	color: #fff;
}

html.dark-mode .hcm-v2-search__player-team,
body.dark-mode .hcm-v2-search__player-team {
	color: #aaa;
}

/* FotMob 联赛列表 */
.hcm-v2-search__league-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 0;
	cursor: pointer;
	transition: background 0.2s;
	text-decoration: none;
	color: inherit;
}

.hcm-v2-search__league-item:hover {
	background: #f9fafb;
	border-radius: 8px;
}

.hcm-v2-search__league-logo {
	width: 32px;
	height: 32px;
	object-fit: contain;
	flex-shrink: 0;
	background: #f1f1f1;
	border-radius: 4px;
}

.hcm-v2-search__league-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.hcm-v2-search__league-name {
	font-size: 15px;
	color: #111;
	font-weight: 500;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.hcm-v2-search__league-country {
	font-size: 13px;
	color: #666;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

html.dark-mode .hcm-v2-search__league-item:hover,
body.dark-mode .hcm-v2-search__league-item:hover {
	background: rgba(255, 255, 255, 0.06);
}

html.dark-mode .hcm-v2-search__league-name,
body.dark-mode .hcm-v2-search__league-name {
	color: #fff;
}

html.dark-mode .hcm-v2-search__league-country,
body.dark-mode .hcm-v2-search__league-country {
	color: #aaa;
}

/* FotMob 球队列表 */
.hcm-v2-search__team-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 0;
	cursor: pointer;
	transition: background 0.2s;
	text-decoration: none;
	color: inherit;
}

.hcm-v2-search__team-item:hover {
	background: #f9fafb;
	border-radius: 8px;
}

.hcm-v2-search__team-logo {
	width: 32px;
	height: 32px;
	object-fit: contain;
	flex-shrink: 0;
	background: transparent;
}

.hcm-v2-search__team-info {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 2px;
	min-width: 0;
}

.hcm-v2-search__team-name {
	font-size: 15px;
	color: #111;
	font-weight: 500;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.hcm-v2-search__team-league {
	font-size: 13px;
	color: #666;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

html.dark-mode .hcm-v2-search__team-item:hover,
body.dark-mode .hcm-v2-search__team-item:hover {
	background: rgba(255, 255, 255, 0.06);
}

html.dark-mode .hcm-v2-search__team-name,
body.dark-mode .hcm-v2-search__team-name {
	color: #fff;
}

html.dark-mode .hcm-v2-search__team-league,
body.dark-mode .hcm-v2-search__team-league {
	color: #aaa;
}

html.dark-mode .hcm-v2-search__dropdown,
body.dark-mode .hcm-v2-search__dropdown {
	background: var(--hcm-bg-card, #1a1a1a);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

html.dark-mode .hcm-v2-search__title,
body.dark-mode .hcm-v2-search__title {
	color: var(--hcm-text-main, #fff);
}

html.dark-mode .hcm-v2-tab,
body.dark-mode .hcm-v2-tab {
	background: transparent;
	border-color: rgba(255, 255, 255, 0.15);
	color: var(--hcm-text-main, #fff);
}

html.dark-mode .hcm-v2-tab.active,
body.dark-mode .hcm-v2-tab.active {
	background: #fff;
	color: #111;
	border-color: #fff;
}

html.dark-mode .hcm-v2-chip,
body.dark-mode .hcm-v2-chip {
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
}

html.dark-mode .hcm-v2-chip:hover,
body.dark-mode .hcm-v2-chip:hover {
	background: rgba(255, 255, 255, 0.14);
}

html.dark-mode .hcm-v2-search__tabs,
body.dark-mode .hcm-v2-search__tabs {
	border-bottom-color: rgba(255, 255, 255, 0.12);
}

html.dark-mode .hcm-v2-tab:hover:not(.active),
body.dark-mode .hcm-v2-tab:hover:not(.active) {
	background: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.15);
	color: var(--hcm-text-main, #fff);
}

html.dark-mode .hcm-v2-chip__icon path,
body.dark-mode .hcm-v2-chip__icon path {
	fill: #aaa;
}

html.dark-mode .hcm-v2-search__loading,
html.dark-mode .hcm-v2-search__empty,
body.dark-mode .hcm-v2-search__loading,
body.dark-mode .hcm-v2-search__empty {
	color: #888;
}

html.dark-mode .hcm-v2-search__loading::after,
body.dark-mode .hcm-v2-search__loading::after {
	border-color: rgba(255, 255, 255, 0.15);
	border-top-color: #fff;
}

html.dark-mode .hcm-v2-search__results,
body.dark-mode .hcm-v2-search__results {
	scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

html.dark-mode .hcm-v2-search__results::-webkit-scrollbar-thumb,
body.dark-mode .hcm-v2-search__results::-webkit-scrollbar-thumb {
	background-color: rgba(255, 255, 255, 0.22);
}

html.dark-mode .hcm-v2-search__results::-webkit-scrollbar-thumb:hover,
body.dark-mode .hcm-v2-search__results::-webkit-scrollbar-thumb:hover {
	background-color: rgba(255, 255, 255, 0.32);
}

html.dark-mode .hcm-v2-search-wrapper.is-mobile-active,
body.dark-mode .hcm-v2-search-wrapper.is-mobile-active {
	background: var(--hcm-bg-card, #1a1a1a) !important;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
}

html.dark-mode .hcm-v2-search-wrapper.is-mobile-active .hcm-header__search-form,
html.dark-mode .hcm-v2-search-wrapper.is-mobile-active .hcm-header__search-form:hover,
html.dark-mode .hcm-v2-search-wrapper.is-mobile-active .hcm-header__search-form:focus-within,
body.dark-mode .hcm-v2-search-wrapper.is-mobile-active .hcm-header__search-form,
body.dark-mode .hcm-v2-search-wrapper.is-mobile-active .hcm-header__search-form:hover,
body.dark-mode .hcm-v2-search-wrapper.is-mobile-active .hcm-header__search-form:focus-within {
	background: transparent !important;
	border: none !important;
	box-shadow: none !important;
	border-radius: 0 !important;
	padding: 0 !important;
}

html.dark-mode .hcm-v2-search-wrapper.is-mobile-active .hcm-header__search-input,
body.dark-mode .hcm-v2-search-wrapper.is-mobile-active .hcm-header__search-input {
	background: rgba(255, 255, 255, 0.12) !important;
	color: #fff !important;
}

html.dark-mode .hcm-v2-search-wrapper.is-mobile-active .hcm-header__search-input::placeholder,
body.dark-mode .hcm-v2-search-wrapper.is-mobile-active .hcm-header__search-input::placeholder {
	color: rgba(255, 255, 255, 0.45) !important;
}

html.dark-mode .hcm-v2-search-wrapper.is-mobile-active .hcm-v2-search__clear,
body.dark-mode .hcm-v2-search-wrapper.is-mobile-active .hcm-v2-search__clear {
	color: rgba(255, 255, 255, 0.5) !important;
}

html.dark-mode .hcm-v2-search-wrapper.is-mobile-active .hcm-v2-search__popular,
body.dark-mode .hcm-v2-search-wrapper.is-mobile-active .hcm-v2-search__popular {
	scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

html.dark-mode .hcm-v2-search-wrapper.is-mobile-active .hcm-v2-search__popular::-webkit-scrollbar-thumb,
body.dark-mode .hcm-v2-search-wrapper.is-mobile-active .hcm-v2-search__popular::-webkit-scrollbar-thumb {
	background-color: rgba(255, 255, 255, 0.22);
}

body.hcm-search-mobile-open {
	overflow: hidden !important;
}

/* 真正的全局独立遮罩层 (直接挂在 body 下) */
.hcm-mobile-global-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background: rgba(0, 0, 0, 0.6);
	z-index: 2147483646 !important;
}

.hcm-v2-search__cancel-btn {
	display: none;
}

@media (max-width: 992px) {
	.hcm-v2-search-wrapper {
		position: relative !important;
	}

	/* 收起态：仅显示搜索图标，隐藏 input-wrap 避免挤偏图标 */
	.hcm-v2-search-wrapper:not(.is-mobile-active) .hcm-v2-search__input-wrap,
	.hcm-v2-search-wrapper:not(.is-mobile-active) .hcm-v2-search__cancel-btn {
		display: none !important;
	}

	.hcm-v2-search-wrapper:not(.is-mobile-active) .hcm-header__search-form,
	.hcm-v2-search-wrapper:not(.is-mobile-active) .hcm-header__search-form:hover,
	.hcm-v2-search-wrapper:not(.is-mobile-active) .hcm-header__search-form:focus-within {
		background: transparent !important;
		border: none !important;
		box-shadow: none !important;
	}

	.hcm-v2-search-wrapper:not(.is-mobile-active) .hcm-header__search-icon {
		margin: 0 !important;
	}

	.hcm-v2-search__dropdown {
		right: 0;
		left: auto;
		width: min(500px, calc(100vw - 24px));
	}

	/* 传送门模态框：脱离原父级，悬浮于 15px 处 */
	.hcm-v2-search-wrapper.is-mobile-active {
		position: fixed !important;
		top: 15px !important;
		left: 15px !important;
		right: 15px !important;
		width: auto !important;
		height: auto !important;
		background: var(--hcm-bg-card, #ffffff) !important;
		border-radius: 16px !important;
		padding: 16px !important;
		z-index: 2147483647 !important;
		box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3) !important;
	}

	/* 彻底粉碎原主题的 40x40 铁笼与幽灵圆形背景 */
	.hcm-v2-search-wrapper.is-mobile-active .hcm-header__search-form {
		display: flex !important;
		align-items: center !important;
		gap: 12px !important;
		width: 100% !important;
		max-width: none !important;
		min-width: 0 !important;
		height: auto !important;
		background: transparent !important;
		box-shadow: none !important;
		border: none !important;
		padding: 0 !important;
	}

	.hcm-v2-search-wrapper.is-mobile-active .hcm-header__search-icon {
		display: none !important;
	}

	.hcm-v2-search-wrapper.is-mobile-active .hcm-v2-search__input-wrap {
		flex: 1 1 auto !important;
		min-width: 0 !important;
	}

	.hcm-v2-search-wrapper.is-mobile-active .hcm-header__search-input {
		display: block !important;
		width: 100% !important;
		box-sizing: border-box !important;
		background: #f1f1f1 !important;
		border: none !important;
		border-radius: 8px !important;
		padding: 10px 36px 10px 15px !important;
		font-size: 16px !important;
		outline: none !important;
	}

	.hcm-v2-search-wrapper.is-mobile-active .hcm-v2-search__input-wrap:focus-within {
		border-radius: 8px;
		box-shadow: 0 0 0 3px rgba(31, 185, 99, 0.15);
	}

	.hcm-v2-search-wrapper.is-mobile-active .hcm-v2-search__input-wrap:focus-within .hcm-header__search-input {
		outline: none !important;
		box-shadow: none !important;
	}

	.hcm-v2-search-wrapper.is-mobile-active .hcm-v2-search__clear {
		position: absolute !important;
		right: 8px !important;
		top: 50% !important;
		transform: translateY(-50%) !important;
		width: 28px !important;
		height: 28px !important;
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;
		z-index: 2 !important;
		cursor: pointer !important;
		margin: 0 !important;
	}

	.hcm-v2-search-wrapper.is-mobile-active .hcm-v2-search__clear[style*="display: none"] {
		display: none !important;
	}

	.hcm-v2-search-wrapper.is-mobile-active .hcm-v2-search__cancel-btn {
		display: block !important;
		flex-shrink: 0 !important;
		background: none !important;
		border: none !important;
		padding: 0 !important;
		color: #27ae60 !important;
		font-size: 15px !important;
		font-weight: 500 !important;
		cursor: pointer !important;
	}

	/* 下拉区限高 35vh：Tabs 固定，仅分割线以下 results/popular 滚动 */
	.hcm-v2-search-wrapper.is-mobile-active .hcm-v2-search__dropdown {
		position: static !important;
		width: 100% !important;
		box-shadow: none !important;
		padding: 16px 0 0 0 !important;
		display: flex !important;
		flex-direction: column !important;
		opacity: 1 !important;
		visibility: visible !important;
		transform: none !important;
		max-height: 35vh !important;
		overflow: hidden !important;
	}

	.hcm-v2-search-wrapper.is-mobile-active .hcm-v2-search__tabs {
		flex-shrink: 0 !important;
		overflow-x: auto !important;
		scrollbar-width: none !important;
		-ms-overflow-style: none !important;
	}

	.hcm-v2-search-wrapper.is-mobile-active .hcm-v2-search__tabs::-webkit-scrollbar {
		display: none !important;
		width: 0 !important;
		height: 0 !important;
	}

	.hcm-v2-search-wrapper.is-mobile-active .hcm-v2-search__popular,
	.hcm-v2-search-wrapper.is-mobile-active .hcm-v2-search__results {
		flex: 1 1 auto !important;
		min-height: 0 !important;
		max-height: none !important;
		overflow-x: hidden !important;
		overflow-y: auto !important;
		margin-right: 0 !important;
		padding-right: 0 !important;
		-webkit-overflow-scrolling: touch;
	}
}
