<template>
  <header class="top-bar">
    <div class="logo-area">
      <span class="app-name">数富AI-亚马逊</span>
      <a href="/home" class="btn-home">返回首页</a>
    </div>

    <nav class="nav-tabs">
      <span class="nav-tab-group">
        <a v-for="item in navItems" :key="item.key" :href="item.href" class="nav-tab"
          :class="{ active: active === item.key }">
          {{ item.label }}
        </a>
      </span>
    </nav>

    <div class="top-right"></div>
  </header>
</template>

<script setup lang="ts">
const props = defineProps<{
  active: 'brand' | 'dedupe' | 'convert' | 'split'
}>()

const active = props.active

const navItems = [
  { key: 'brand', label: '品牌检测', href: '/brand' },
  { key: 'dedupe', label: '数据去重', href: '/new_web_source/dedupe.html' },
  { key: 'split', label: '数据拆分', href: '/new_web_source/split.html' },
  { key: 'convert', label: '格式转换', href: '/new_web_source/convert.html' },
] as const
</script>

<style scoped>
.top-bar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 20px;
  background: #111;
  border-bottom: 1px solid #2a2a2a;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.app-name {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.btn-home {
  color: #d2d2d2;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

.btn-home:hover {
  color: #fff;
}

.nav-tabs {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.nav-tab-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: #8d8d8d;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: #b9d6ff;
  background: rgba(77, 126, 189, 0.14);
}

.nav-tab.active {
  background: rgba(77, 126, 189, 0.24);
  border-color: rgba(91, 148, 219, 0.35);
  color: #6caeff;
}

.top-right {
  width: 120px;
  flex-shrink: 0;
}

@media (max-width: 1100px) {
  .top-bar {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 20px;
  }

  .nav-tabs {
    width: 100%;
    justify-content: flex-start;
  }

  .top-right {
    display: none;
  }
}
</style>
