/*
 * 商品详情页「使用兑换码」按钮与弹窗。
 *
 * 尺寸一律用 px：本站主题把根字号设成了 10px（Advanced Themer 的 base-font），
 * 用 rem 写会被整体压到 62.5%，字和边距都会小一圈。
 * 颜色仍然跟着站点的设计 token 走，取不到时回落到内置值。
 */

.cgc-spc {
	margin: 12px 0;
}

/* 正常灰色、悬浮主题色；不要边框。 */
.cgc-spc-trigger {
	display: inline-flex;
	align-items: center;
	background: none;
	border: 0;
	padding: 0;
	margin: 0;
	font: inherit;
	font-weight: 500;
	line-height: 1.4;
	color: var( --muted-foreground, #64748b );
	cursor: pointer;
	transition: color 0.15s ease-in-out;
}

.cgc-spc-trigger:hover,
.cgc-spc-trigger:focus-visible {
	color: var( --primary, #059669 );
	outline: none;
}

/* 弹窗 */
.cgc-spc-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	overflow-y: auto;
}

.cgc-spc-modal[hidden] {
	display: none;
}

.cgc-spc-backdrop {
	position: absolute;
	inset: 0;
	background: rgba( 15, 23, 42, 0.55 );
}

.cgc-spc-dialog {
	position: relative;
	box-sizing: border-box;
	width: min( 460px, 100% );
	max-height: calc( 100vh - 40px );
	overflow-y: auto;
	background: var( --background, #fff );
	color: var( --foreground, #0f172a );
	border-radius: 16px;
	box-shadow: 0 25px 50px -12px rgba( 0, 0, 0, 0.25 );
	padding: 28px;
	font-size: 16px;
	line-height: 1.5;
}

.cgc-spc-x {
	position: absolute;
	top: 12px;
	right: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	background: none;
	border: 0;
	padding: 0;
	border-radius: 9999px;
	font-size: 24px;
	line-height: 1;
	color: var( --muted-foreground, #64748b );
	cursor: pointer;
	transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

.cgc-spc-x:hover {
	color: var( --foreground, #0f172a );
	background: var( --secondary, #f1f5f9 );
}

/* 第一行：当前商品图片 + 名称 */
.cgc-spc-product {
	display: flex;
	align-items: center;
	gap: 16px;
	padding-right: 40px;
}

.cgc-spc-thumb {
	width: 72px;
	height: 72px;
	max-width: none;
	box-sizing: border-box;
	object-fit: cover;
	border-radius: 12px;
	flex: 0 0 auto;
	margin: 0;
}

.cgc-spc-name {
	font-size: 17px;
	font-weight: 600;
	line-height: 1.4;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
}

/* 第二行：输入框 + 兑换按钮 */
.cgc-spc-body {
	margin-top: 24px;
}

.cgc-spc-form {
	display: flex;
	gap: 10px;
	align-items: stretch;
}

.cgc-spc-input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 12px 14px;
	font: inherit;
	font-size: 16px;
	text-transform: uppercase;
	box-sizing: border-box;
	color: inherit;
	background: var( --secondary, #f1f5f9 );
	border: 1px solid var( --border, #e2e8f0 );
	border-radius: 10px;
}

.cgc-spc-input:focus {
	outline: none;
	border-color: var( --primary, #059669 );
	background: #fff;
}

.cgc-spc-submit {
	flex: 0 0 auto;
	padding: 12px 24px;
	font: inherit;
	font-size: 16px;
	font-weight: 600;
	color: #fff;
	background: var( --primary, #059669 );
	border: 0;
	border-radius: 10px;
	cursor: pointer;
	transition: opacity 0.15s ease-in-out;
}

.cgc-spc-submit:hover {
	opacity: 0.9;
}

.cgc-spc-form.is-busy {
	opacity: 0.7;
}

.cgc-spc-msg {
	margin: 16px 0 0;
	min-height: 26px;
	font-size: 16px;
	font-weight: 500;
	line-height: 1.6;
	color: var( --muted-foreground, #64748b );
}

.cgc-spc-msg-error {
	color: #b32d2e;
	font-weight: 600;
}

/* 「请先登录」是引导，不是报错：中性色，不用红色 */
.cgc-spc-msg-notice {
	color: var( --foreground, #0f172a );
	font-weight: 500;
}

.cgc-spc-msg-ok {
	color: var( --primary, #059669 );
	font-weight: 600;
}

.cgc-spc-login {
	color: var( --primary, #059669 );
	text-decoration: underline;
	font-weight: 600;
}

/* 窄屏：边距收一点，字号不缩 */
@media ( max-width: 480px ) {
	.cgc-spc-modal {
		padding: 12px;
	}

	.cgc-spc-dialog {
		max-height: calc( 100vh - 24px );
		padding: 20px;
	}

	.cgc-spc-thumb {
		width: 56px;
		height: 56px;
	}

	.cgc-spc-name {
		font-size: 16px;
	}

	.cgc-spc-product {
		padding-right: 36px;
	}

	.cgc-spc-form {
		flex-wrap: wrap;
	}

	.cgc-spc-submit {
		flex: 1 1 100%;
	}
}
