<script setup lang="ts">
const props = defineProps<{
  show: boolean;
  systemPrompt: string;
}>();

const emit = defineEmits<{
  close: [];
}>();
</script>

<template>
  <Teleport to="body">
    <div v-if="show" class="agent-prompt-overlay" @click="emit('close')">
      <div class="agent-prompt-modal" @click.stop>
        <div class="modal-header">
          <h3 class="modal-title">系统提示词</h3>
          <button class="modal-close" @click="emit('close')">
            <Icon name="lucide:x" />
          </button>
        </div>
        <div class="modal-body">
          <pre class="prompt-content">{{ systemPrompt || "（未设置系统提示词）" }}</pre>
        </div>
      </div>
    </div>
  </Teleport>
</template>

<style scoped>
.agent-prompt-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 19, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.agent-prompt-modal {
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  background: var(--color-surface-card);
  border: 1px solid var(--color-hairline);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-hairline);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  color: var(--color-ink);
  margin: 0;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  color: var(--color-muted);
  font-size: 18px;
  transition: all 0.15s;
}

.modal-close:hover {
  background: var(--color-surface-soft);
  color: var(--color-ink);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.prompt-content {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-body);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}
</style>
