/* ==============================================
   表头表尾公共样式 - touwei.css
   用于全站统一维护表头、导航、公告栏、页脚、主题切换、返回按钮等公共组件
   ============================================== */

/* ========== 公共CSS变量（表头表尾相关） ========== */
:root {
	--header-logo-border: #2980b9;
	--header-logo-bg-gradient: linear-gradient(135deg, rgba(52, 152, 219, 0.1), rgba(44, 62, 80, 0.1));
	--switch-bg: #e0e0e0;
	--switch-btn: #ffffff;
	--backtop-bg: #3498db;
	--backtop-hover-bg: #2980b9;
	--backtop-text: #ffffff;
	--backtop-shadow: rgba(0, 0, 0, 0.2);
	--footer-bg: #ffffff;
	--footer-text: #7f8c8d;
	--footer-border: #e6e6e6;
	--baise:#666;
	--announcement-bg: rgba(52, 152, 219, 0.12);
	--announcement-border: rgba(52, 152, 219, 0.3);
	--announcement-text: var(--title-color);
}

/* 夜间模式变量覆盖 */
.dark-mode {
	--header-logo-border: #4cc9f0;
	--header-logo-bg-gradient: linear-gradient(135deg, rgba(76, 201, 240, 0.1), rgba(22, 33, 62, 0.1));
	--footer-bg: #16213e;
	--footer-text: #a0a8b0;
	--footer-border: #253759;
	--bg-color: #1a1a2e;
	--card-bg: #16213e;
	--baise:#ffffff66;
	--announcement-bg: rgba(76, 201, 240, 0.1);
	--announcement-border: rgba(76, 201, 240, 0.25);
	--announcement-text: var(--title-color);
}

/* ========== body基础样式（为固定表头留出空间） ========== */
body {
	padding-top: 88px;
}

/* ========== 固定表头样式 ========== */
.header-fixed {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	background-color: var(--card-bg);
	border-bottom: 2px solid var(--border-color);
	display: flex;
	flex-direction: column;
	z-index: 9999;
	box-shadow: 0 2px 8px var(--shadow-color);
	transition: all 0.3s ease;
	overflow: visible;
}

.header-container {
	max-width: 1200px;
	width: 100%;
	margin: 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 60px;
	padding: 0 20px;
	position: relative;
	overflow: visible;
}

/* ========== 顶部滚动公告栏样式 ========== */
.header-announcement {
	width: 100%;
	height: 28px;
	background: var(--announcement-bg);
	border-top: 1px solid var(--announcement-border);
	overflow: hidden;
	direction: ltr;
}

.announcement-inner {
	max-width: 1200px;
	margin: 0 auto;
	height: 100%;
	display: flex;
	align-items: center;
	padding: 0 20px;
	gap: 10px;
}

.announcement-icon {
	color: var(--header-logo-border);
	font-size: 12px;
	flex-shrink: 0;
	animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
	0%, 100% { transform: scale(1); opacity: 1; }
	50% { transform: scale(1.2); opacity: 0.8; }
}

.announcement-scroll {
	flex: 1;
	height: 100%;
	overflow: hidden;
	position: relative;
}

.announcement-content {
	display: flex;
	white-space: nowrap;
	position: absolute;
	left: 0;
	top: 0;
	height: 100%;
	align-items: center;
}

.announcement-text {
	font-size: 12px;
	color: var(--announcement-text);
	line-height: 28px;
	padding-right: 80px;
	font-weight: 500;
}

/* 公告关闭按钮 */
.announcement-close {
	flex-shrink: 0;
	width: 18px;
	height: 18px;
	border: none;
	background: transparent;
	color: var(--announcement-text);
	opacity: 0.6;
	cursor: pointer;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	padding: 0;
	transition: all 0.2s ease;
	margin-left: 8px;
}

.announcement-close:hover {
	opacity: 1;
	background: rgba(231, 76, 60, 0.2);
	color: #e74c3c;
	transform: scale(1.1);
}

/* 鼠标悬停暂停 */
.header-announcement:hover .announcement-content {
	animation-play-state: paused;
}

/* 表头Logo样式 */
.header-logo-wrapper {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 4px 12px;
	background: var(--header-logo-bg-gradient);
	border: 2px solid var(--header-logo-border);
	border-radius: 8px;
	position: relative;
	overflow: hidden;
	height: 80%;
	
}

.header-logo-img {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid var(--border-color);
}

.header-logo-text {
	font-family: "Comic Sans MS", "Microsoft Yahei", sans-serif;
	font-size: 14px;
	font-weight: 700;
	color: var(--title-color);
	text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
	white-space: nowrap;
	text-decoration: none;
}

/* 表头夜间模式切换容器 */
.header-theme-switch {
	display: flex;
	align-items: center;
	gap: 5px;
	transform: scale(0.85);
}

/* ========== 主题切换开关样式 ========== */
.theme-switch {
	position: relative;
	display: inline-block;
	width: 60px;
	height: 30px;
}

.theme-switch input {
	opacity: 0;
	width: 0;
	height: 0;
}

.slider {
	position: absolute;
	cursor: pointer;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: var(--switch-bg);
	transition: .4s;
	border-radius: 30px;
}

.slider:before {
	position: absolute;
	content: "";
	height: 22px;
	width: 22px;
	left: 4px;
	bottom: 4px;
	background-color: var(--switch-btn);
	transition: .4s;
	border-radius: 50%;
}

input:checked+.slider:before {
	transform: translateX(30px);
}

.switch-label {
	margin-right: 10px;
	line-height: 30px;
	color: var(--text-color);
	font-size: 17px;
}

/* ========== 二级主导航样式 ========== */
.main-nav {
	display: flex;
	align-items: center;
	flex: 1;
	justify-content: center;
	height: 100%;
	position: relative;
	overflow: visible;
}

.nav-list {
	display: flex;
	align-items: center;
	list-style: none;
	margin: 0;
	padding: 0;
	gap: 4px;
	height: 100%;
}

.nav-item {
	position: relative;
	height: 100%;
	display: flex;
	align-items: center;
}

.nav-link {
	display: flex;
	align-items: center;
	gap: 5px;
	padding: 8px 16px;
	color: var(--title-color);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	border-radius: 6px;
	transition: all 0.25s ease;
	cursor: pointer;
	white-space: nowrap;
	height: 100%;
}

.nav-link:hover {
	color: var(--border-color);
	background-color: var(--header-logo-bg-gradient);
}

.nav-link.active {
	color: var(--border-color);
	background-color: rgba(52, 152, 219, 0.1);
}

.nav-arrow {
	font-size: 10px;
	transition: transform 0.25s ease;
}

.nav-item:hover .nav-arrow {
	transform: rotate(180deg);
}

/* 二级下拉菜单 */
.submenu {
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%) translateY(8px);
	min-width: 180px;
	background-color: var(--card-bg);
	border: 1px solid var(--border-color);
	border-radius: 8px;
	box-shadow: 0 8px 24px var(--shadow-color);
	padding: 8px 0;
	list-style: none;
	margin: 0;
	opacity: 0;
	visibility: hidden;
	transition: all 0.25s ease;
	z-index: 10000;
}

.nav-item:hover .submenu {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(0);
}

.submenu-item {
	position: relative;
}

.submenu-link {
	display: block;
	padding: 10px 16px;
	color: var(--text-color);
	font-size: 13px;
	text-decoration: none;
	transition: all 0.2s ease;
	white-space: nowrap;
}

.submenu-link:hover {
	background-color: var(--info-bar-bg);
	color: var(--border-color);
	padding-left: 20px;
}

.submenu-link.active {
	color: var(--border-color);
	font-weight: 600;
	background-color: var(--info-bar-bg);
}

/* 移动端汉堡菜单按钮 */
.mobile-menu-btn {
	display: none;
	width: 40px;
	height: 40px;
	border: none;
	background: transparent;
	color: var(--title-color);
	font-size: 20px;
	cursor: pointer;
	border-radius: 6px;
	transition: all 0.2s ease;
	align-items: center;
	justify-content: center;
}

.mobile-menu-btn:hover {
	background-color: var(--info-bar-bg);
	color: var(--border-color);
}

/* 移动端导航遮罩 */
.mobile-nav-overlay {
	position: fixed;
	top: 88px;
	left: 0;
	width: 100%;
	height: calc(100vh - 88px);
	background-color: rgba(0, 0, 0, 0.5);
	z-index: 998;
	opacity: 0;
	visibility: hidden;
	transition: all 0.3s ease;
}

.mobile-nav-overlay.show {
	opacity: 1;
	visibility: visible;
}

/* ========== Toast提示样式 ========== */
.nav-toast {
	position: fixed;
	top: 100px;
	left: 50%;
	transform: translateX(-50%) translateY(-20px);
	background-color: var(--card-bg);
	color: var(--title-color);
	padding: 12px 24px;
	border-radius: 8px;
	box-shadow: 0 4px 16px var(--shadow-color);
	border-left: 4px solid var(--category-color);
	font-size: 14px;
	font-weight: 500;
	z-index: 10001;
	opacity: 0;
	visibility: hidden;
	transition: all 0.3s ease;
	display: flex;
	align-items: center;
	gap: 10px;
}

.nav-toast.show {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(0);
}

.nav-toast i {
	color: var(--category-color);
	font-size: 18px;
}

/* ========== 返回顶部/首页按钮样式 ========== */
.back-to-top {
	position: fixed;
	bottom: 30px;
	right: 30px;
	width: 50px;
	height: 50px;
	border-radius: 50%;
	background-color: var(--backtop-bg);
	color: var(--backtop-text);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	cursor: pointer;
	box-shadow: 0 2px 8px var(--backtop-shadow);
	transition: all 0.3s ease;
	opacity: 0;
	visibility: hidden;
	z-index: 999;
	border: none;
	outline: none;
}

.back-to-top.show {
	opacity: 1;
	visibility: visible;
}

.back-to-top:hover {
	background-color: var(--backtop-hover-bg);
	transform: translateY(-3px);
	box-shadow: 0 4px 12px var(--backtop-shadow);
}

.back-to-home {
	position: fixed;
	bottom: 90px;
	right: 30px;
	width: 50px;
	height: 50px;
	border-radius: 50%;
	background-color: #2ecc71;
	color: white;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	transition: all 0.3s ease;
	z-index: 998;
	border: none;
	outline: none;
}

.back-to-home:hover {
	background-color: #27ae60;
	transform: translateY(-3px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ========== 页脚样式 ========== */
.footer {
	background-color: var(--footer-bg);
	border-top: 1px solid var(--footer-border);
	color: var(--footer-text);
	padding: 15px 0;
	margin-top: 30px;
	font-size: 8px;
	width: 100%;
}

.footer-container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 20px;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 10px 20px;
	text-align: center;
}

.footer-item {
	display: flex;
	align-items: center;
	gap: 5px;
}

.footer-item i {
	color: var(--border-color);
	font-size: 14px;
}

.footer a {
	color: var(--border-color);
	text-decoration: none;
	transition: color 0.2s ease;
}

.footer a:hover {
	color: var(--category-color);
	text-decoration: underline;
}

/* ========== 响应式：平板端 ========== */
@media (max-width: 900px) {
	body {
		padding-top: 82px;
	}

	.mobile-menu-btn {
		display: flex;
	}

	.nav-list {
		position: fixed;
		top: 82px;
		right: -280px;
		width: 280px;
		height: calc(100vh - 82px);
		background-color: var(--card-bg);
		flex-direction: column;
		align-items: stretch;
		padding: 16px;
		gap: 8px;
		box-shadow: -4px 0 16px var(--shadow-color);
		transition: right 0.3s ease;
		overflow-y: auto;
		z-index: 999;
	}

	.nav-list.mobile-open {
		right: 0;
	}

	.nav-item {
		height: auto;
		flex-direction: column;
		align-items: stretch;
	}

	.nav-link {
		height: auto;
		padding: 12px 16px;
		justify-content: space-between;
		border-radius: 6px;
	}

	.nav-link:hover {
		background-color: var(--info-bar-bg);
	}

	.submenu {
		position: static;
		transform: none;
		min-width: 100%;
		border: none;
		box-shadow: none;
		padding: 0 0 0 16px;
		margin: 0;
		opacity: 1;
		visibility: visible;
		max-height: 0;
		overflow: hidden;
		transition: max-height 0.3s ease;
		background-color: transparent;
	}

	.nav-item.submenu-open .submenu {
		max-height: 500px;
	}

	.nav-item:hover .submenu {
		transform: none;
	}

	.nav-item.submenu-open .nav-arrow {
		transform: rotate(180deg);
	}

	.submenu-link {
		padding: 10px 16px;
		font-size: 13px;
	}

	.submenu-link:hover {
		padding-left: 20px;
	}

	/* 移动端公告栏 */
	.header-announcement {
		height: 22px;
	}
	.announcement-text {
		font-size: 11px;
		line-height: 22px;
	}
	.announcement-icon {
		font-size: 10px;
	}
	.announcement-close {
		width: 16px;
		height: 16px;
		font-size: 10px;
	}
	.header-container {
		height: 60px;
	}
	.mobile-nav-overlay {
		top: 82px;
		height: calc(100vh - 82px);
	}
}

/* ========== 响应式：手机端 ========== */
@media (max-width: 768px) {
	.footer-container {
		gap: 5px 20px;
	}

	.footer,
	.footer-item i {
		font-size: 6px;
	}

	.back-to-top,
	.back-to-home {
		width: 45px;
		height: 45px;
		font-size: 20px;
		right: 20px;
	}

	.back-to-home {
		bottom: 80px;
	}

	/* 响应式适配表头 */
	.header-logo-text {
		font-size: 10px;
	}

	.header-logo-img {
		width: 26px;
		height: 26px;
	}

	.header-logo-wrapper {
		padding: 3px 8px;
		height: 70%;
	}

	/* 响应式适配表头夜间模式 */
	.header-theme-switch {
		transform: scale(0.8);
	}

	.header-theme-switch .switch-label {
		font-size: 11px;
	}

	.header-theme-switch .theme-switch {
		width: 50px;
		height: 26px;
	}

	.header-theme-switch .slider:before {
		height: 18px;
		width: 18px;
	}
}

/* ========== 响应式：小屏手机 ========== */
@media (max-width: 480px) {
	.back-to-top,
	.back-to-home {
		width: 30px;
		height: 30px;
		font-size: 14px;
		right: 8%;
	}

	.back-to-home {
		bottom: 75px;
	}

	/* 响应式适配表头 */
	.header-logo-text {
		font-size: 8px;
	}

	.header-logo-img {
		width: 24px;
		height: 24px;
	}

	.header-logo-wrapper {
		padding: 2px 6px;
		gap: 5px;
	}

	/* 移动端表头夜间模式优化 */
	.header-theme-switch {
		transform: scale(0.75);
		margin-left: 0;
	}
}