/*!
 * 页面底部广告位（左右侧边）
 * 默认 2 个广告位：左右各一个；数量增加时自动均分整行。
 */

.shopire-promo-band {
	background: #f5f7fa;
	border-top: 1px solid #e6e9ef;
	padding: 28px 0;
}

.shopire-promo-band-inner {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	justify-content: space-between;
	gap: 20px;
}

/* 默认（2 个广告位）时左右两侧各占一半；数量更多时自动换行均分。 */
.shopire-promo-band-inner > .shopire-promo-slot,
.shopire-promo-band-inner > .widget {
	flex: 1 1 calc(50% - 20px);
	max-width: calc(50% - 20px);
	min-width: 260px;
	margin: 0;
}

.shopire-promo-slot {
	display: flex;
}

.shopire-promo-card-link {
	display: flex;
	align-items: center;
	gap: 16px;
	width: 100%;
	padding: 16px 18px;
	background: #fff;
	border: 1px solid #e6e9ef;
	border-radius: 12px;
	box-shadow: 0 2px 10px rgba(16, 24, 40, 0.04);
	text-decoration: none !important;
	color: #1f2937;
	transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}

.shopire-promo-card-link:hover,
.shopire-promo-card-link:focus {
	border-color: #c9d3e0;
	box-shadow: 0 8px 22px rgba(16, 24, 40, 0.10);
	transform: translateY(-2px);
	color: #1f2937;
}

.shopire-promo-media {
	flex: 0 0 auto;
	width: 84px;
	height: 84px;
	border-radius: 10px;
	overflow: hidden;
	background: #f0f2f5;
	display: flex;
	align-items: center;
	justify-content: center;
}

.shopire-promo-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.shopire-promo-body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
	flex: 1 1 auto;
}

.shopire-promo-title {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
	color: #111827;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.shopire-promo-text {
	font-size: 12px;
	line-height: 1.5;
	color: #6b7280;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.shopire-promo-cta {
	flex: 0 0 auto;
	align-self: center;
	font-size: 13px;
	font-weight: 600;
	color: #fff;
	background: #2563eb;
	border-radius: 999px;
	padding: 8px 14px;
	white-space: nowrap;
}

/* 后台小工具模式：让每个小工具也按"左右侧边"排布。 */
.shopire-promo-band--widgets .widget-title {
	font-size: 14px;
	font-weight: 600;
	margin: 0 0 8px;
	color: #111827;
}

@media (max-width: 768px) {
	.shopire-promo-band {
		padding: 18px 0;
	}
	.shopire-promo-band-inner > .shopire-promo-slot,
	.shopire-promo-band-inner > .widget {
		flex: 1 1 100%;
		max-width: 100%;
	}
	.shopire-promo-media {
		width: 64px;
		height: 64px;
	}
}

/* ==========================================================================
 * 页面左右两侧悬浮广告位
 *  - 只在宽屏显示（正文容器最大 1440px，两侧留白足够时才出现），窄屏自动隐藏；
 *  - 尺寸自适应两侧留白，最大 150px 宽，不遮挡正文、不撑开页面；
 *  - 每侧默认 2 个，纵向排列。
 * ========================================================================== */

.shopire-promo-rail {
	display: none;
}

.shopire-promo-rail .widget,
.shopire-promo-rail .shopire-promo-rail-card {
	margin: 0 0 10px;
}

.shopire-promo-rail-link {
	display: block;
	background: #fff;
	border: 1px solid #e8ebf0;
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(16, 24, 40, 0.05);
	overflow: hidden;
	text-decoration: none !important;
	color: #1f2937;
	transition: box-shadow .18s ease, transform .18s ease;
}

.shopire-promo-rail-link:hover,
.shopire-promo-rail-link:focus {
	transform: translateY(-2px);
	box-shadow: 0 8px 18px rgba(16, 24, 40, 0.12);
	color: #1f2937;
}

.shopire-promo-rail-media {
	display: block;
	background: #f3f5f8;
	aspect-ratio: 16 / 10;
	overflow: hidden;
}

.shopire-promo-rail-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.shopire-promo-rail-title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 12px;
	line-height: 1.45;
	padding: 8px 8px 0;
	color: #374151;
}

.shopire-promo-rail-cta {
	display: block;
	font-size: 11px;
	font-weight: 600;
	color: #2563eb;
	padding: 4px 8px 8px;
}

/*
 * 侧栏宽度 / 正文内缩量，按视口宽度自动计算（正文容器最大 1440px）：
 *  - 留白够（宽屏）：侧栏 150px 放在留白里，正文完全不缩；
 *  - 留白不够（笔记本 1280~1700）：侧栏自动变窄（最小 80px），
 *    同时把页面容器整体内缩一点，保证广告绝不压正文；
 *  - 视口 <1200px（平板/手机）：整体隐藏。
 */
@media (min-width: 1200px) {
	:root {
		--shopire-rail-w: clamp(80px, calc((100vw - 1440px) / 2 - 10px), 150px);
		--shopire-rail-inset: max(0px, calc(var(--shopire-rail-w) + 4px - max(0px, (100vw - 1440px) / 2)));
	}

	.shopire-promo-rail {
		display: block;
		position: fixed;
		top: 50%;
		transform: translateY(-50%);
		width: var(--shopire-rail-w);
		max-height: calc(100vh - 32px);
		overflow-y: auto;
		overflow-x: hidden;
		z-index: 9;
	}
	.shopire-promo-rail--left {
		left: 10px;
	}
	.shopire-promo-rail--right {
		right: 10px;
	}

	/* 内缩页面容器（背景仍是整屏宽），让正文与广告互不重叠。 */
	body .wf-container,
	body .wf-container-fluid {
		padding-left: calc(1.6rem + var(--shopire-rail-inset));
		padding-right: calc(1.6rem + var(--shopire-rail-inset));
	}
}

/* 平板/手机：不显示侧栏广告，避免影响布局。 */
@media (max-width: 1199.98px) {
	.shopire-promo-rail {
		display: none !important;
	}
}
