<template>
  <el-card class="result-card">
    <el-row>
      <el-col :span="12">
        <h3 class="result-title">{{ item.title }}</h3>
        <p v-if="item.summary" class="result-summary">
          {{ item.summary }}
        </p>
        <p v-if="item.sectionType" class="result-type">
          <span>{{ $t('search.section') }}: </span>
          <span class="result-type-name">{{ typeLabel }}</span>
          <span v-if="item.type" class="result-type-name"
            >({{ item.type }})</span
          >
        </p>
      </el-col>
      <el-col :span="12" class="image-col">
        <el-image
          v-if="item.thumbnail"
          :src="item.thumbnail"
          :alt="item.title"
          style="width: 150px"
        />
      </el-col>
    </el-row>
  </el-card>
</template>

<script setup lang="ts">
  defineProps<{
    item: SearchItemView;
    typeLabel: string;
  }>();
</script>

<style scoped>
  .result-card {
    border-radius: 12px;
    transition: box-shadow 0.2s ease;
  }

  .result-card:hover {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
  }

  .result-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--el-color-primary);
    display: inline-block;
  }

  .result-summary {
    font-size: 0.95rem;
    color: var(--el-text-color-regular);
    margin-bottom: 0.5rem;
    line-height: 1.6;
  }

  .result-type {
    font-size: 0.8rem;
    color: var(--el-text-color-secondary);
  }

  .result-type-name {
    margin-left: 4px;
    color: var(--el-color-primary);
  }

  .image-col {
    display: flex;
    justify-content: end;
    align-items: center;
  }
</style>
