<template>
  <view class="page-prefs">
    <view class="header">
      <text class="title">🎯 我的偏好</text>
      <text class="subtitle">AI根据盲选记录自动分析</text>
    </view>

    <!-- 偏好雷达图 -->
    <view class="radar-card card">
      <text class="section-title">偏好雷达</text>
      <view class="radar-bars">
        <view class="bar-row" v-for="bar in bars" :key="bar.label">
          <text class="bar-label">{{ bar.icon }} {{ bar.label }}</text>
          <view class="bar-track">
            <view class="bar-fill" :style="{ width: bar.value + '%', background: bar.color }"></view>
          </view>
          <text class="bar-value">{{ bar.value }}%</text>
        </view>
      </view>
    </view>

    <!-- 品类排名 -->
    <view class="category-rank card">
      <text class="section-title">品类偏好</text>
      <view class="rank-item" v-for="item in categoryRank" :key="item.name">
        <text class="rank-icon">{{ item.icon }}</text>
        <view class="rank-info">
          <text class="rank-name">{{ item.name }}</text>
          <view class="rank-bar">
            <view class="rank-fill" :style="{ width: item.value + '%' }"></view>
          </view>
        </view>
      </view>
    </view>

    <!-- 用户标签 -->
    <view class="tags-card card">
      <text class="section-title">AI标签</text>
      <view class="user-tags">
        <text class="user-tag" v-for="tag in userTags" :key="tag">{{ tag }}</text>
      </view>
    </view>

    <!-- 去重设置 -->
    <view class="settings-card card">
      <text class="section-title">设置</text>
      <view class="setting-row">
        <text class="setting-label">去重天数</text>
        <text class="setting-value">{{ repeatDays }} 天内不重复推荐</text>
      </view>
    </view>
  </view>
</template>

<script setup>
import { ref } from 'vue'

const bars = ref([
  { label: '口味', icon: '🍽️', value: 75, color: '#FF6B35' },
  { label: '品质', icon: '⭐', value: 60, color: '#FFD700' },
  { label: '性价比', icon: '💰', value: 45, color: '#4CAF50' },
  { label: '距离', icon: '📍', value: 80, color: '#2196F3' },
  { label: '探索度', icon: '🌍', value: 35, color: '#9C27B0' },
])

const categoryRank = ref([
  { name: '日料', icon: '🍣', value: 85 },
  { name: '火锅', icon: '🍲', value: 70 },
  { name: '西餐', icon: '🥩', value: 55 },
  { name: '甜品', icon: '🍰', value: 40 },
  { name: '剧本杀', icon: '🔍', value: 30 },
])

const userTags = ref(['日料控', '品质型', '探索型', '周末达人'])
const repeatDays = ref(7)
</script>

<style lang="scss" scoped>
.page-prefs {
  min-height: 100vh;
  background: #f5f5f5;
}

.header {
  background: linear-gradient(135deg, #667eea, #764ba2);
  padding: 80rpx 30rpx 40rpx;
  color: #fff;
  text-align: center;
  .title { font-size: 36rpx; font-weight: 700; display: block; }
  .subtitle { font-size: 24rpx; opacity: 0.8; margin-top: 8rpx; display: block; }
}

.card {
  background: #fff;
  border-radius: 20rpx;
  padding: 24rpx;
  margin: 20rpx 24rpx;
  box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.06);
}

.section-title {
  font-size: 28rpx;
  font-weight: 700;
  display: block;
  margin-bottom: 16rpx;
}

.bar-row {
  display: flex;
  align-items: center;
  padding: 12rpx 0;
  .bar-label {
    width: 140rpx;
    font-size: 24rpx;
  }
  .bar-track {
    flex: 1;
    height: 16rpx;
    background: #f0f0f0;
    border-radius: 8rpx;
    margin: 0 16rpx;
    overflow: hidden;
    .bar-fill {
      height: 100%;
      border-radius: 8rpx;
      transition: width 0.6s ease;
    }
  }
  .bar-value {
    font-size: 22rpx;
    color: #666;
    width: 50rpx;
    text-align: right;
  }
}

.rank-item {
  display: flex;
  align-items: center;
  padding: 16rpx 0;
  border-bottom: 1rpx solid #f5f5f5;
  .rank-icon { font-size: 32rpx; width: 44rpx; }
  .rank-info { flex: 1; margin-left: 12rpx; }
  .rank-name { font-size: 26rpx; color: #333; display: block; }
  .rank-bar {
    height: 8rpx;
    background: #f0f0f0;
    border-radius: 4rpx;
    margin-top: 8rpx;
    overflow: hidden;
    .rank-fill {
      height: 100%;
      background: linear-gradient(90deg, #FF6B35, #FF8C42);
      border-radius: 4rpx;
    }
  }
}

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

.user-tag {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  padding: 8rpx 20rpx;
  border-radius: 20rpx;
  font-size: 24rpx;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12rpx 0;
  .setting-label { font-size: 26rpx; color: #333; }
  .setting-value { font-size: 24rpx; color: #999; }
}
</style>
