/**
 * 产品分类 Mega 菜单
 *
 * 桌面：多列（图片 → 分类名 → 子分类），可选右侧询价卡片
 * 平板：4 列，询价卡片移到下方
 * 手机：折叠列表（小图 + 分类名 + 展开按钮）或两列网格
 */

.elementor-widget-ss_mega_categories {
	width: 100%;
	max-width: 100%;
}

.ssm {
	--ssm-accent: #0b63ce;
	--ssm-heading: #15202e;
	--ssm-text: #5b6675;
	--ssm-muted: #98a2ae;
	--ssm-line: #e8ecf1;
	--ssm-bg: #fff;
	--ssm-cols: 7;
	--ssm-cols-t: 4;
	--ssm-gap: 28px;
	--ssm-ratio: 16 / 10;
	--ssm-radius: 10px;

	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--ssm-gap);
	padding: 32px 0;
	font-size: 14px;
	line-height: 1.45;
	background: var(--ssm-bg);
}

.ssm--has-cta {
	grid-template-columns: minmax(0, 1fr) minmax(220px, 260px);
}

.ssm *,
.ssm *::before,
.ssm *::after {
	box-sizing: border-box;
}

.ssm a {
	text-decoration: none;
}

.ssm .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ---------------- 列 ---------------- */

.ssm-grid {
	display: grid;
	grid-template-columns: repeat(var(--ssm-cols), minmax(0, 1fr));
	gap: 28px var(--ssm-gap);
	align-items: start;
}

.ssm-col {
	min-width: 0;
}

/* 图片 */
.ssm-media {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: var(--ssm-ratio);
	margin-bottom: 14px;
	background: #f1f4f7;
	border-radius: var(--ssm-radius);
}

.ssm-media::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	box-shadow: inset 0 0 0 1px rgba(16, 32, 56, 0.06);
	pointer-events: none;
}

.ssm-media .ssm-img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform 0.5s ease;
}

.ssm-col:hover .ssm-img {
	transform: scale(1.06);
}

/* 分类名 */
.ssm-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding-bottom: 10px;
	margin-bottom: 8px;
	border-bottom: 1px solid var(--ssm-line);
	position: relative;
}

/* 分类名下方的强调线：悬停 / 当前分类时展开 */
.ssm-head::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -1px;
	width: 28px;
	height: 2px;
	background: var(--ssm-accent);
	transform-origin: left;
	transition: width 0.3s ease;
}

.ssm-col:hover .ssm-head::after,
.ssm-col.is-current .ssm-head::after {
	width: 100%;
}

.ssm-title {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-width: 0;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--ssm-heading);
	transition: color 0.2s ease;
}

.ssm-title > span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ssm-arrow {
	flex: 0 0 auto;
	width: 6px;
	height: 6px;
	border-top: 1.5px solid currentColor;
	border-right: 1.5px solid currentColor;
	opacity: 0;
	transform: translateX(-4px) rotate(45deg);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.ssm-title:hover,
.ssm-title:focus-visible,
.ssm-col.is-current .ssm-title {
	color: var(--ssm-accent);
}

.ssm-title:hover .ssm-arrow,
.ssm-title:focus-visible .ssm-arrow {
	opacity: 1;
	transform: translateX(0) rotate(45deg);
}

/* 子分类 */
.ssm-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ssm-list li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ssm-list a {
	position: relative;
	display: flex;
	align-items: baseline;
	gap: 6px;
	padding: 5px 0 5px 12px;
	color: var(--ssm-text);
	transition: color 0.2s ease, padding 0.2s ease;
}

/* 小圆点 */
.ssm-list a::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 0;
	width: 4px;
	height: 4px;
	margin-top: -2px;
	background: var(--ssm-line);
	border-radius: 50%;
	transition: background-color 0.2s ease, transform 0.2s ease;
}

.ssm-name {
	display: -webkit-box;
	overflow: hidden;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.ssm-count {
	flex: 0 0 auto;
	margin-left: auto;
	font-size: 12px;
	color: var(--ssm-muted);
}

.ssm-list a:hover,
.ssm-list a:focus-visible,
.ssm-list .is-current > a {
	padding-left: 16px;
	color: var(--ssm-accent);
}

.ssm-list a:hover::before,
.ssm-list a:focus-visible::before,
.ssm-list .is-current > a::before {
	background: var(--ssm-accent);
	transform: scale(1.4);
}

.ssm-list .ssm-more a {
	margin-top: 4px;
	padding-left: 0;
	font-size: 13px;
	font-weight: 600;
	color: var(--ssm-accent);
}

.ssm-list .ssm-more a::before {
	display: none;
}

.ssm-list .ssm-more a:hover {
	padding-left: 4px;
}

.ssm a:focus-visible,
.ssm button:focus-visible {
	outline: 2px solid var(--ssm-accent);
	outline-offset: 2px;
	border-radius: 2px;
}

/* 手机端折叠按钮（桌面隐藏） */
.ssm-toggle {
	display: none;
}

/* ---------------- 询价卡片 ---------------- */

.ssm-cta {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	gap: 10px;
	overflow: hidden;
	padding: 26px 24px;
	color: #fff;
	background: linear-gradient(150deg, #0e2a4f 0%, #0b63ce 100%);
	border-radius: calc(var(--ssm-radius) + 2px);
	align-self: stretch;
}

/* 装饰圆 */
.ssm-cta::before {
	content: "";
	position: absolute;
	top: -60px;
	right: -60px;
	width: 180px;
	height: 180px;
	border: 28px solid rgba(255, 255, 255, 0.07);
	border-radius: 50%;
}

.ssm-cta-title {
	position: relative;
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.25;
	color: #fff;
}

.ssm-cta-text {
	position: relative;
	margin: 0;
	font-size: 14px;
	line-height: 1.55;
	color: rgba(255, 255, 255, 0.82);
}

.ssm-cta-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	align-self: flex-start;
	gap: 8px;
	margin-top: 8px;
	padding: 10px 18px;
	font-size: 14px;
	font-weight: 600;
	color: #0e2a4f;
	background: #fff;
	border-radius: 999px;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ssm-cta-btn:hover {
	color: #0e2a4f;
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
	transform: translateY(-1px);
}

/* 无图片模式：更紧凑 */
.ssm--no-image .ssm-head {
	padding-top: 2px;
}

/* ================================================================
 * 平板（≤1024px）
 * ================================================================ */

@media (max-width: 1024px) {
	.ssm,
	.ssm--has-cta {
		grid-template-columns: minmax(0, 1fr);
		padding: 24px 0;
	}

	.ssm-grid {
		grid-template-columns: repeat(var(--ssm-cols-t), minmax(0, 1fr));
		gap: 24px 20px;
	}

	.ssm-cta {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-between;
	}

	.ssm-cta-text {
		flex: 1 1 260px;
	}

	.ssm-cta-btn {
		align-self: center;
		margin-top: 0;
	}
}

/* ================================================================
 * 手机（≤767px）
 * ================================================================ */

@media (max-width: 767px) {
	.ssm {
		padding: 8px 0 16px;
		gap: 16px;
	}

	/* -------- 折叠列表 -------- */

	.ssm--m-accordion .ssm-grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 0;
	}

	.ssm--m-accordion .ssm-col {
		display: grid;
		grid-template-columns: auto minmax(0, 1fr);
		align-items: center;
		column-gap: 12px;
		border-bottom: 1px solid var(--ssm-line);
	}

	.ssm--m-accordion .ssm-media {
		width: 56px;
		margin: 10px 0;
		aspect-ratio: 4 / 3;
		border-radius: 6px;
	}

	.ssm--m-accordion.ssm--no-image .ssm-col {
		grid-template-columns: minmax(0, 1fr);
	}

	.ssm--m-accordion .ssm-head {
		min-height: 52px;
		margin: 0;
		padding: 0;
		border-bottom: 0;
	}

	.ssm--m-accordion .ssm-head::after {
		display: none;
	}

	.ssm--m-accordion .ssm-title {
		padding: 12px 0;
		font-size: 15px;
	}

	.ssm--m-accordion .ssm-arrow {
		display: none;
	}

	.ssm--m-accordion .ssm-toggle {
		position: relative;
		display: block;
		flex: 0 0 auto;
		width: 40px;
		height: 40px;
		margin: 0 -8px 0 0;
		padding: 0;
		color: var(--ssm-heading);
		background: none;
		border: 0;
		border-radius: 50%;
		box-shadow: none;
		cursor: pointer;
	}

	/* 加号 / 减号 */
	.ssm--m-accordion .ssm-toggle::before,
	.ssm--m-accordion .ssm-toggle::after {
		content: "";
		position: absolute;
		top: 50%;
		left: 50%;
		width: 12px;
		height: 1.5px;
		margin: -0.75px 0 0 -6px;
		background: currentColor;
		transition: transform 0.25s ease;
	}

	.ssm--m-accordion .ssm-toggle::after {
		transform: rotate(90deg);
	}

	.ssm--m-accordion .ssm-toggle[aria-expanded="true"] {
		color: var(--ssm-accent);
	}

	.ssm--m-accordion .ssm-toggle[aria-expanded="true"]::after {
		transform: rotate(0);
	}

	.ssm--m-accordion .ssm-list {
		grid-column: 1 / -1;
		display: none;
		padding: 0 0 12px 12px;
	}

	.ssm--m-accordion .ssm-col.is-open .ssm-list {
		display: block;
		animation: ssm-open 0.25s ease;
	}

	.ssm--m-accordion .ssm-list a {
		padding-top: 8px;
		padding-bottom: 8px;
	}

	.ssm--m-accordion .ssm-col:hover .ssm-img {
		transform: none;
	}

	/* -------- 两列网格 -------- */

	.ssm--m-grid .ssm-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 22px 16px;
	}

	.ssm--m-grid .ssm-title {
		font-size: 14px;
	}

	/* -------- 询价卡片 -------- */

	.ssm-cta {
		flex-direction: column;
		align-items: flex-start;
		padding: 22px 20px;
	}

	.ssm-cta-btn {
		align-self: flex-start;
	}
}

@keyframes ssm-open {
	from { opacity: 0; transform: translateY(-4px); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.ssm *,
	.ssm *::before,
	.ssm *::after {
		transition: none !important;
		animation: none !important;
	}
}
