<template>
  <div class="public-footer-nav">
    <div class="nav-container">
      <div 
        v-for="item in navItems" 
        :key="item.path"
        class="nav-item"
        :class="{ active: isActive(item.path) }"
        @click="handleNavClick(item.path)"
      >
        <i :class="item.icon"></i>
        <span class="nav-label">{{ item.label }}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'PublicFooterNav',
  data() {
    return {
      navItems: [
        {
          label: '首页',
          path: '/public/home',
          icon: 'el-icon-s-home'
        },
        {
          label: '评论生成',
          path: '/tools/comment-gen',
          icon: 'el-icon-edit-outline'
        },
        {
          label: '订单提交',
          path: '/public/order-submit',
          icon: 'el-icon-upload2'
        },
        {
          label: '订单搜索',
          path: '/tools/order-search',
          icon: 'el-icon-search'
        }
      ]
    }
  },
  methods: {
    isActive(path) {
      return this.$route.path === path
    },
    handleNavClick(path) {
      if (this.$route.path !== path) {
        this.$router.push(path)
      }
    }
  }
}
</script>

<style scoped>
.public-footer-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #e4e7ed;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  padding: 8px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
}

.nav-container {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 8px;
  gap: 4px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 8px 8px;
  border-radius: 8px;
  transition: all 0.3s ease;
  flex: 1;
  min-width: 0;
  color: #909399;
}

.nav-item:hover {
  background-color: #f5f7fa;
  color: #409eff;
}

.nav-item.active {
  color: #409eff;
  background-color: #ecf5ff;
}

.nav-item i {
  font-size: 20px;
  margin-bottom: 4px;
  transition: transform 0.3s ease;
}

.nav-item:hover i {
  transform: scale(1.1);
}

.nav-label {
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* 响应式设计 */
@media (max-width: 480px) {
  .nav-container {
    padding: 0 4px;
    gap: 2px;
  }
  
  .nav-item {
    padding: 6px 4px;
  }
  
  .nav-item i {
    font-size: 18px;
  }
  
  .nav-label {
    font-size: 10px;
  }
}

@media (min-width: 768px) {
  .nav-container {
    max-width: 900px;
    padding: 0 12px;
    gap: 8px;
  }
  
  .nav-item {
    padding: 10px 12px;
  }
  
  .nav-item i {
    font-size: 22px;
  }
  
  .nav-label {
    font-size: 12px;
  }
}
</style>

