/**
 * Yiyuan Mega Menu
 * 三栏布局：左分类 / 中产品图标 / 右详情。
 */

.ymm {
	--ymm-accent: #901D22;
	--ymm-panel-bg: rgba(255, 255, 255, 1);
	--ymm-text: #000;
	--ymm-radius: 10px;
	--ymm-tab-w: 262px;
	--ymm-detail-w: 500px;
	position: relative;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	font-size: 16px;
	line-height: 1.4;
	color: var(--ymm-text);
}

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

.ymm a {
	text-decoration: none;
	color: inherit;
}

.ymm img {
	display: block;
	max-width: 100%;
}

/* ---------- 面板 ---------- */

.ymm .ymm-panel {
	position: relative;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	height: auto;
	border-radius: var(--ymm-radius);
	box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.ymm .ymm-panel-inner {
	display: grid;
	grid-template-columns: var(--ymm-tab-w) minmax(0, 1fr);
	width: 100%;
	min-width: 0;
	height: auto;
	background: var(--ymm-panel-bg);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	border-radius: var(--ymm-radius);
}

/* ---------- 左列分类 ---------- */

.ymm .ymm-tabs {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	flex: 0 0 var(--ymm-tab-w);
	width: var(--ymm-tab-w);
	padding: 30px 0 30px;
	background: #EFEFEF;
	border-radius: var(--ymm-radius) 0 0 var(--ymm-radius);
}

.ymm .ymm-tab {
	position: relative;
	display: block;
	padding: 11px 0 11px 26px;
	font-size: 16px;
	font-weight: 700;
	color: var(--ymm-text);
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow: hidden;
	transition: color 0.2s ease;
}

.ymm .ymm-tab::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 10px;
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--ymm-text);
	transform: translateY(-50%);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.ymm .ymm-tab:hover,
.ymm .ymm-tab.is-active {
	color: var(--ymm-accent);
}

.ymm .ymm-tab:hover::before,
.ymm .ymm-tab.is-active::before {
	opacity: 1;
	background: var(--ymm-accent);
}

/* ---------- 右侧主体 ---------- */

.ymm .ymm-body {
	min-width: 0;
	height: 100%;
	overflow: hidden;
	border-radius: 0 var(--ymm-radius) var(--ymm-radius) 0;
}

.ymm .ymm-tab-panel {
	display: none;
	height: 100%;
	padding: 20px 0 0;
	overflow: hidden;
}

.ymm .ymm-tab-panel.is-active {
	display: flex;
	justify-content: space-between;
	width: 100%;
	min-width: 0;
	max-width: 100%;
}

/* 中间产品图标区 */
.ymm .ymm-cards {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 0;
	align-content: start;
	padding: 20px 10px 10px;
	flex: 1 1 0;
	min-width: 0;
	width: 100%;
	max-width: 45%;
}

.ymm .ymm-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	width: 100%;
	min-width: 0;
	min-height: 120px;
	padding: 0;
	text-align: center;
	border-radius: 6px;
	transition: background 0.2s ease;
}

.ymm .ymm-card:hover {
	background: rgba(255, 255, 255, 0.06);
}

.ymm .ymm-card-icon {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin-bottom: 20px;
}

.ymm .ymm-card-icon .ymm-icon {
	position: absolute;
	inset: 0;
	width: 40px;
	height: 40px;
	object-fit: contain;
	transition: opacity 0.25s ease;
}

/* SCF menu_svg：内联 SVG，悬停只换颜色 */
.ymm .ymm-icon-svg {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	color: var(--ymm-text);
	transition: color 0.25s ease;
}

.ymm .ymm-icon-svg svg {
	width: 100%;
	height: 100%;
	max-width: 40px;
	max-height: 40px;
}

/* 未声明 fill 的元素跟随文字色；fill="none" 的描边图标保持镂空。 */
.ymm .ymm-icon-svg svg:not([fill]),
.ymm .ymm-icon-svg svg :not([fill]) {
	fill: currentColor;
}

/* 只有描边、没有填充线的图标也能正常显示。 */
.ymm .ymm-icon-svg svg [stroke]:not([stroke="none"]),
.ymm .ymm-icon-svg svg[stroke]:not([stroke="none"]) {
	stroke: currentColor;
}

.ymm .ymm-card:hover .ymm-icon-svg,
.ymm .ymm-card.is-active .ymm-icon-svg {
	color: var(--ymm-accent);
}

.ymm .ymm-card-placeholder {
	width: 32px;
	height: 32px;
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 4px;
}

.ymm .ymm-card-title {
	display: block;
	max-width: 100%;
	font-size: 12px;
	font-weight: 300;
	line-height: 1.35;
	color: var(--ymm-text);
	word-break: break-word;
	overflow-wrap: anywhere;
}

.ymm .ymm-card.is-active .ymm-card-title,
.ymm .ymm-card:hover .ymm-card-title {
	color: var(--ymm-accent);
}

/* 最右详情 */
.ymm .ymm-details {
	flex: 0 0 min(var(--ymm-detail-w), 45%);
	width: auto;
	min-width: 0;
	max-width: 45%;
	padding: 10px 30px 20px;
	overflow: hidden;
}

.ymm .ymm-detail {
	display: none;
}

.ymm .ymm-detail.is-active {
	display: block;
}

.ymm .ymm-detail-media {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 200px;
	margin-bottom: 28px;
}

.ymm .ymm-detail-media img {
	max-height: 200px;
	max-width: 100%;
	width: auto;
	object-fit: contain;
}

.ymm .ymm-detail-title {
	display: block;
	margin-bottom: 19px;
	color: var(--ymm-accent);
	font-size: 18px;
	font-weight: 700;
	overflow-wrap: anywhere;
}

.ymm .ymm-detail-desc {
	display: block;
	color: var(--ymm-text);
	font-size: 14px;
	font-weight: 400;
	line-height: 28px;
	overflow-wrap: anywhere;
}

.ymm .ymm-detail-line {
	display: block;
}

/* ---------- 移动端 ---------- */

@media (max-width: 980px) {
	.ymm .ymm-panel,
	.ymm .ymm-panel-inner {
		width: 100%;
		max-width: 100%;
		border-radius: var(--ymm-radius);
	}

	.ymm .ymm-panel-inner {
		display: block;
		background: var(--ymm-panel-bg);
	}

	.ymm .ymm-tabs {
		flex-direction: row;
		flex: 0 0 auto;
		gap: 6px;
		width: 100%;
		padding: 10px 12px;
		overflow-x: auto;
		overflow-y: hidden;
		background: transparent;
		border-radius: var(--ymm-radius) var(--ymm-radius) 0 0;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}

	.ymm .ymm-tabs::-webkit-scrollbar {
		display: none;
	}

	.ymm .ymm-tab {
		flex: 0 0 auto;
		padding: 8px 14px;
		font-size: 14px;
		white-space: nowrap;
		border: 1px solid rgba(255, 255, 255, 0.25);
		border-radius: 30px;
	}

	.ymm .ymm-tab::before {
		display: none;
	}

	.ymm .ymm-tab.is-active {
		border-color: var(--ymm-accent);
		background: rgba(68, 122, 203, 0.18);
	}

	.ymm .ymm-body {
		height: auto;
		width: 100%;
		overflow: visible;
		border-radius: 0 0 var(--ymm-radius) var(--ymm-radius);
	}

	.ymm .ymm-tab-panel.is-active {
		display: block;
		width: 100%;
		padding: 0 18px 20px;
		overflow: visible;
	}

	.ymm .ymm-cards {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		padding: 10px 0;
	}

	.ymm .ymm-card {
		width: auto;
		min-height: 110px;
	}

	.ymm .ymm-details {
		width: 100%;
		max-width: none;
		flex: 0 0 auto;
		padding: 10px 0 0;
	}

	.ymm .ymm-detail-desc {
		line-height: 24px;
		word-break: break-word;
	}

	.ymm .ymm-detail-media {
		height: auto;
		margin-bottom: 16px;
	}

	.ymm .ymm-detail-media img {
		max-height: 160px;
	}
}
