<!--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: 10rpx 28rpx 20rpx;
}

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

    .label {
        font-size: 24rpx;
        line-height: 34rpx;
        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: 32rpx;
        line-height: 46rpx;
        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: 16rpx;
    padding: 28rpx;
    margin-bottom: 20rpx;
    box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
}

.section-title {
    font-size: 32rpx;
    color: #000000;
    display: flex;
    align-items: center;
    gap: 12rpx;
    margin-bottom: 24rpx;
}

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

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

.input-field {
    background-color: #F5F5F5;
    border: 1rpx solid #E0E0E0;
    border-radius: 12rpx;
    padding: 20rpx 24rpx;
    font-size: 28rpx;
    color: #666666;
}

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

.path-section {
    background-color: #FFFFFF;
    border-radius: 16rpx;
    padding: 28rpx;
    box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
}

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

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

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

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

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

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

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

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

.timeline-content {
    background-color: #F5F5F5;
    border-radius: 12rpx;
    padding: 24rpx;
    margin-left: 20rpx;
}

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

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

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

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