/* 帖子送礼插件样式（适配 kehua / 清爽主题，变量缺失时回退默认值） */

/* 主题令牌兜底 */
:root {
	--xn-color-white: var(--color-white, #fff);
	--xn-color-bg: var(--color-bg, #f7f7f8);
	--xn-border: var(--border, var(--color-border, #e3e5e8));
	--xn-text: var(--color-text, #1f2329);
	--xn-text-light: var(--color-text-light, #495057);
	--xn-text-muted: var(--color-text-muted, #86909c);
	--xn-primary: var(--color-primary, #ff5c7a);
	--xn-primary-soft: var(--color-primary-soft, #fff0f3);
	--xn-danger: var(--color-danger, #ff4d4f);
	--xn-radius: var(--radius, 12px);
	--xn-shadow-sm: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, .08));
}

/* ---------- 帖子页送礼按钮 ---------- */
.xn-gift-open {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border: 1px solid #e5e7eb;
	background: var(--xn-color-white);
	color: var(--xn-text);
	border-radius: 8px;
	padding: 7px 16px;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
	cursor: pointer;
	transition: all .2s;
}
.xn-gift-open:hover {
	border-color: var(--xn-primary);
	color: var(--xn-primary);
}

/* ---------- 遮罩与弹窗 ---------- */
.xn-gift-mask {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, .45);
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}
.xn-gift-dialog {
	background: var(--xn-color-white);
	border-radius: 16px;
	width: 640px;
	max-width: 96vw;
	max-height: 88vh;
	display: flex;
	flex-direction: column;
	box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
	overflow: hidden;
}
.xn-gift-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 22px 10px;
}
.xn-gift-title {
	font-size: 16px;
	font-weight: 700;
	color: var(--xn-text);
}
.xn-gift-close {
	font-size: 26px;
	line-height: 1;
	color: var(--xn-text-muted);
	cursor: pointer;
	padding: 0 4px;
}
.xn-gift-close:hover {
	color: var(--xn-text);
}
.xn-gift-body {
	padding: 6px 22px 20px;
	overflow-y: auto;
}

/* ---------- 礼物网格 ---------- */
.xn-gift-grid {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 12px;
}
.xn-gift-tip {
	grid-column: 1 / -1;
	text-align: center;
	color: var(--xn-text-muted);
	padding: 24px 8px;
	font-size: 13px;
}
.xn-gift-card {
	background: var(--xn-color-bg);
	border: 1.5px solid transparent;
	border-radius: var(--xn-radius);
	padding: 14px 6px;
	text-align: center;
	cursor: pointer;
	transition: all .15s;
}
.xn-gift-card:hover {
	background: var(--xn-primary-soft);
}
.xn-gift-card.active {
	border-color: var(--xn-primary);
	background: var(--xn-primary-soft);
}
.xn-gift-card .xn-gift-icon {
	width: 56px;
	height: 56px;
	margin: 0 auto 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 40px;
	line-height: 1;
}
.xn-gift-card .xn-gift-icon img {
	max-width: 56px;
	max-height: 56px;
	border-radius: 8px;
}
.xn-gift-card .xn-gift-name {
	font-size: 13px;
	color: var(--xn-text);
	margin-bottom: 4px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.xn-gift-card .xn-gift-price {
	font-size: 12px;
	color: var(--xn-danger);
}

/* ---------- 留言 ---------- */
.xn-gift-msg {
	margin-top: 16px;
	border-radius: 10px;
	resize: none;
	background: var(--xn-color-white);
	color: var(--xn-text);
	border: 1px solid var(--xn-border);
}
.xn-gift-msg:focus {
	border-color: var(--xn-primary);
	box-shadow: 0 0 0 .2rem rgba(255, 92, 122, .15);
}

/* ---------- 底部 ---------- */
.xn-gift-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 16px;
}
.xn-gift-balance {
	font-size: 13px;
	color: var(--xn-text-muted);
}
.xn-gift-balance b {
	color: var(--xn-primary);
}
.xn-gift-send {
	background: var(--xn-primary);
	border: none;
	color: #fff;
	border-radius: 20px;
	padding: 8px 26px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}
.xn-gift-send:hover {
	opacity: .92;
	color: #fff;
}
.xn-gift-send:disabled {
	opacity: .6;
	cursor: not-allowed;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
	.xn-gift-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
	.xn-gift-grid { grid-template-columns: repeat(2, 1fr); }
	.card-gift-log .card-body { padding: 12px 14px; }
	.xn-gift-head { padding: 14px 16px 8px; }
	.xn-gift-body { padding: 6px 16px 16px; }
}

/* ============ 帖子页送礼记录墙 ============ */
.card-gift-log {
	background: var(--xn-color-white);
	border: var(--xn-border);
	border-radius: var(--xn-radius);
	box-shadow: var(--xn-shadow-sm);
	margin-top: 14px;
}
.card-gift-log .card-title {
	margin-bottom: 12px;
	color: var(--xn-text);
}
/* 卡片内容左右留白，避免头像 / 礼物图标贴边 */
.card-gift-log .card-body {
	padding: 16px 20px;
}
.gift-log-item {
	display: flex;
	align-items: flex-start;
	padding: 12px 0;
	border-bottom: 1px solid var(--xn-border);
}
.gift-log-item:last-child {
	border-bottom: none;
}
/* 记录墙送礼人头像：缩小为统一圆形 */
.card-gift-log .gift-log-item a.mr-3 {
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	margin-right: 12px !important;
}
.card-gift-log .avatar-3 {
	width: 40px !important;
	height: 40px !important;
	border-radius: 50% !important;
	object-fit: cover;
	display: block;
}
.gift-log-main {
	flex: 1;
	min-width: 0;
}
.gift-log-line {
	font-size: 14px;
}
.gift-log-user {
	color: var(--xn-primary);
	font-weight: 700;
	text-decoration: none;
}
.gift-log-action {
	color: var(--xn-text-muted);
	margin: 0 2px;
}
.gift-log-gift {
	color: var(--xn-text);
	font-weight: 600;
}
.gift-log-message {
	font-size: 13px;
	color: var(--xn-text-muted);
	margin-top: 3px;
	word-break: break-all;
}
.gift-log-date {
	margin-top: 4px;
	color: var(--xn-text-muted);
}
.gift-log-icon {
	flex: 0 0 40px;
	width: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 28px;
}
.gift-log-icon img {
	max-width: 40px;
	max-height: 40px;
	border-radius: 8px;
	object-fit: cover;
}

/* ============ 赠送成功：礼物雨掉落特效 ============ */
.xn-gift-fall {
	position: fixed;
	top: -64px;
	z-index: 10000;
	pointer-events: none;
	display: flex;
	align-items: center;
	justify-content: center;
	animation-name: xnGiftFall;
	animation-timing-function: linear;
	animation-fill-mode: forwards;
}
.xn-gift-fall img,
.xn-gift-fall span {
	display: block;
	width: 44px;
	height: 44px;
	line-height: 44px;
	text-align: center;
	font-size: 34px;
}
.xn-gift-fall img {
	max-width: 44px;
	max-height: 44px;
	object-fit: contain;
}
@keyframes xnGiftFall {
	0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
	25%  { transform: translateY(25vh) translateX(18px) rotate(90deg); }
	50%  { transform: translateY(50vh) translateX(-16px) rotate(180deg); }
	75%  { transform: translateY(75vh) translateX(14px) rotate(270deg); }
	100% { transform: translateY(110vh) rotate(360deg); opacity: .85; }
}

/* ============ 爆炸绽放特效（仿直播间礼物） ============ */
.xn-gift-explode {
	position: fixed;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	z-index: 10001;
	pointer-events: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34vmin;
	height: 34vmin;
	max-width: 220px;
	max-height: 220px;
}
.xn-gift-explode img,
.xn-gift-explode span {
	display: block;
	width: 100%;
	height: 100%;
	line-height: 1;
	text-align: center;
	font-size: 26vmin;
	max-width: 220px;
	max-height: 220px;
	animation: xnGiftExplode 2.8s cubic-bezier(.2, .8, .3, 1) forwards;
	filter: drop-shadow(0 8px 24px rgba(255, 92, 122, .45));
}
.xn-gift-explode img {
	object-fit: contain;
}

/* 爆炸四散粒子 */
.xn-gift-particle {
	position: fixed;
	left: 50%;
	top: 50%;
	z-index: 10001;
	pointer-events: none;
}
.xn-gift-particle img,
.xn-gift-particle span {
	display: block;
	width: 30px;
	height: 30px;
	line-height: 30px;
	text-align: center;
	font-size: 24px;
	animation: xnGiftParticle 1.8s ease-out forwards;
}
.xn-gift-particle img {
	max-width: 30px;
	max-height: 30px;
	object-fit: contain;
}

@keyframes xnGiftExplode {
	0%   { transform: scale(.2) rotate(-40deg); opacity: 0; }
	18%  { transform: scale(1.3) rotate(8deg); opacity: 1; }
	34%  { transform: scale(1.15) rotate(0deg); }
	60%  { transform: scale(1.18) rotate(0deg); opacity: 1; }
	78%  { transform: scale(1.12); opacity: 1; }
	100% { transform: scale(1.7) rotate(10deg); opacity: 0; }
}
@keyframes xnGiftParticle {
	0%   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
	100% { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(.35); opacity: 0; }
}
