<template>
  <div class="guide-card wide">
    <div class="guide-illustration short" style="background: linear-gradient(135deg, #e87722 0%, #f9ca24 100%);">
      <div class="illus-bubble bubble-1">🎫</div>
      <div class="illus-bubble bubble-2">🎁</div>
      <div class="illus-center">🎟️</div>
    </div>

    <div class="guide-body compact">
      <div class="guide-badge compact">Step 8</div>
      <h2 class="guide-title small">个人中心 — 礼品券兑换</h2>
      <p class="guide-desc compact">在「我的礼品券」Tab 管理你的礼品券，两步轻松使用：</p>

      <!-- 截图引导 -->
      <div class="screenshot-list">
        <div class="screenshot-item">
          <div class="screenshot-num">1</div>
          <div class="screenshot-content">
            <img class="screenshot-img" :src="step1Img" alt="点击去使用" />
            <p class="screenshot-label">点击礼品券上的「去使用」按钮</p>
          </div>
        </div>
        <div class="screenshot-item">
          <div class="screenshot-num">2</div>
          <div class="screenshot-content">
            <img class="screenshot-img" :src="step2Img" alt="使用礼品券" />
            <p class="screenshot-label">选择商品，确认订单，礼品券自动抵扣</p>
          </div>
        </div>
      </div>
    </div>

    <div class="guide-footer compact">
      <button class="btn-primary" @click="handleGoCoupon">
        <span>🎫</span> 查看礼品券
      </button>
      <button class="btn-prev" v-if="!isFirst" @click="$emit('prev')">
        上一步
      </button>
    </div>
  </div>
</template>

<script>
import { setTab } from '@/utils/auth'
import step1Img from '@/assets/image/newUserGuide/step1.png'
import step2Img from '@/assets/image/newUserGuide/step2.png'

export default {
  name: 'CouponGuideV2',
  props: {
    isLast: { type: Boolean, default: false },
    isFirst: { type: Boolean, default: false },
    isReplay: { type: Boolean, default: false },
  },
  data() {
    return {
      step1Img,
      step2Img,
    }
  },
  methods: {
    handleGoCoupon() {
      setTab('welfare')
      // 先跳首页再跳 myCenter，确保组件重新 created 读取 Cookie
      this.$router.push('/home').then(() => {
        this.$router.push('/myCenter')
      })
      setTimeout(() => this.$emit('next'), 800)
    },
  },
}
</script>

<style scoped>
@import './guide-common.css';

/* Step 8 V2 专属样式 */
.guide-badge { color: #e87722; background: #fff4e8; }
.btn-primary {
  background: linear-gradient(135deg, #e87722, #f9ca24);
  box-shadow: 0 4px 14px rgba(232,119,34,0.3);
}
.btn-primary:hover { box-shadow: 0 6px 18px rgba(232,119,34,0.45); }

/* 截图引导 */
.screenshot-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.screenshot-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.screenshot-num {
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: #e87722;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
.screenshot-content {
  flex: 1;
}
.screenshot-img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #f0e6d8;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.screenshot-label {
  font-size: 12px;
  color: #86909c;
  margin: 6px 0 0;
  line-height: 1.5;
}
</style>
