<template>
  <div class="step-indicator">
    <div class="step" :class="{ active: currentStep === 1, completed: currentStep > 1 }">
      <div class="step-circle">
        <span v-if="currentStep <= 1" class="step-number" style="color: #fff;">1</span>
        <el-icon v-else class="step-check"><Check /></el-icon>
      </div>
      <span class="step-text">课程信息</span>
    </div>
    <div class="step-line" :class="{ completed: currentStep > 1 }"></div>
    <div class="step" :class="{ active: currentStep === 2, completed: currentStep > 2 }">
      <div class="step-circle">
        <span v-if="currentStep <= 2" class="step-number" style="color: #fff;">2</span>
        <el-icon v-else class="step-check"><Check /></el-icon>
      </div>
      <span class="step-text">章节与视频</span>
    </div>
    <div class="step-line" :class="{ completed: currentStep > 2 }"></div>
    <div class="step" :class="{ active: currentStep === 3, completed: currentStep > 3 }">
      <div class="step-circle">
        <span v-if="currentStep <= 3" class="step-number" style="color: #fff;">3</span>
        <el-icon v-else class="step-check"><Check /></el-icon>
      </div>
      <span class="step-text">预览提交</span>
    </div>
  </div>
</template>

<script setup>
import { Check } from '@element-plus/icons-vue'

defineProps({
  currentStep: {
    type: Number,
    required: true
  }
})
</script>

<style scoped>
/* 步骤指示器 - ins风格 */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
  padding: 20px 40px;
  background: #f5f5f5;
  border-radius: 12px;
  box-sizing: border-box;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 2;
}

.step-circle {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  border: 2px solid #e9ecef;
}

.step-number {
  font-size: 14px;
  font-weight: 600;
  color: #6c757d;
  transition: all 0.3s ease;
}

.step.active .step-circle {
  background: #000;
  border-color: #000;
}

.step.active .step-number {
  color: white;
}

.step.completed .step-circle {
  background: #fff;
  border-color: #000;
  border-width: 3px;
}

.step.completed .step-number {
  color: #000;
}

.step-check {
  font-size: 18px;
  color: #000;
  font-weight: bold;
}

.step-text {
  font-size: 14px;
  color: #6c757d;
  font-weight: 400;
  text-align: center;
  transition: all 0.3s ease;
  margin-top: 8px;
}

.step.active .step-text {
  color: #000;
  font-weight: 500;
}

.step.completed .step-text {
  color: #000;
  font-weight: 500;
}

.step-line {
  width: 80px;
  height: 3px;
  background: #e9ecef;
  margin: 0 20px;
  transition: all 0.3s ease;
  position: relative;
  top: -16px;
  z-index: 1;
}

.step-line.completed {
  background: #000;
}

/* 响应式 */
@media (max-width: 768px) {
  .step-indicator { 
    flex-direction: column; 
    gap: 20px; 
  }
  .step-line { 
    width: 2px; 
    height: 40px; 
  }
}
</style>
