/*
 * jmxkf_contentcard 编辑器内容卡片样式
 * 全部类名以 jmxkf-card（前台卡片）与 jxc-（编辑器面板）为前缀，不污染主题样式
 * 主题色通过卡片根节点内联 CSS 变量 --jxc-accent 控制（后台可配置）
 * 边框/阴影对齐 youhuime wptao-item：默认 1px solid #eee 浅色边框，hover box-shadow 1px 1px 8px #eee
 */

/* ========== 前台卡片通用 ========== */
.jmxkf-card {
	--jxc-accent: #e8365a;
	background: var(--bs-body-bg, #fff);
	color: var(--bs-body-color, #333);
	border: 1px solid var(--bs-border-color, #eee);
	border-radius: 4px;
	box-shadow: none;
	transition: box-shadow .25s ease;
	overflow: hidden;
	max-width: 620px;
	margin: 10px auto;
	font-size: .875rem;
	line-height: 1.5;
}
.jmxkf-card:hover { box-shadow: 1px 1px 8px #eee; }
.jmxkf-card.jmxkf-card-flat,
.jmxkf-card.jmxkf-card-flat:hover { box-shadow: none; }
.jmxkf-card a { text-decoration: none; }
.jmxkf-card img { max-width: 100%; }
.jmxkf-card .ti { vertical-align: -.125em; }

.jmxkf-card-media {
	position: relative;
	display: block;
	background: var(--bs-tertiary-bg, #f6f6f6);
	overflow: hidden;
}
.jmxkf-card-media img {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 10;
	object-fit: cover;
}
.jmxkf-card-media-info img {
	aspect-ratio: auto;
	max-height: 420px;
	object-fit: cover;
}

.jmxkf-card-body { padding: .75rem .9rem; }

.jmxkf-card-tag {
	display: inline-block;
	font-size: .72rem;
	line-height: 1;
	padding: .3em .7em;
	border-radius: 4px;
	color: #fff;
	background: var(--jxc-accent);
	margin-bottom: .45rem;
}

.jmxkf-card-title {
	font-size: .95rem;
	font-weight: 600;
	line-height: 1.45;
	margin: 0 0 .3rem;
	word-break: break-word;
}
.jmxkf-card-title a { color: inherit; }
.jmxkf-card-title a:hover { color: var(--jxc-accent); }

.jmxkf-card-desc {
	font-size: .82rem;
	color: var(--bs-secondary-color, #888);
	line-height: 1.55;
	margin: 0 0 .5rem;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.jmxkf-card-content {
	font-size: .84rem;
	color: var(--bs-body-color, #444);
	line-height: 1.7;
	margin: .15rem 0 .5rem;
	word-break: break-word;
}

.jmxkf-card-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .5rem;
	margin-top: .35rem;
}
.jmxkf-card-foot-end { justify-content: flex-end; }

.jmxkf-card-price {
	display: flex;
	align-items: baseline;
	gap: .4rem;
	min-width: 0;
	overflow: hidden;
}
.jmxkf-card-price-now {
	color: var(--jxc-accent);
	font-weight: 700;
	font-size: 1.15rem;
	white-space: nowrap;
}
.jmxkf-card-price-old {
	color: var(--bs-secondary-color, #999);
	font-size: .78rem;
	text-decoration: line-through;
	white-space: nowrap;
}

/* 操作区：优惠码 + 链接按钮 */
.jmxkf-card-actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: .45rem;
	flex-shrink: 0;
	min-width: 0;
}

.jmxkf-card-btn {
	display: inline-flex;
	align-items: center;
	gap: .25rem;
	background: var(--jxc-accent);
	color: #fff !important;
	font-size: .8rem;
	font-weight: 500;
	padding: .35rem .85rem;
	border-radius: 4px;
	white-space: nowrap;
	flex-shrink: 0;
	transition: opacity .15s;
}
.jmxkf-card-btn:hover { opacity: .88; color: #fff !important; }

/* ========== 优惠码（点击复制，样式对齐 wptao-quan：点线边框 + 悬停浅底） ========== */
.jmxkf-card-coupon {
	display: inline-flex;
	align-items: center;
	gap: .3rem;
	border: 1px dotted var(--jxc-accent);
	border-radius: 4px;
	background: transparent;
	color: var(--jxc-accent);
	font-size: .75rem;
	line-height: 1;
	padding: .32rem .5rem;
	cursor: pointer;
	overflow: hidden;
	max-width: 190px;
	transition: background-color .15s;
	-webkit-user-select: none;
	user-select: none;
}
.jmxkf-card-coupon:hover { background-color: #fff2f3; }
.jxc-coupon-icon { display: inline-flex; flex-shrink: 0; }
.jxc-coupon-icon .ti { font-size: .85rem; }
.jxc-coupon-code {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 600;
	letter-spacing: .02em;
}
.jxc-coupon-copy { display: inline-flex; flex-shrink: 0; opacity: .75; }
.jxc-coupon-copy .ti { font-size: .8rem; }

/* ========== 横版风格（item1h / infoh）：左图右文，宽度自适应 ========== */
.jmxkf-card-h {
	display: flex;
	flex-direction: row;
	align-items: stretch;
	max-width: none;
}
.jmxkf-card-h .jmxkf-card-media {
	flex: 0 0 220px;
	min-height: 150px;
}
.jmxkf-card-h .jmxkf-card-media img {
	width: 100%;
	height: 100%;
	aspect-ratio: auto;
	object-fit: cover;
	position: absolute;
	inset: 0;
}
.jmxkf-card-h .jmxkf-card-media { position: relative; }
.jmxkf-card-h .jmxkf-card-body {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
}
.jmxkf-card-h .jmxkf-card-body .jmxkf-card-foot,
.jmxkf-card-h .jmxkf-card-body .jmxkf-card-content { margin-top: auto; }
.jmxkf-card-h .jmxkf-card-title { font-size: 1rem; }

/* ========== 风格2：双商品并排 / 风格4：多商品网格 ========== */
.jmxkf-card-item2,
.jmxkf-card-grid { max-width: 680px; }

.jmxkf-card-group {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: .75rem;
	padding: .75rem;
}
.jmxkf-card-grid .jmxkf-card-group { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.jmxkf-card-grid .jmxkf-card-group:has(.jmxkf-card-cell:nth-child(4)) { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.jmxkf-card-cell {
	display: flex;
	flex-direction: column;
	background: var(--bs-body-bg, #fff);
	border: 1px solid var(--bs-border-color, rgba(0, 0, 0, .08));
	border-radius: 4px;
	overflow: hidden;
	min-width: 0;
}
.jmxkf-card-cell:hover { box-shadow: 1px 1px 8px #eee; }
.jmxkf-card-cell .jmxkf-card-media img { aspect-ratio: 1 / 1; }
.jmxkf-card-cell-body { padding: .5rem .6rem; flex: 1; display: flex; flex-direction: column; }
.jmxkf-card-cell-body .jmxkf-card-title { font-size: .82rem; margin-bottom: .2rem; }
.jmxkf-card-cell-body .jmxkf-card-tag { font-size: .66rem; padding: .25em .6em; }
.jmxkf-card-cell-body .jmxkf-card-foot { margin-top: auto; flex-wrap: wrap; }
.jmxkf-card-cell-body .jmxkf-card-price-now { font-size: 1rem; }
.jmxkf-card-cell-body .jmxkf-card-price-old { font-size: .72rem; }
.jmxkf-card-cell-body .jmxkf-card-btn { padding: .3rem .6rem; }
.jmxkf-card-cell .jmxkf-card-coupon { max-width: 120px; padding: .28rem .4rem; font-size: .68rem; }

/* ========== 移动端自适应：卡片单列排列、横版改上下堆叠 ========== */
@media (max-width: 768px) {
	.jmxkf-card { max-width: 100%; margin: 10px 0; }
	.jmxkf-card-item2 .jmxkf-card-group,
	.jmxkf-card-grid .jmxkf-card-group { grid-template-columns: 1fr; }
	.jmxkf-card-h { flex-direction: column; }
	.jmxkf-card-h .jmxkf-card-media { flex: none; }
	.jmxkf-card-h .jmxkf-card-media img {
		aspect-ratio: 16 / 10;
		height: auto;
		position: static;
	}
}

/* ========== 编辑器插入面板（弹窗内） ========== */
.jxc-style-card {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	cursor: pointer;
	background: var(--bs-body-bg, #fff);
	color: var(--bs-body-color, #333);
	transition: border-color .15s, box-shadow .15s;
	width: 100%;
}
.jxc-style-card:hover {
	border-color: var(--jxc-accent, #e8365a) !important;
	color: var(--bs-body-color, #333);
}
.jxc-style-card.jxc-style-active {
	border-color: var(--jxc-accent, #e8365a) !important;
	box-shadow: 0 0 0 2px rgba(232, 54, 90, .2);
}

.jxc-item-block { background: var(--bs-tertiary-bg, #fafafa); }
.jxc-img-preview {
	display: block;
	max-height: 48px;
	max-width: 96px;
	border-radius: 4px;
	border: 1px solid var(--bs-border-color, #ddd);
	object-fit: cover;
}

.jmxkf-card-preview-box {
	background: var(--bs-tertiary-bg, #f8f9fa);
	border: 1px dashed var(--bs-border-color, #ccc);
	border-radius: 8px;
	padding: .75rem;
	min-height: 80px;
}
