<!--suppress JSFileReferences, NpmUsedModulesInstalled, VueMissingComponentImportInspection, HtmlUnknownTag -->
<script setup>
import { useCareerPathStore } from '@/stores/useCareerPathStore';


const store = useCareerPathStore();
</script>

<template>
<div class="career-path">
    <!-- 职业路径查询区域 -->
    <div class="query-section">
        <div class="section-title">
            <uni-icons color="#286BFA" size="18" type="search"></uni-icons>
            <span class="title-text">职业路径查询</span>
        </div>
        <div class="input-group">
            <div class="input-item">
                <span class="label">当前职位</span>
                <picker @change="store.eventProfession" :value="store.professionIndex" :range="store.professionsRef" range-key="label">
                    <div class="picker-field">
                        <span :class="store.professionLabel ? 'picker-text' : 'picker-placeholder'">
                            {{ store.professionLabel || '请选择职位' }}
                        </span>
                        <uni-icons color="#999999" size="16" type="down"></uni-icons>
                    </div>
                </picker>
            </div>
            <div class="input-item">
                <span class="label">目标职业</span>
                <picker :range="store.pathsRef" :value="store.targetCareerIndex" range-key="label" @change="store.eventTargetCareer">
                    <div class="picker-field">
                        <span :class="store.targetCareerLabel ? 'picker-text' : 'picker-placeholder'">
                            {{ store.targetCareerLabel || '请选择目标职业' }}
                        </span>
                        <uni-icons color="#999999" size="16" type="down"></uni-icons>
                    </div>
                </picker>
            </div>
            <button class="query-btn" @click="store.eventSearch">
                <span>查询职业发展路径</span>
                <uni-icons type="search" size="18" color="#FFFFFF"></uni-icons>
            </button>
        </div>
    </div>

    <!-- 职业发展路径区域 -->
    <div class="path-section">
        <div class="section-title">
            <uni-icons color="#000000" size="24" type="person-filled"></uni-icons>
            <text class="title-text">职业发展路径</text>
        </div>

        <div class="timeline">
            <div v-for="(step, index) in store.result" :key="index" class="timeline-item" :class="[step.type]">
                <div class="timeline-marker" :class="[`${step.type}-marker`]"></div>
                <div class="timeline-content">
                    <div v-if="step.type === 'start'" class="step-title">起点: {{ step.title }}</div>
                    <div v-else-if="step.type === 'end'" class="step-title">终点: {{ step.title }}</div>
                    <div v-else class="step-title">第{{ step.step }}步: {{ step.title }}</div>
                    <div class="skill-tags">
                        <div v-for="(skill, sIndex) in step.tags" :key="sIndex" class="skill-tag">{{ skill }}</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</template>

<style lang="scss" scoped>
.career-path {
    padding: 15rpx 42rpx 30rpx;
}

.card-content {
    display: flex;
    justify-content: space-between;
    align-items: center;

    .label {
        font-size: 36rpx;
        line-height: 51rpx;
        color: rgba(154, 154, 154, 1);
        text-align: left;
        font-family: 'PingFangSC-Bold', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
        font-weight: 600;
    }

    .value {
        font-size: 48rpx;
        line-height: 69rpx;
        color: rgb(16, 16, 16);
        font-weight: 600;
        text-align: left;
        font-family: 'PingFangSC-Bold', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;

        &.placeholder {
            font-weight: 500;
            color: #ccc;
        }
    }
}

.query-section {
    background-color: #FFFFFF;
    border-radius: 24rpx;
    padding: 42rpx;
    margin-bottom: 30rpx;
    box-shadow: 0 6rpx 18rpx rgba(0, 0, 0, 0.08);
}

.section-title {
    font-size: 48rpx;
    color: #000000;
    display: flex;
    align-items: center;
    gap: 18rpx;
    margin-bottom: 36rpx;
}

.title-text {
    font-size: 48rpx;
    font-weight: 600;
    color: #157DF0;
}

.input-label {
    font-size: 42rpx;
    color: #000000;
    font-weight: 500;
}

.input-field {
    background-color: #F5F5F5;
    border: 2rpx solid #E0E0E0;
    border-radius: 18rpx;
    padding: 30rpx 36rpx;
    font-size: 42rpx;
    color: #666666;
}

.path-summary {
    margin-top: 24rpx;
    font-size: 36rpx;
    color: #666666;
    text-align: center;
}

.path-section {
    background-color: #FFFFFF;
    border-radius: 24rpx;
    padding: 42rpx;
    box-shadow: 0 6rpx 18rpx rgba(0, 0, 0, 0.08);
}

.timeline {
    position: relative;
    padding-left: 60rpx;
}

.timeline-item {
    position: relative;
    margin-bottom: 48rpx;

    &:last-child {
        margin-bottom: 0;
    }

    &:not(:last-child)::before {
        content: '';
        position: absolute;
        left: -32rpx;
        top: 0;
        width: 3rpx;
        height: 100%;
        background: repeating-linear-gradient(
                to bottom,
                #E0E0E0 0,
                #E0E0E0 9rpx,
                transparent 9rpx,
                transparent 18rpx
        );
        transform: translateX(-50%);
        z-index: 1;
    }
}

.timeline-marker {
    position: absolute;
    left: -32rpx;
    top: 0;
    transform: translateX(-50%);
    width: 48rpx;
    height: 48rpx;
    border-radius: 50%;
    z-index: 2;
}

.start-marker {
    background-color: #FF4444;
    border: 6rpx solid #FFFFFF;
    box-shadow: 0 0 0 3rpx #FF4444;
}

.step-marker {
    background-color: #286BFA;
    border: 6rpx solid #FFFFFF;
    box-shadow: 0 0 0 3rpx #286BFA;
}

.end-marker {
    background-color: #52C41A;
    border: 6rpx solid #FFFFFF;
    box-shadow: 0 0 0 3rpx #52C41A;
}

.timeline-content {
    background-color: #F5F5F5;
    border-radius: 18rpx;
    padding: 36rpx;
    margin-left: 30rpx;
}

.step-title {
    font-size: 45rpx;
    font-weight: 600;
    color: #000000;
    margin-bottom: 24rpx;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 18rpx;
}

.skill-tag {
    background-color: #F0F0F0;
    color: #286BFA;
    padding: 12rpx 24rpx;
    border-radius: 12rpx;
    font-size: 36rpx;
    white-space: nowrap;
}

button::after {
    border: none;
}
</style>
