<template>
  <div class="step-sidebar">
    <div class="steps-container">
      <div
        v-for="(step, index) in steps"
        :key="step.id"
        class="step-item"
      >
        <div class="step-indicator-wrapper">
          <div
            class="step-number"
            :class="{ 'step-number--active': currentStep === step.id }"
          >
            {{ step.id }}
          </div>
          <div
            v-if="index < steps.length - 1"
            class="step-line"
          />
        </div>
        <div class="step-content">
          <p
            class="step-title"
            :class="currentStep === step.id ? 'text-title-3-bold' : 'text-body-1'"
          >
            {{ step.title }}
          </p>
          <p class="step-desc text-tip-2">{{ step.description }}</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import type { Step } from '../api'

defineProps<{
  steps: Step[]
  currentStep: number
}>()
</script>

<style scoped>
.step-sidebar {
  width: 320px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-black-5);
  background-color: var(--bg-white-100);
  height: 100%;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.steps-container {
  width: 272px;
  display: flex;
  flex-direction: column;
}

.step-item {
  display: flex;
  gap: 16px;
  min-height: 80px;
  padding-bottom: 12px;
}

.step-item:last-child {
  padding-bottom: 0;
}

.step-indicator-wrapper {
  width: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.step-number {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 100px;
  font-size: 14px;
  font-family: "Microsoft YaHei", sans-serif;
  line-height: 22px;
  flex-shrink: 0;
  background-color: var(--bg-black-5);
  color: var(--text-primary-50-color);
}

.step-number--active {
  background-color: var(--color-primary-100);
  color: var(--bg-white-100);
}

.step-line {
  width: 1px;
  flex: 1;
  margin-top: 8px;
  background-color: var(--bg-black-5);
}

.step-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
  flex: 1;
}

.step-title {
  line-height: 24px;
  color: var(--text-primary-80-color);
  margin: 0;
}

.step-desc {
  line-height: 22px;
  color: var(--text-primary-65-color);
  margin: 0;
}
</style>
