<template>
  <div class="public-home-container">
    <div class="home-content">
      <div class="header-section">
        <h1 class="main-title">工具中心</h1>
        <p class="subtitle">选择您需要的功能</p>
      </div>

      <div class="tools-grid">
        <div 
          v-for="tool in tools" 
          :key="tool.path"
          class="tool-card"
          @click="handleToolClick(tool.path)"
        >
          <div class="tool-icon-wrapper">
            <i :class="tool.icon"></i>
          </div>
          <h3 class="tool-title">{{ tool.title }}</h3>
          <p class="tool-desc">{{ tool.description }}</p>
          <div class="tool-footer">
            <span class="tool-action">点击使用 <i class="el-icon-arrow-right"></i></span>
          </div>
        </div>
      </div>
    </div>

    <!-- 页尾导航 -->
    <PublicFooterNav />
  </div>
</template>

<script>
import PublicFooterNav from '@/components/PublicFooterNav'

export default {
  name: 'PublicHome',
  components: {
    PublicFooterNav
  },
  data() {
    return {
      tools: [
        {
          title: '评论生成',
          description: '快速生成产品评论内容',
          path: '/tools/comment-gen',
          icon: 'el-icon-edit-outline'
        },
        {
          title: '订单提交',
          description: '提交订单信息，录入系统',
          path: '/public/order-submit',
          icon: 'el-icon-upload2'
        },
        {
          title: '订单搜索',
          description: '快速搜索订单信息',
          path: '/tools/order-search',
          icon: 'el-icon-search'
        }
      ]
    }
  },
  methods: {
    handleToolClick(path) {
      this.$router.push(path)
    }
  }
}
</script>

<style scoped>
.public-home-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 40px 20px 80px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.home-content {
  max-width: 1200px;
  width: 100%;
}

.header-section {
  text-align: center;
  margin-bottom: 40px;
  color: #fff;
}

.main-title {
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 12px 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
  font-size: 18px;
  margin: 0;
  opacity: 0.9;
}

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

.tool-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.tool-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.tool-icon-wrapper {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #409EFF 0%, #67C23A 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  transition: transform 0.3s ease;
}

.tool-card:hover .tool-icon-wrapper {
  transform: scale(1.1) rotate(5deg);
}

.tool-icon-wrapper i {
  font-size: 40px;
  color: #fff;
}

.tool-title {
  font-size: 22px;
  font-weight: 600;
  color: #303133;
  margin: 0 0 12px 0;
}

.tool-desc {
  font-size: 14px;
  color: #909399;
  line-height: 1.6;
  margin: 0 0 20px 0;
  flex: 1;
}

.tool-footer {
  width: 100%;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
}

.tool-action {
  font-size: 14px;
  color: #409eff;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tool-action i {
  transition: transform 0.3s ease;
}

.tool-card:hover .tool-action i {
  transform: translateX(4px);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .public-home-container {
    padding: 24px 16px 80px;
  }

  .main-title {
    font-size: 28px;
  }

  .subtitle {
    font-size: 16px;
  }

  .tools-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .tool-card {
    padding: 24px 20px;
  }

  .tool-icon-wrapper {
    width: 70px;
    height: 70px;
  }

  .tool-icon-wrapper i {
    font-size: 36px;
  }

  .tool-title {
    font-size: 20px;
  }
}

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

  .subtitle {
    font-size: 14px;
  }

  .tool-card {
    padding: 20px 16px;
  }
}
</style>

