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

const router = useRouter()

const agents = [
  {
    id: 'crypto-analysis',
    name: '加密货币AI分析助理',
    description: '通过 AI 技术，获取加密货币的深度分析报告',
    icon: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
      <path d="M7 12l5-5 5 5M7 17l5-5 5 5"/>
    </svg>`,
    route: '/crypto-analysis',
  },
  {
    id: 'astock-analysis',
    name: 'A股AI分析助理',
    description: '通过 AI 技术，获取 A 股上市公司的深度分析报告',
    icon: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
      <path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path>
      <polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline>
      <line x1="12" y1="22.08" x2="12" y2="12"></line>
    </svg>`,
    route: '/astock-analysis',
  },
]

const navigateToAgent = (route: string) => {
  router.push(route)
}
</script>

<template>
  <div class="ai-agents-view">
    <div class="content-container">
      <div class="header-section">
        <h1 class="title">AI 助理团队</h1>
        <p class="description">选择专业的 AI 助手，获取精准的分析和建议</p>
      </div>

      <div class="agents-grid">
        <div
          v-for="agent in agents"
          :key="agent.id"
          class="agent-card"
          @click="navigateToAgent(agent.route)"
        >
          <div class="agent-icon" v-html="agent.icon"></div>
          <div class="agent-info">
            <h3 class="agent-name">{{ agent.name }}</h3>
            <p class="agent-description">{{ agent.description }}</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped>
.ai-agents-view {
  min-height: 100vh;
  background-color: var(--color-bg-primary);
  padding: 1rem;
}

.content-container {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  margin-top: 6rem;
}

.header-section {
  text-align: center;
  margin-bottom: 2rem;
}

.title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 0.5rem;
}

.description {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
}

.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.agent-card {
  background-color: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.agent-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-accent);
  box-shadow: 0 4px 12px rgba(var(--color-accent-rgb), 0.1);
}

.agent-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  color: var(--color-accent);
}

.agent-info {
  flex: 1;
  min-width: 0;
}

.agent-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 0.25rem;
}

.agent-description {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
  margin: 0;
}

.card-arrow {
  display: none;
}

@media (max-width: 768px) {
  .title {
    font-size: 1.75rem;
  }

  .description {
    font-size: 0.9rem;
  }

  .agents-grid {
    grid-template-columns: 1fr;
  }

  .agent-card {
    padding: 1rem;
  }

  .agent-icon {
    width: 28px;
    height: 28px;
  }

  .agent-name {
    font-size: 0.95rem;
  }

  .agent-description {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .title {
    font-size: 1.5rem;
  }

  .description {
    font-size: 0.85rem;
  }

  .agent-card {
    padding: 0.875rem;
  }

  .agent-icon {
    width: 24px;
    height: 24px;
  }

  .agent-name {
    font-size: 0.9rem;
  }

  .agent-description {
    font-size: 0.8rem;
  }
}

@media (prefers-color-scheme: dark) {
  .agent-card:hover {
    background-color: rgba(var(--color-accent-rgb), 0.1);
  }
}
</style>
