<template>
  <div class="knowledge-card">
    <div class="knowledge-header">
      <span class="knowledge-label">知识卡片</span>
      <span class="knowledge-keyword-tag" v-if="state.knowledge.keyword">#{{ state.knowledge.keyword }}</span>
    </div>
    <div class="knowledge-divider"></div>
    <div class="knowledge-body" v-if="state.knowledge.content">
      <span class="knowledge-quote">"</span>
      <span class="knowledge-text">{{ state.knowledge.content }}</span>
    </div>
    <div class="knowledge-placeholder" v-else>请在设置中配置知识关键字</div>
  </div>
</template>

<script setup lang="ts">
import { state } from '../composables/useOverlayState'
</script>

<style scoped>
.knowledge-card {
  display: flex; flex-direction: column;
  height: 100%;
}
.knowledge-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.knowledge-label {
  font-size: 11px; color: var(--text-faint);
  font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase;
}
.knowledge-keyword-tag {
  background: rgba(255,216,107,0.12);
  color: var(--accent-warm);
  padding: 2px 9px; border-radius: 4px;
  font-size: 10px; font-weight: 600;
  border: 1px solid rgba(255,216,107,0.15);
}
.knowledge-divider {
  height: 1px;
  background: linear-gradient(90deg, var(--accent-warm), rgba(255,216,107,0.08), transparent);
  margin-bottom: 16px;
}
.knowledge-body {
  position: relative;
  padding-left: 4px;
}
.knowledge-quote {
  position: absolute; top: -10px; left: -6px;
  font-size: 52px; line-height: 1;
  color: var(--accent-warm); opacity: 0.18;
  font-family: Georgia, serif; pointer-events: none;
}
.knowledge-text {
  font-size: 15px; color: var(--text-main);
  line-height: 1.7; text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  display: -webkit-box; -webkit-line-clamp: 8;
  -webkit-box-orient: vertical; overflow: hidden;
}
.knowledge-placeholder {
  font-size: 13px; color: var(--text-faint);
  font-style: italic; padding-top: 8px;
}
</style>
