<template>
  <view class="renaming-detail">
    <view class="detail-header">
      <view class="detail-header-back" @click="$emit('back')">
        <text class="back-icon">‹</text>
        <text class="back-text">返回</text>
      </view>
      <text class="detail-header-title">改名详解</text>
      <view class="detail-header-placeholder"></view>
    </view>

    <scroll-view scroll-y class="detail-content">
      <view class="hero-card">
        <text class="hero-name">{{ data?.name || '新名' }}</text>
        <text class="hero-pinyin">{{ data?.pinyin || '' }}</text>
      </view>

      <view class="section">
        <view class="section-title">
          <text class="section-icon">📖</text>
          <text class="section-text">寓意</text>
        </view>
        <view class="card">
          <text class="card-text">{{ data?.meaning || '' }}</text>
        </view>
      </view>

      <view class="section">
        <view class="section-title">
          <text class="section-icon">🪶</text>
          <text class="section-text">出处</text>
        </view>
        <view class="card">
          <text class="card-text">{{ data?.source || '' }}</text>
        </view>
      </view>

      <view class="section" v-if="data?.tags?.length">
        <view class="section-title">
          <text class="section-icon">🏷️</text>
          <text class="section-text">标签</text>
        </view>
        <view class="tag-row">
          <text v-for="(t, i) in data.tags" :key="i" class="tag">{{ t }}</text>
        </view>
      </view>

      <view class="bottom-spacer"></view>
    </scroll-view>
  </view>
</template>

<script setup lang="ts">
type Mode = 'personal' | 'company';

defineProps<{
  data: any;
  mode?: Mode;
}>();

defineEmits<{
  back: [];
}>();
</script>

<style scoped>
.renaming-detail {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #f0efe9;
  font-family: SimSun, "Songti SC", "Songti TC", "Noto Serif SC", STSong, serif;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24rpx 32rpx;
  border-bottom: 1px solid #eaddcf;
  background: rgba(253, 251, 247, 0.9);
}

.detail-header-back {
  display: flex;
  align-items: center;
  gap: 10rpx;
  color: #8b2323;
}

.back-icon {
  font-size: 22px;
  line-height: 1;
}

.back-text {
  font-size: 14px;
  font-weight: 700;
}

.detail-header-title {
  font-size: 16px;
  font-weight: 700;
  color: #2c2c2c;
  letter-spacing: 0.2em;
}

.detail-header-placeholder {
  width: 80rpx;
}

.detail-content {
  flex: 1;
  height: 0;
}

.hero-card {
  margin: 32rpx;
  padding: 32rpx;
  border-radius: 16rpx;
  border: 1px solid #dcd3c9;
  background: #fdfbf7;
}

.hero-name {
  font-size: 28px;
  font-weight: 700;
  color: #8b2323;
  display: block;
  margin-bottom: 8rpx;
}

.hero-pinyin {
  font-size: 12px;
  color: #5a5a5a;
}

.section {
  margin: 0 32rpx 28rpx;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12rpx;
  margin-bottom: 12rpx;
}

.section-icon {
  font-size: 14px;
}

.section-text {
  font-size: 14px;
  font-weight: 700;
  color: #2c2c2c;
}

.card {
  padding: 24rpx;
  border-radius: 16rpx;
  border: 1px solid #dcd3c9;
  background: #f9f7f2;
}

.card-text {
  font-size: 14px;
  color: #2c2c2c;
  line-height: 1.7;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12rpx;
}

.tag {
  font-size: 10px;
  padding: 6rpx 10rpx;
  border-radius: 8rpx;
  border: 1px solid rgba(139, 35, 35, 0.2);
  color: #8b2323;
  background: rgba(139, 35, 35, 0.04);
}

.bottom-spacer {
  height: 80rpx;
}
</style>
