<script setup lang="ts">
import { useRouter, useRoute } from 'vue-router';

const router = useRouter();
const route = useRoute();

// 检查是否在聊天页面
const isOnChatPage = computed(() => {
  return route.path.startsWith('/chat');
});

function goToChat() {
  router.push('/chat/conversation');
}
</script>

<template>
  <div v-if="!isOnChatPage" class="start-chat-btn-container" data-tour="start-chat-btn">
    <div
      class="start-chat-btn"
      title="开始聊天"
      @click="goToChat"
    >
      <el-icon class="chat-icon">
        <i-ep-chat-dot-round />
      </el-icon>
      <span class="btn-text">开始聊天</span>
    </div>
  </div>
</template>

<style scoped lang="scss">
.start-chat-btn-container {
  display: flex;
  align-items: center;
  margin-right: 12px;

  .start-chat-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--el-color-primary) 0%, var(--el-color-primary-light-3) 100%);
    color: #fff;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(64, 158, 255, 0.2);

    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
    }

    &:active {
      transform: translateY(0);
    }

    .chat-icon {
      font-size: 18px;
    }

    .btn-text {
      font-size: 14px;
    }
  }
}

// 移动端隐藏文字
@media (max-width: 768px) {
  .start-chat-btn-container {
    margin-right: 8px;

    .start-chat-btn {
      padding: 8px;

      .btn-text {
        display: none;
      }
    }
  }
}
</style>
