/* Directindustry Web Guide - 前台导航页样式（独立于主题） */

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

:root {
	--dwg-sidebar-w: 220px;
	--dwg-bg: #f5f6fa;
	--dwg-sidebar-bg: #2c2e2f;
	--dwg-sidebar-text: #b4b6b8;
	--dwg-primary: #3273dc;
	--dwg-card-bg: #ffffff;
	--dwg-text: #333333;
	--dwg-text-light: #999999;
	--dwg-title: #666666;
	--dwg-border: #e8e8e8;
}

/* 深色（黑）模式 */
body.dwg-body.dwg-dark {
	--dwg-bg: #151617;
	--dwg-sidebar-bg: #0f1011;
	--dwg-sidebar-text: #9a9c9e;
	--dwg-card-bg: #232425;
	--dwg-text: #e6e6e6;
	--dwg-text-light: #8a8c8e;
	--dwg-title: #9a9c9e;
	--dwg-border: #2e2f30;
}

/* 深色模式下的局部覆盖 */
body.dwg-body.dwg-dark .dwg-card-logo-text {
	background: linear-gradient(135deg, #3a3b3c, #4a4b4c);
	color: #cfcfcf;
}

body.dwg-body.dwg-dark .dwg-card {
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

body.dwg-body.dwg-dark .dwg-card:hover {
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

body.dwg-body.dwg-dark .dwg-to-top {
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

/* 主题切换按钮（iOS 滑块开关，参考 sunndy.top） */
.dwg-theme-toggle,
.dwg-theme-toggle-m {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
	touch-action: manipulation;
}

.dwg-theme-track {
	display: block;
	width: 40px;
	height: 22px;
	background: #555555;
	border-radius: 11px;
	position: relative;
	transition: background 0.2s ease;
}

.dwg-theme-thumb {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 16px;
	height: 16px;
	background: #ffffff;
	border-radius: 50%;
	transition: transform 0.2s ease;
}

body.dwg-body.dwg-dark .dwg-theme-track {
	background: #888888;
}

body.dwg-body.dwg-dark .dwg-theme-thumb {
	transform: translateX(18px);
}

.dwg-theme-toggle-m {
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
}

html {
	scroll-behavior: smooth;
	scroll-padding-top: 20px;
}

body.dwg-body {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
	background: var(--dwg-bg);
	color: var(--dwg-text);
	font-size: 14px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

/* ---------- 侧边栏 ---------- */
.dwg-sidebar {
	position: fixed;
	left: 0;
	top: 0;
	bottom: 0;
	width: var(--dwg-sidebar-w);
	background: var(--dwg-sidebar-bg);
	overflow-y: auto;
	z-index: 100;
	transition: transform 0.3s ease;
}

.dwg-sidebar::-webkit-scrollbar {
	width: 4px;
}

.dwg-sidebar::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.15);
	border-radius: 2px;
}

.dwg-logo {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 70px;
	padding: 16px 20px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
	color: inherit;
	text-decoration: none;
	cursor: pointer;
}

.dwg-logo img {
	max-width: 145px;
	max-height: 48px;
	object-fit: contain;
}

.dwg-logo-text {
	color: #fff;
	font-size: 20px;
	font-weight: 700;
	letter-spacing: 1px;
}

.dwg-menu > ul {
	list-style: none;
	padding: 10px 0 30px;
}

.dwg-menu-link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 24px;
	color: var(--dwg-sidebar-text);
	text-decoration: none;
	font-size: 14px;
	transition: all 0.2s ease;
	border-left: 3px solid transparent;
}

.dwg-menu-link:hover,
.dwg-menu-link.active {
	color: #ffffff;
	background: rgba(255, 255, 255, 0.06);
	border-left-color: currentColor;
}

.dwg-menu-label {
	flex: 1;
	min-width: 0;
	text-align: left;
}

.dwg-menu-arrow {
	margin-left: auto;
	font-size: 18px;
	line-height: 1;
	opacity: 0.55;
	transition: transform 0.2s ease, opacity 0.2s ease;
}

.dwg-menu-link:hover .dwg-menu-arrow,
.dwg-menu-link.active .dwg-menu-arrow {
	opacity: 1;
	transform: translateX(3px);
}

/* ---------- 两级菜单：一级菜单（可折叠） + 二级菜单 ---------- */
.dwg-menu-group {
	position: relative;
}

.dwg-menu-parent {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 12px 24px;
	background: none;
	border: none;
	border-left: 3px solid transparent;
	color: var(--dwg-sidebar-text);
	font-size: 14px;
	text-align: left;
	cursor: pointer;
	transition: all 0.2s ease;
	font-family: inherit;
}

.dwg-menu-parent:hover,
.dwg-menu-parent.active {
	color: #ffffff;
	background: rgba(255, 255, 255, 0.06);
	border-left-color: currentColor;
}

.dwg-menu-icon {
	flex: 0 0 18px;
	width: 18px;
	height: 18px;
	display: inline-flex;
}

.dwg-menu-icon svg {
	width: 18px;
	height: 18px;
}

.dwg-caret {
	margin-left: auto;
	font-size: 18px;
	line-height: 1;
	opacity: 0.55;
	transition: transform 0.2s ease, opacity 0.2s ease;
}

.dwg-menu-parent:hover .dwg-caret,
.dwg-menu-parent.active .dwg-caret {
	opacity: 1;
}

.dwg-menu-group.open > .dwg-menu-parent .dwg-caret {
	transform: rotate(90deg);
}

.dwg-submenu {
	list-style: none;
	display: none;
	padding: 0;
}

.dwg-menu-group.open > .dwg-submenu {
	display: block;
}

.dwg-submenu .dwg-menu-link {
	padding-left: 44px;
	font-size: 13px;
}

/* 展开态：加深一级菜单（按钮）与其下属二级菜单的背景，做出区分与聚焦 */
.dwg-menu-group.open > .dwg-menu-parent {
	background: rgba(0, 0, 0, 0.30);
	color: #ffffff;
}

.dwg-menu-group.open > .dwg-menu-parent:hover {
	background: rgba(0, 0, 0, 0.38);
}

.dwg-menu-group.open > .dwg-submenu .dwg-menu-link {
	background: rgba(0, 0, 0, 0.16);
}

.dwg-menu-group.open > .dwg-submenu .dwg-menu-link:hover {
	background: rgba(0, 0, 0, 0.28);
}

.dwg-section-icon {
	flex: 0 0 18px;
	width: 18px;
	height: 18px;
	display: inline-flex;
}

.dwg-section-icon svg {
	width: 18px;
	height: 18px;
}

/* ---------- 主内容 ---------- */
.dwg-main {
	margin-left: var(--dwg-sidebar-w);
	padding: 24px 28px 40px;
	min-height: 100vh;
}

.dwg-search-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 24px;
}

.dwg-search-bar {
	display: flex;
	align-items: center;
	gap: 0;
	max-width: 560px;
	flex: 1;
	min-width: 0;
	height: 42px;
	padding: 0 4px 0 18px;
	border: 1px solid var(--dwg-border);
	border-radius: 21px;
	background: var(--dwg-card-bg);
	transition: border-color 0.2s, box-shadow 0.2s;
}

.dwg-search-bar:focus-within {
	border-color: #c9c9c9;
	box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.dwg-search-bar input {
	flex: 1;
	min-width: 0;
	height: 100%;
	padding: 0;
	border: none;
	background: transparent;
	font-size: 16px;
	color: var(--dwg-text);
	outline: none;
}

.dwg-search-btn {
	flex: 0 0 auto;
	height: 34px;
	padding: 0 20px;
	border: none;
	border-radius: 17px;
	background: var(--dwg-sidebar-bg);
	color: #ffffff;
	font-size: 14px;
	cursor: pointer;
	transition: opacity 0.2s ease;
}

.dwg-search-btn:hover {
	opacity: 0.85;
}

.dwg-search-clear {
	display: none;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	margin-right: 6px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: transparent;
	color: var(--dwg-text);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	opacity: 0.55;
	transition: opacity 0.2s ease, background 0.2s ease;
}

.dwg-search-clear:hover {
	opacity: 1;
	background: rgba(127, 127, 127, 0.15);
}

.dwg-search-clear.dwg-show {
	display: inline-flex;
}

/* 一级菜单分组（主内容区） */
.dwg-group {
	margin-bottom: 42px;
}

.dwg-section {
	margin-bottom: 14px;
}

.dwg-section-title {
	font-size: 17px;
	font-weight: 400;
	margin-bottom: 14px;
	padding-left: 0;
	color: var(--dwg-title);
	display: flex;
	align-items: center;
	gap: 6px;
}

.dwg-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	gap: 26px;
}

/* 宽屏：强制最多 6 列并拉满整行；窄屏由 auto-fill 自动减列，不溢出 */
@media (min-width: 1320px) {
	.dwg-grid {
		grid-template-columns: repeat(6, minmax(160px, 1fr));
	}
}

.dwg-card {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	background: var(--dwg-card-bg);
	border-radius: 4px;
	border: none;
	text-decoration: none;
	color: var(--dwg-text);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	overflow: hidden;
}

.dwg-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.dwg-card-logo {
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.dwg-card-logo img {
	width: 40px;
	height: 40px;
	object-fit: contain;
	border-radius: 50%;
}

.dwg-card-logo-text {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: linear-gradient(135deg, #e6e6e6, #f2f2f2);
	color: #888888;
	font-size: 18px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
}

.dwg-card-body {
	min-width: 0;
}

.dwg-card-name {
	display: block;
	font-size: 14px;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.dwg-card-desc {
	font-size: 12px;
	color: var(--dwg-text-light);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	margin-top: 2px;
}

.dwg-empty {
	color: var(--dwg-text-light);
	padding: 40px 0;
	text-align: center;
}

/* 搜索过滤 */
.dwg-card.dwg-hide,
.dwg-section.dwg-hide {
	display: none;
}

/* ---------- 页脚 ---------- */
.dwg-footer {
	margin-top: 40px;
	padding: 20px 0;
	border-top: 1px solid var(--dwg-border);
	color: var(--dwg-text-light);
	font-size: 13px;
	text-align: center;
}

.dwg-footer a {
	color: var(--dwg-text-light);
}

/* 独立页脚文字模块（版权信息） */
.dwg-site-footer {
	margin-top: 48px;
	padding: 22px 24px;
	border-top: 1px solid var(--dwg-border);
	background: var(--dwg-card-bg);
	color: var(--dwg-text-light);
	font-size: 13px;
	line-height: 1.8;
}

.dwg-site-footer-inner {
	max-width: 100%;
	text-align: center;
}

.dwg-site-footer p {
	margin: 0 0 6px;
}

.dwg-site-footer p:last-child {
	margin-bottom: 0;
}

.dwg-site-footer a {
	color: var(--dwg-text);
	text-decoration: none;
}

.dwg-site-footer a:hover {
	text-decoration: underline;
}

/* 回到顶部按钮 */
.dwg-to-top {
	position: fixed;
	right: 30px;
	bottom: 30px;
	z-index: 120;
	width: 42px;
	height: 42px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: 3px;
	background: var(--dwg-sidebar-bg);
	color: #ffffff;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, background 0.2s ease;
}

.dwg-to-top.show {
	opacity: 1;
	visibility: visible;
}

.dwg-to-top:hover {
	background: #333333;
}

/* ---------- 移动端 ---------- */
.dwg-mobile-bar {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 52px;
	background: var(--dwg-sidebar-bg);
	z-index: 110;
	align-items: center;
	padding: 0 14px;
	transition: transform 0.3s ease;
}

/* 移动端下滑时隐藏页头，上滑或回到顶部时恢复显示 */
.dwg-mobile-bar.dwg-hidden {
	transform: translateY(-100%);
}

.dwg-menu-toggle {
	position: absolute;
	left: 8px;
	top: 50%;
	transform: translateY(-50%);
	width: 36px;
	height: 36px;
	background: none;
	border: none;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	padding: 6px;
}

.dwg-menu-toggle span {
	display: block;
	height: 2px;
	background: #fff;
	border-radius: 1px;
}

.dwg-mobile-title {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 50px;
	color: #fff;
	font-weight: 700;
	font-size: 16px;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	user-select: none;
}

.dwg-mobile-title img {
	max-height: 28px;
	max-width: 140px;
	object-fit: contain;
	vertical-align: middle;
}

.dwg-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	z-index: 99;
}

/* 移动端菜单打开时锁定背景滚动：用 overflow:hidden（而非 position:fixed），
   原生保留 window.scrollY，关闭菜单后页面停留在原位置，避免“跳回顶部”。 */
html.dwg-scroll-lock,
body.dwg-scroll-lock {
	overflow: hidden;
}

@media screen and (max-width: 768px) {
	.dwg-mobile-bar {
		display: flex;
	}

	.dwg-sidebar {
		transform: translateX(-100%);
		width: 240px;
		padding-top: 52px;
	}

	.dwg-sidebar.open {
		transform: translateX(0);
	}

	/* 移动端菜单栏不重复显示 logo */
	.dwg-sidebar .dwg-logo {
		display: none;
	}

	.dwg-search-bar {
		max-width: 100%;
	}

	.dwg-search-row {
		gap: 12px;
	}

	/* 移动端桌面切换按钮隐藏，使用顶栏的切换按钮 */
	.dwg-theme-toggle {
		display: none;
	}

	.dwg-search-btn {
		padding: 0 18px;
	}

	.dwg-overlay.show {
		display: block;
	}

	.dwg-main {
		margin-left: 0;
		padding: 68px 14px 30px;
	}

	.dwg-grid {
		grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
		gap: 16px;
	}

	.dwg-card {
		padding: 12px;
	}
}
