<template>
  <div class="step2-card">
    <!-- 左侧：说明区域 -->
    <div class="step2-info">
      <div class="step2-badge">Step 2</div>
      <h2 class="step2-title">每日签到，积分到手</h2>
      <p class="step2-desc">
        每天来签到，轻松赚取积分奖励！<br />
        <strong>连续签到</strong>还能获得额外加成 🎁
      </p>

      <!-- 签到日历示意 -->
      <div class="checkin-preview">
        <div class="preview-header">
          <span class="preview-weekday" v-for="d in weekDays" :key="d">{{ d }}</span>
        </div>
        <div class="preview-row">
          <div
            v-for="(day, idx) in checkinDays"
            :key="idx"
            class="preview-day"
            :class="{
              checked: day.checked,
              today: day.isToday,
              reward: day.isReward,
            }"
          >
            <span class="day-num">{{ day.num }}</span>
            <span v-if="day.isReward" class="day-bonus">+{{ day.bonus }}</span>
          </div>
        </div>
      </div>

      <div class="step2-tip">
        <span class="tip-icon">💡</span>
        <span>连续签到 7 天可领取额外积分大礼包</span>
      </div>
    </div>

    <!-- 右侧：操作指引 -->
    <div class="step2-action">
      <div class="action-arrow-area">
        <div class="arrow-text">点击左侧菜单</div>
        <div class="arrow-icon">「每日签到」</div>
        <div class="arrow-down">
          <svg width="40" height="40" viewBox="0 0 40 40" fill="none">
            <path d="M20 8 L20 30" stroke="#2C6FBF" stroke-width="2.5" stroke-linecap="round" />
            <path d="M12 22 L20 30 L28 22" stroke="#2C6FBF" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" />
          </svg>
        </div>
      </div>

      <button class="btn-checkin" @click="handleGoSignIn">
        <span class="btn-icon">✅</span>
        去签到
      </button>
      <button v-if="false" class="btn-next" @click="$emit('next')">
        {{ isLast ? '完成新手教程 ✓' : '下一步' }}
      </button>
      <button class="btn-prev" v-if="!isFirst" @click="$emit('prev')">
        上一步
      </button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'SignInGuide',
  props: {
    isLast: {
      type: Boolean,
      default: false,
    },
    isFirst: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      weekDays: ['一', '二', '三', '四', '五', '六', '日'],
      checkinDays: [
        { num: 1, checked: true, isToday: false, isReward: false, bonus: 0 },
        { num: 2, checked: true, isToday: false, isReward: false, bonus: 0 },
        { num: 3, checked: true, isToday: false, isReward: false, bonus: 0 },
        { num: 4, checked: true, isToday: true, isReward: true, bonus: 10 },
        { num: 5, checked: false, isToday: false, isReward: false, bonus: 0 },
        { num: 6, checked: false, isToday: false, isReward: false, bonus: 0 },
        { num: 7, checked: false, isToday: false, isReward: true, bonus: 30 },
      ],
    }
  },
  methods: {
    handleGoSignIn() {
      // 跳转到签到页
      this.$router.push('/home/signIn')
      // 延迟后自动进入下一步
      setTimeout(() => {
        this.$emit('next')
      }, 500)
    },
  },
}
</script>

<style scoped>
.step2-card {
  width: 560px;
  max-width: 92vw;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  animation: cardFloat 0.5s ease-out;
}

@keyframes cardFloat {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ---- 左侧信息区 ---- */
.step2-info {
  flex: 1;
  padding: 32px 28px 28px;
}

.step2-badge {
  display: inline-block;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #2C6FBF;
  background: #eaf2ff;
  border-radius: 12px;
  margin-bottom: 16px;
}

.step2-title {
  font-size: 20px;
  font-weight: 700;
  color: #1d2129;
  margin: 0 0 10px;
}

.step2-desc {
  font-size: 14px;
  line-height: 1.7;
  color: #86909c;
  margin: 0 0 20px;
}

.step2-desc strong {
  color: #2C6FBF;
}

/* ---- 签到日历预览 ---- */
.checkin-preview {
  background: #f7f9fc;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
}

.preview-header {
  display: flex;
  margin-bottom: 8px;
}

.preview-weekday {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: #86909c;
  font-weight: 500;
}

.preview-row {
  display: flex;
  gap: 4px;
}

.preview-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  border-radius: 8px;
  transition: all 0.25s;
  position: relative;
}

.preview-day.checked {
  background: #eaf2ff;
}

.preview-day.today {
  background: #2C6FBF;
  box-shadow: 0 2px 8px rgba(44, 111, 191, 0.3);
}

.preview-day.today .day-num {
  color: #fff;
  font-weight: 700;
}

.preview-day.reward:not(.checked) {
  background: linear-gradient(135deg, #fff5e6, #fff0d6);
  border: 1px dashed #f5a623;
}

.day-num {
  font-size: 14px;
  font-weight: 600;
  color: #4e5969;
}

.day-bonus {
  font-size: 9px;
  color: #f5a623;
  font-weight: 700;
}

/* ---- 提示条 ---- */
.step2-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #fff9e6, #fff3cc);
  border-radius: 8px;
  font-size: 12px;
  color: #b8860b;
}

.tip-icon {
  font-size: 16px;
}

/* ---- 右侧操作区 ---- */
.step2-action {
  width: 180px;
  background: linear-gradient(180deg, #f0f6ff 0%, #e4eeff 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  border-left: 1px solid #e5eaf2;
}

.action-arrow-area {
  text-align: center;
  margin-bottom: 24px;
}

.arrow-text {
  font-size: 13px;
  color: #86909c;
  margin-bottom: 6px;
}

.arrow-icon {
  font-size: 18px;
  font-weight: 700;
  color: #2C6FBF;
  margin-bottom: 12px;
}

.arrow-down {
  animation: arrowBounce 1.5s ease-in-out infinite;
}

@keyframes arrowBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

.btn-checkin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #2C6FBF, #5B9FE6);
  border: none;
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(44, 111, 191, 0.3);
  white-space: nowrap;
}

.btn-checkin:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(44, 111, 191, 0.45);
}

.btn-checkin:active {
  transform: translateY(0);
}

.btn-icon {
  font-size: 18px;
}

.btn-next {
  margin-top: 12px;
  width: 100%;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #2C6FBF;
  background: #fff;
  border: 1.5px solid #2C6FBF;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.25s;
  white-space: nowrap;
}

.btn-next:hover {
  background: #eaf2ff;
  transform: translateY(-1px);
}

.btn-next:active {
  transform: translateY(0);
}

.btn-prev {
  margin-top: 12px;
  width: 100%;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: #86909c;
  background: #f0f2f5;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.25s;
  white-space: nowrap;
}

.btn-prev:hover {
  color: #4e5969;
  background: #e5e8ed;
}
</style>
