<template>
  <div class="chat-prompt-input">
    <input type="text" class="input-box" placeholder="请输入..." v-model="inputText" @keyup.enter="handleSend" />
    <button class="send-button" @click="handleSend">发送</button>
  </div>
</template>

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

const inputText = ref('')
const emit = defineEmits(['send'])

const handleSend = () => {
  if (inputText.value.trim()) {
    emit('send', inputText.value)
    inputText.value = ''
  }
}
</script>

<style scoped>
.chat-prompt-input {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 928px;
  height: 74.01px;
  display: flex;
  align-items: center;
  padding: 10px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.input-box {
  flex: 1;
  height: 100%;
  padding: 0 15px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s;
}

.input-box:focus {
  border-color: #1a73e8;
}

.send-button {
  margin-left: 10px;
  padding: 0 20px;
  height: 100%;
  background-color: #1a73e8;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
}

.send-button:hover {
  background-color: #1557b0;
}
</style>