<template>
	<view class="bs">
		<view class="bs-head">
			<view>
				<text class="bs-kicker">ENERGY SHELF</text>
				<text class="bs-title">BUFF 能量站</text>
			</view>
			<text class="bs-sub">当前 {{myTicket}} 券</text>
		</view>
		<scroll-view scroll-x class="bs-scroll" show-scrollbar="false">
			<view class="bs-row">
				<view class="bs-card" v-for="(b, i) in list" :key="i" :class="{active: b.active}" @tap="onBuy(b)">
					<view class="bs-card-emoji">{{buffEmoji(b.type)}}</view>
					<view class="bs-card-name">{{b.name}}</view>
					<view class="bs-card-desc">{{b.description}}</view>
					<view class="bs-card-foot">
						<text class="bs-card-cost" v-if="!b.active">{{b.costTickets}} 券</text>
						<text class="bs-card-cost active" v-else>生效中</text>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		props: {
			list: {
				type: Array,
				default: () => []
			},
			myTicket: {
				type: Number,
				default: 0
			}
		},
		methods: {
			buffEmoji(type) {
				const map = {
					double: '2X',
					shield: '盾',
					lucky: 'LU',
					hunt: '追',
					stealth: '隐'
				}
				return map[type] || 'UP'
			},
			onBuy(b) {
				this.$emit('buy', b)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.bs {
		margin-top: 34rpx;
	}

	.bs-head {
		display: flex;
		align-items: flex-end;
		justify-content: space-between;
		margin-bottom: 18rpx;
	}

	.bs-kicker {
		display: block;
		color: #59CBB5;
		font-size: 18rpx;
		font-weight: 900;
		letter-spacing: 3rpx;
		margin-bottom: 4rpx;
	}

	.bs-title {
		display: block;
		color: #12342F;
		font-size: 36rpx;
		font-weight: 900;
	}

	.bs-sub {
		color: #7E9691;
		font-size: 22rpx;
		font-weight: 700;
	}

	.bs-scroll {
		width: 100%;
		white-space: nowrap;
	}

	.bs-row {
		display: inline-flex;
		padding-bottom: 12rpx;
	}

	.bs-card {
		display: inline-block;
		width: 218rpx;
		min-height: 240rpx;
		margin-right: 20rpx;
		padding: 24rpx;
		border-radius: 36rpx;
		background: linear-gradient(155deg, rgba(255,255,255,0.9), rgba(241,255,249,0.72));
		border: 2rpx solid rgba(255,255,255,0.9);
		white-space: normal;
		vertical-align: top;
		box-shadow: 0 18rpx 42rpx rgba(53,214,166,0.09);
		position: relative;
		overflow: hidden;
	}

	.bs-card:before {
		content: '';
		position: absolute;
		right: -36rpx;
		top: -38rpx;
		width: 130rpx;
		height: 130rpx;
		border-radius: 50%;
		background: rgba(210,247,255,0.72);
	}

	.bs-card.active {
		border-color: rgba(53,214,166,0.45);
		box-shadow: 0 20rpx 46rpx rgba(53,214,166,0.16);
	}

	.bs-card-emoji {
		position: relative;
		width: 70rpx;
		height: 70rpx;
		line-height: 70rpx;
		text-align: center;
		border-radius: 24rpx;
		background: linear-gradient(145deg, rgba(255,255,255,0.95), rgba(213,248,255,0.9));
		color: #22B889;
		border: 2rpx solid rgba(255,255,255,0.95);
		box-shadow: 0 12rpx 26rpx rgba(79,183,255,0.12);
		font-size: 24rpx;
		font-weight: 900;
		font-family: DIN, Arial, sans-serif;
	}

	.bs-card-name {
		position: relative;
		margin-top: 14rpx;
		color: #12342F;
		font-size: 28rpx;
		font-weight: 900;
	}

	.bs-card-desc {
		position: relative;
		margin-top: 8rpx;
		color: #7E9691;
		font-size: 20rpx;
		min-height: 56rpx;
		line-height: 28rpx;
	}

	.bs-card-foot {
		position: relative;
		margin-top: 14rpx;
	}

	.bs-card-cost {
		display: inline-block;
		padding: 8rpx 20rpx;
		border-radius: 999rpx;
		background: linear-gradient(135deg, #DFFBF1, #E8F6FF);
		color: #22B889;
		border: 1rpx solid rgba(255,255,255,0.95);
		font-size: 22rpx;
		font-weight: 900;
	}

	.bs-card-cost.active {
		background: rgba(53,214,166,0.12);
		color: #22B889;
	}
</style>
