<template>
	<view class="seckill-page">
		<view class="hero">
			<image class="hero-bg" src="/static/images/img/miaosha.jpg" mode="scaleToFill"></image>
			<view class="top-bar" :style="{'padding-top': menuButtonInfo.top + 'px'}">
				<view class="back-btn" @tap="back">
					<uni-icons type="left" size="26" color="#fff"></uni-icons>
				</view>
				<view class="page-title"></view>
				<view class="more-dot">...</view>
			</view>

			<view class="hero-content">
				<view class="hero-copy">
					<view class="hero-kicker">低价秒杀</view>
					<view class="hero-title">团美味 趣露营</view>
					<view class="hero-sub">限时开抢 · 拼着更划算</view>
				</view>
				<view class="hero-card">
					<view class="hero-bowl">团</view>
					<view class="hero-badge">立即抢</view>
				</view>
			</view>
		</view>

		<scroll-view class="tab-scroll" scroll-x>
			<view class="tab-list">
				<view class="tab-item" :class="{'active': checkedTab === item.key}" v-for="item in tabList" :key="item.key"
					@tap="switchTab(item.key)">
					{{item.name}}
				</view>
			</view>
		</scroll-view>

		<view class="hot-strip">
			<view class="hot-pill">爆款推荐</view>
			<view class="hot-line"></view>
			<view class="search-box">
				<uni-icons type="search" size="16" color="#ff6735"></uni-icons>
				<input type="text" placeholder="想吃什么" v-model="searchName" confirm-type="search" @confirm="goSearch" />
				<view class="search-btn" @tap="goSearch">搜索</view>
			</view>
		</view>

		<view class="sort-strip">
			<view class="sort-item" :class="{'active': sortType === ''}" @tap="setSort('')">随机推荐</view>
			<view class="sort-item" :class="{'active': sortType === 'asc'}" @tap="setSort('asc')">价格升序</view>
			<view class="sort-item" :class="{'active': sortType === 'desc'}" @tap="setSort('desc')">价格降序</view>
		</view>

		<view class="goods-list">
			<view class="goods-card" v-for="(item,index) in currentList" :key="item.id" @tap="grabItem(item)">
				<view class="goods-img-wrap">
					<image class="goods-img" :src="item.image" mode="aspectFill"></image>
					<view class="sweet-tag">{{item.tag}}</view>
				</view>
				<view class="goods-info">
					<view class="goods-title">{{item.title}}</view>
					<view class="sold-row">
						<view class="sold-bar">
							<view class="sold-progress" :style="{width: item.progress + '%'}"></view>
						</view>
						<text>已售999+</text>
					</view>
					<view class="coupon-row">
						<view class="coupon-tag" v-for="coupon in item.coupons" :key="coupon">{{coupon}}</view>
					</view>
					<view class="price-row">
						<view class="price-box">
							<text class="price-symbol">¥</text>
							<text class="price">{{item.price}}</text>
							<text class="price-desc">券后价</text>
						</view>
						<view class="grab-box">
							<view class="save-label">
								<text>{{item.save}}元</text>
								<text>已优惠</text>
							</view>
							<view class="grab-btn">抢</view>
						</view>
					</view>
				</view>
				<view class="rank-tag">TOP {{index + 1}}</view>
			</view>
		</view>

		<view class="coupon-float">
			<view class="coupon-icon">券</view>
			<view class="coupon-text">你有2元优惠券待使用 · 剩02:32:17</view>
			<image class="coupon-use" src="/static/images/img/loading.gif" mode="aspectFit"></image>
		</view>

		<uni-popup ref="specPopup" type="bottom" background-color="#fff">
			<view class="spec-popup">
				<view class="spec-close" @tap="$refs.specPopup.close()">
					<uni-icons type="close" size="28" color="#999"></uni-icons>
				</view>
				<view class="spec-product" v-if="currentItem">
					<image class="spec-product-img" :src="currentItem.image" mode="aspectFill"></image>
					<view class="spec-product-info">
						<view class="spec-product-title">{{currentItem.title}}</view>
						<view class="spec-product-price">
							<text class="spec-price-symbol">¥</text>{{currentItem.price}}
							<text class="spec-origin-price" v-if="currentItem.originalPrice">¥{{currentItem.originalPrice}}</text>
						</view>
					</view>
				</view>
				<scroll-view scroll-y class="spec-scroll">
					<view class="spec-group" v-for="(spec, sIndex) in parsedSpecs" :key="spec.name">
						<view class="spec-title">选{{spec.name}}（可选{{spec.canbuy}}个）</view>
						<view class="spec-options">
							<view :class="spec.selected.indexOf(option) !== -1 ? 'spec-option active' : 'spec-option'"
								v-for="option in spec.options" :key="option" @tap="selectSpec(sIndex, option)">
								{{option}}
							</view>
						</view>
					</view>
				</scroll-view>
				<view class="spec-submit" @tap="submitSeckillBuy">确认抢购</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				menuButtonInfo: {
					top: 0
				},
				regionId: '',
				checkedTab: '',
				tabList: [{
					name: '精选',
					key: ''
				}],
				seckillList: [],
				searchName: '',
				pageNum: 1,
				pageSize: 10,
				pages: 1,
				loadStatus: 'more',
				currentItem: null,
				parsedSpecs: [],
				sortType: ''
			}
		},
		computed: {
			currentList() {
				return this.seckillList
			}
		},
		onLoad() {
			this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
			this.initRegion()
		},
		onShow() {
			this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
		},
		onReachBottom() {
			if (this.pageNum >= this.pages || this.loadStatus === 'loading') return
			this.pageNum++
			this.getSeckillList()
		},
		methods: {
			initRegion() {
				const area = uni.getStorageSync('area')
				if (!area) {
					this.tui.toast('请先选择区域')
					return
				}
				try {
					const areaInfo = typeof area === 'string' ? JSON.parse(area) : area
					this.regionId = areaInfo.id || ''
				} catch (e) {
					this.regionId = ''
				}
				if (!this.regionId) {
					this.tui.toast('请先选择区域')
					return
				}
				this.getCategoryList()
			},
			getCategoryList() {
				this.tui.request("/app/seckillGroup/category/list", "GET", {
					regionId: this.regionId
				}, false, true).then((res) => {
					if (res.code == 200) {
						const list = Array.isArray(res.result) ? res.result : []
						this.tabList = [{
							name: '精选',
							key: ''
						}, ...list.map(item => ({
							name: item.categoryName,
							key: item.id
						}))]
						this.checkedTab = ''
						this.resetProductList()
						this.getSeckillList()
					} else {
						this.tui.toast(res.message)
					}
				}).catch(() => {})
			},
			getSeckillList() {
				if (!this.regionId) return
				this.loadStatus = 'loading'
				const data = {
					regionId: this.regionId,
					categoryId: this.checkedTab,
					keywords: this.searchName,
					pageNum: this.pageNum,
					pageSize: this.pageSize
				}
				if (this.sortType) {
					data.sort = 'seckillPrice'
					data.order = this.sortType
				}
				this.tui.request("/app/seckillGroup/product/page", "POST", data, false, false).then((res) => {
					this.loadStatus = 'nomore'
					if (res.code == 200) {
						const result = res.result || {}
						const records = Array.isArray(result.records) ? result.records : []
						const list = records.map(item => this.formatSeckillItem(item))
						if (this.pageNum == 1) {
							this.seckillList = list
						} else {
							this.seckillList = [...this.seckillList, ...list]
						}
						this.pages = result.pages || 1
					} else {
						this.tui.toast(res.message)
					}
				}).catch(() => {
					this.loadStatus = 'nomore'
				})
			},
			formatSeckillItem(item) {
				const totalStock = Number(item.totalStock || 0)
				const soldStock = Number(item.soldStock || 0)
				const originalPrice = Number(item.originalPrice || 0)
				const seckillPrice = Number(item.seckillPrice || 0)
				const save = Math.max(0, originalPrice - seckillPrice)
				return {
					id: item.id,
					productId: item.productId,
					category: item.categoryId,
					title: item.productName,
					image: item.productPicture,
					tag: this.getSpecTag(item),
					sold: soldStock > 10000 ? (soldStock / 10000).toFixed(1).replace('.0', '') + '万+' : soldStock + '+',
					progress: totalStock > 0 ? Math.min(100, Math.round(soldStock * 100 / totalStock)) : 0,
					coupons: ['秒杀价', '限时开抢', '库存' + (item.availableStock || 0)],
					price: seckillPrice.toFixed(2),
					save: save.toFixed(2),
					seckillPrice: seckillPrice,
					originalPrice: originalPrice.toFixed(2),
					availableStock: item.availableStock || 0,
					shopId: item.shopId,
					shopName: item.shopName,
					shopPhone: item.shopPhone,
					shopAddress: item.shopAddress,
					getAreaId: item.getAreaId,
					attributeList: item.attributeList,
					raw: item
				}
			},
			getSpecTag(item) {
				if (item.attributeList) {
					try {
						const attr = JSON.parse(item.attributeList)
						if (Array.isArray(attr) && attr.length > 0) {
							return attr[0].value || attr[0].title || item.unit || '秒杀'
						}
						if (typeof attr === 'object') {
							return attr.value || attr.title || item.unit || '秒杀'
						}
					} catch (e) {
						return item.attributeList
					}
				}
				return item.unit || '秒杀'
			},
			resetProductList() {
				this.pageNum = 1
				this.pages = 1
				this.seckillList = []
			},
			switchTab(key) {
				this.checkedTab = key
				this.resetProductList()
				this.getSeckillList()
			},
			goSearch() {
				this.resetProductList()
				this.getSeckillList()
			},
			setSort(type) {
				if (this.sortType === type) return
				this.sortType = type
				this.resetProductList()
				this.getSeckillList()
			},
			grabItem(item) {
				if (!item || !item.productId) {
					this.tui.toast('商品信息异常')
					return
				}
				if (Number(item.availableStock || 0) <= 0) {
					this.tui.toast('该商品已抢光')
					return
				}
				this.currentItem = item
				this.parsedSpecs = this.parseSpecs(item.attributeList)
				if (this.parsedSpecs.length > 0) {
					this.$refs.specPopup.open('bottom')
					return
				}
				this.goBuyFood(item, {})
			},
			parseSpecs(attributeList) {
				if (!attributeList || attributeList === '{}') return []
				try {
					const attrs = typeof attributeList === 'string' ? JSON.parse(attributeList) : attributeList
					if (Array.isArray(attrs)) return []
					const specs = []
					for (let key in attrs) {
						if (attrs[key] && attrs[key].title && attrs[key].title.length > 0) {
							specs.push({
								name: key,
								options: attrs[key].title,
								canbuy: attrs[key].canbuy || 1,
								selected: []
							})
						}
					}
					return specs
				} catch (e) {
					return []
				}
			},
			selectSpec(sIndex, option) {
				const spec = this.parsedSpecs[sIndex]
				const index = spec.selected.indexOf(option)
				if (index !== -1) {
					spec.selected.splice(index, 1)
				} else if (spec.selected.length < spec.canbuy) {
					spec.selected.push(option)
				} else if (spec.canbuy === 1) {
					spec.selected = [option]
				} else {
					this.tui.toast(spec.name + '最多选' + spec.canbuy + '个')
				}
				this.$forceUpdate()
			},
			submitSeckillBuy() {
				if (!this.currentItem) return
				const specs = {}
				for (let spec of this.parsedSpecs) {
					if (spec.selected.length === 0) {
						this.tui.toast('请选择' + spec.name)
						return
					}
					specs[spec.name] = spec.canbuy === 1 ? spec.selected[0] : spec.selected
				}
				this.$refs.specPopup.close()
				this.goBuyFood(this.currentItem, specs)
			},
			goBuyFood(item, specs) {
				const seckillPrice = Number(item.seckillPrice || (item.raw && item.raw.seckillPrice) || 0)
				const originalPrice = Number(item.originalPrice || (item.raw && item.raw.originalPrice) || 0)
				const product = {
					id: item.productId,
					productName: item.title,
					productPicture: item.image,
					attributeList: item.attributeList || '',
					attributeListPrice: JSON.stringify({
						default: {
							specPrice: seckillPrice.toFixed(2),
							originalPrice: originalPrice.toFixed(2)
						}
					}),
					price: originalPrice,
					seckillPrice: seckillPrice,
					originalPrice: originalPrice,
					lunchBox: 0,
					shopId: item.shopId,
					seckillGroupProductId: item.id
				}
				const cart = [{
					cartId: item.id + '_' + JSON.stringify(specs || {}),
					item: product,
					specs: specs,
					quantity: 1,
					price: seckillPrice.toFixed(2)
				}]
				const shopItem = {
					id: item.shopId,
					shopId: item.shopId,
					shopName: item.shopName,
					contactPhone: item.shopPhone,
					shopPhone: item.shopPhone,
					shopAddress: item.shopAddress,
					shopArea: item.getAreaId
				}
				uni.navigateTo({
					url: '/package1/buyFood/buyFood?cart=' + encodeURIComponent(JSON.stringify(cart)) +
						'&shopItem=' + encodeURIComponent(JSON.stringify(shopItem)) + '&packageFee=0'
				})
			},
			back() {
				uni.navigateBack()
			}
		}
	}
</script>

<style lang="scss" scoped>
	.seckill-page {
		min-height: 100vh;
		padding-bottom: 150rpx;
		background: linear-gradient(180deg, #ff6a2a 0%, #fff1df 260rpx, #fff8ee 520rpx, #f7fbf1 100%);
		box-sizing: border-box;
	}

	.hero {
		min-height: 372rpx;
		padding: 0 22rpx 24rpx;
		box-sizing: border-box;
		color: #fff;
		position: relative;
		overflow: hidden;
	}

	.hero-bg {
		width: 100%;
		height: 100%;
		position: absolute;
		top: 0;
		left: 0;
		z-index: 0;
	}

	.top-bar {
		height: 78rpx;
		display: flex;
		align-items: center;
		position: relative;
		z-index: 1;
	}

	.back-btn {
		width: 60rpx;
		height: 60rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.page-title {
		margin-left: 4rpx;
		font-size: 34rpx;
		font-weight: 900;
		letter-spacing: 2rpx;
		flex-shrink: 0;
	}

	.more-dot {
		margin-left: auto;
		width: 70rpx;
		height: 50rpx;
		border-radius: 999rpx;
		background: rgba(255, 255, 255, 0.2);
		line-height: 42rpx;
		text-align: center;
		font-size: 30rpx;
		font-weight: 900;
		flex-shrink: 0;
	}

	.search-box {
		flex: 1;
		height: 46rpx;
		padding: 0 8rpx 0 16rpx;
		border-radius: 999rpx;
		background: rgba(255, 255, 255, 0.94);
		display: flex;
		align-items: center;
		position: relative;
		z-index: 1;
		box-shadow: 0 14rpx 32rpx rgba(180, 40, 0, 0.18);
		box-sizing: border-box;
	}

	.search-box input {
		flex: 1;
		min-width: 0;
		height: 46rpx;
		padding-left: 8rpx;
		font-size: 22rpx;
		color: #6f5b4d;
	}

	.search-btn {
		width: 74rpx;
		height: 36rpx;
		border-radius: 999rpx;
		background: linear-gradient(135deg, #ff5b2e 0%, #ff9f2f 100%);
		color: #fff;
		font-size: 22rpx;
		font-weight: 900;
		line-height: 36rpx;
		text-align: center;
	}

	.hero-content {
		margin-top: 30rpx;
		display: flex;
		align-items: center;
		justify-content: flex-end;
		position: relative;
		z-index: 1;
	}

	.hero-copy {
		display: none;
	}

	.hero-kicker {
		display: inline-block;
		padding: 6rpx 18rpx;
		border-radius: 999rpx;
		background: rgba(255, 255, 255, 0.22);
		font-size: 22rpx;
		font-weight: 900;
	}

	.hero-title {
		margin-top: 18rpx;
		font-size: 58rpx;
		font-weight: 900;
		line-height: 70rpx;
		text-shadow: 0 8rpx 20rpx rgba(169, 40, 0, 0.25);
	}

	.hero-sub {
		margin-top: 12rpx;
		font-size: 26rpx;
		font-weight: 700;
		opacity: 0.92;
	}

	.hero-card {
		width: 230rpx;
		height: 210rpx;
		position: relative;
		animation: heroFloat 3s ease-in-out infinite;
	}

	.hero-bowl {
		width: 138rpx;
		height: 138rpx;
		margin: 24rpx auto 0;
		border-radius: 50%;
		background: linear-gradient(145deg, #fff 0%, #ffe8b9 100%);
		color: #ff5630;
		font-size: 60rpx;
		font-weight: 900;
		line-height: 138rpx;
		text-align: center;
		box-shadow: 0 20rpx 34rpx rgba(169, 40, 0, 0.22);
	}

	.hero-badge {
		width: 120rpx;
		height: 48rpx;
		border-radius: 999rpx;
		background: #fff;
		color: #ff4b25;
		font-size: 24rpx;
		font-weight: 900;
		line-height: 48rpx;
		text-align: center;
		position: absolute;
		right: 8rpx;
		bottom: 14rpx;
		box-shadow: 0 10rpx 18rpx rgba(169, 40, 0, 0.18);
		animation: badgeBeat 1.4s ease-in-out infinite;
	}

	.tab-scroll {
		width: 100%;
		margin-top: -34rpx;
		white-space: nowrap;
		position: relative;
		z-index: 2;
	}

	.tab-list {
		display: inline-flex;
		padding: 0 20rpx;
	}

	.tab-item {
		height: 58rpx;
		padding: 0 28rpx;
		margin-right: 14rpx;
		border-radius: 999rpx;
		background: rgba(255, 255, 255, 0.74);
		color: #7a6250;
		font-size: 26rpx;
		font-weight: 800;
		line-height: 58rpx;
		box-shadow: 0 10rpx 22rpx rgba(203, 99, 37, 0.08);
	}

	.tab-item.active {
		background: #fff;
		color: #ff4b25;
		box-shadow: 0 12rpx 24rpx rgba(255, 92, 38, 0.18);
	}

	.hot-strip {
		width: 95%;
		height: 64rpx;
		margin: 16rpx auto 8rpx;
		display: flex;
		align-items: center;
	}

	.hot-pill {
		width: 46%;
		flex-shrink: 0;
		height: 46rpx;
		border-radius: 999rpx;
		background: rgba(255, 221, 200, 0.72);
		color: #f05b32;
		font-size: 24rpx;
		font-weight: 900;
		line-height: 46rpx;
		text-align: center;
	}

	.hot-pill.light {
		background: rgba(255, 255, 255, 0.86);
		color: #d28a45;
	}

	.hot-line {
		width: 22rpx;
	}

	.sort-strip {
		width: 95%;
		margin: 0 auto 12rpx;
		display: flex;
		align-items: center;
	}

	.sort-item {
		height: 46rpx;
		padding: 0 20rpx;
		margin-right: 12rpx;
		border-radius: 999rpx;
		background: rgba(255, 255, 255, 0.72);
		color: #8a6b55;
		font-size: 22rpx;
		font-weight: 800;
		line-height: 46rpx;
		box-shadow: 0 8rpx 18rpx rgba(203, 99, 37, 0.08);
	}

	.sort-item.active {
		background: #fff0e9;
		color: #ff4b25;
		box-shadow: 0 10rpx 20rpx rgba(255, 92, 38, 0.15);
	}

	.goods-list {
		width: 95%;
		margin: 0 auto;
	}

	.goods-card {
		min-height: 220rpx;
		margin-bottom: 18rpx;
		padding: 14rpx 12rpx;
		border-radius: 28rpx;
		background: rgba(255, 255, 255, 0.96);
		display: flex;
		position: relative;
		box-shadow: 0 12rpx 28rpx rgba(118, 85, 55, 0.08);
		overflow: hidden;
	}

	.goods-card:active {
		transform: scale(0.98);
	}

	.goods-img-wrap {
		width: 218rpx;
		height: 218rpx;
		border-radius: 24rpx;
		position: relative;
		overflow: hidden;
		background: #ffeacf;
	}

	.goods-img {
		width: 100%;
		height: 100%;
	}

	.sweet-tag {
		position: absolute;
		left: 8rpx;
		bottom: 8rpx;
		padding: 6rpx 12rpx;
		border-radius: 999rpx;
		background: rgba(255, 255, 255, 0.92);
		color: #ff5d30;
		font-size: 20rpx;
		font-weight: 900;
	}

	.goods-info {
		flex: 1;
		min-width: 0;
		padding: 4rpx 4rpx 0 18rpx;
		box-sizing: border-box;
	}

	.goods-title {
		min-height: 64rpx;
		padding-right: 70rpx;
		color: #2f2a25;
		font-size: 30rpx;
		font-weight: 900;
		line-height: 36rpx;
	}

	.sold-row {
		height: 32rpx;
		display: flex;
		align-items: center;
		color: #9a8b7d;
		font-size: 22rpx;
	}

	.sold-bar {
		width: 120rpx;
		height: 14rpx;
		margin-right: 12rpx;
		border-radius: 999rpx;
		background: #ffe2d6;
		overflow: hidden;
	}

	.sold-progress {
		height: 100%;
		border-radius: 999rpx;
		background: linear-gradient(90deg, #ff4027 0%, #ffb33f 100%);
	}

	.coupon-row {
		min-height: 34rpx;
		margin-top: 8rpx;
		overflow: hidden;
	}

	.coupon-tag {
		display: inline-block;
		margin: 0 8rpx 8rpx 0;
		padding: 4rpx 8rpx;
		border: 1rpx solid #ffbdd0;
		border-radius: 8rpx;
		color: #d85275;
		font-size: 20rpx;
		line-height: 24rpx;
		background: #fff7f9;
	}

	.price-row {
		margin-top: 2rpx;
		display: flex;
		align-items: flex-end;
		justify-content: space-between;
	}

	.price-box {
		color: #f4431f;
		font-weight: 900;
	}

	.price-symbol {
		font-size: 28rpx;
	}

	.price {
		font-size: 46rpx;
	}

	.price-desc {
		margin-left: 6rpx;
		color: #b56d52;
		font-size: 22rpx;
	}

	.grab-box {
		display: flex;
		align-items: center;
		border-radius: 18rpx;
		overflow: hidden;
		box-shadow: 0 10rpx 18rpx rgba(255, 83, 34, 0.22);
	}

	.save-label {
		width: 88rpx;
		height: 70rpx;
		background: linear-gradient(135deg, #fff2a8 0%, #ffd277 100%);
		color: #9d5920;
		font-size: 20rpx;
		font-weight: 900;
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		line-height: 26rpx;
	}

	.grab-btn {
		width: 76rpx;
		height: 78rpx;
		background: linear-gradient(135deg, #ff6735 0%, #ff2f0e 100%);
		color: #fff;
		font-size: 40rpx;
		font-weight: 900;
		line-height: 78rpx;
		text-align: center;
		animation: badgeBeat 1.4s ease-in-out infinite;
	}

	.rank-tag {
		position: absolute;
		top: 14rpx;
		right: 16rpx;
		padding: 4rpx 10rpx;
		border-radius: 999rpx;
		background: #fff1cc;
		color: #d97928;
		font-size: 18rpx;
		font-weight: 900;
	}

	.coupon-float {
		width: 92%;
		height: 76rpx;
		padding: 0 12rpx;
		border-radius: 999rpx;
		background: rgba(255, 255, 255, 0.94);
		display: flex;
		align-items: center;
		position: fixed;
		left: 4%;
		bottom: 32rpx;
		z-index: 10;
		box-shadow: 0 14rpx 34rpx rgba(255, 88, 33, 0.18);
		box-sizing: border-box;
	}

	.coupon-icon {
		width: 42rpx;
		height: 42rpx;
		border-radius: 50%;
		background: #ff2f6c;
		color: #fff;
		font-size: 22rpx;
		font-weight: 900;
		line-height: 42rpx;
		text-align: center;
	}

	.coupon-text {
		flex: 1;
		padding-left: 12rpx;
		color: #704a3c;
		font-size: 24rpx;
		font-weight: 800;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.coupon-use {
		width: 112rpx;
		height: 52rpx;
		border-radius: 999rpx;
		display: block;
	}

	.spec-popup {
		width: 100%;
		max-height: 78vh;
		padding: 28rpx 28rpx 40rpx;
		border-radius: 36rpx 36rpx 0 0;
		background: #fff;
		box-sizing: border-box;
		position: relative;
	}

	.spec-close {
		position: absolute;
		top: 24rpx;
		right: 24rpx;
		z-index: 2;
	}

	.spec-product {
		display: flex;
		padding-right: 60rpx;
	}

	.spec-product-img {
		width: 150rpx;
		height: 150rpx;
		border-radius: 22rpx;
		background: #ffeacf;
		flex-shrink: 0;
	}

	.spec-product-info {
		flex: 1;
		min-width: 0;
		padding-left: 20rpx;
	}

	.spec-product-title {
		min-height: 74rpx;
		color: #2f2a25;
		font-size: 30rpx;
		font-weight: 900;
		line-height: 38rpx;
	}

	.spec-product-price {
		margin-top: 18rpx;
		color: #f4431f;
		font-size: 42rpx;
		font-weight: 900;
	}

	.spec-price-symbol {
		font-size: 26rpx;
	}

	.spec-origin-price {
		margin-left: 14rpx;
		color: #aaa;
		font-size: 24rpx;
		text-decoration: line-through;
	}

	.spec-scroll {
		max-height: 46vh;
		margin-top: 28rpx;
	}

	.spec-group {
		margin-bottom: 24rpx;
	}

	.spec-title {
		color: #3c312a;
		font-size: 28rpx;
		font-weight: 900;
		line-height: 64rpx;
	}

	.spec-options {
		display: flex;
		flex-wrap: wrap;
	}

	.spec-option {
		min-width: 116rpx;
		height: 66rpx;
		padding: 0 24rpx;
		margin: 0 18rpx 18rpx 0;
		border-radius: 18rpx;
		background: #f7f8f8;
		color: #6f5b4d;
		font-size: 26rpx;
		font-weight: 700;
		line-height: 66rpx;
		text-align: center;
		box-sizing: border-box;
	}

	.spec-option.active {
		background: #fff0e9;
		color: #ff4b25;
		border: 2rpx solid #ff6735;
		line-height: 62rpx;
	}

	.spec-submit {
		width: 92%;
		height: 88rpx;
		margin: 20rpx auto 0;
		border-radius: 999rpx;
		background: linear-gradient(135deg, #ff6735 0%, #ff2f0e 100%);
		color: #fff;
		font-size: 30rpx;
		font-weight: 900;
		line-height: 88rpx;
		text-align: center;
		box-shadow: 0 14rpx 28rpx rgba(255, 83, 34, 0.22);
	}

	@keyframes heroFloat {
		0%,
		100% {
			transform: translateY(0);
		}

		50% {
			transform: translateY(-12rpx);
		}
	}

	@keyframes badgeBeat {
		0%,
		100% {
			transform: scale(1);
		}

		50% {
			transform: scale(1.08);
		}
	}
</style>
