<template>
  <header class="h5-header">
    <div class="h5-header-container">
      <a href="/" class="brand">
        <NuxtImg src="/logo.png" alt="DDAC logo" class="brand-logo" width="24" height="24" />
        <h1 class="brand-title">DDAC</h1>
      </a>
      <button class="menu-button" @click="toggleMenu">
        <span class="menu-icon"></span>
      </button>
    </div>
    <nav v-show="isMenuOpen" class="h5-nav">
      <div class="nav-item">首页</div>
      <div class="nav-item">产品</div>
      <div class="nav-item">行业解决方案</div>
      <div class="nav-item">文档中心</div>
      <div class="nav-item">了解我们</div>
      <div class="nav-actions">
        <div class="nav-action-item">登录</div>
        <div class="nav-action-item register">注册</div>
      </div>
    </nav>
  </header>
</template>

<script setup>
const isMenuOpen = ref(false)

const toggleMenu = () => {
  isMenuOpen.value = !isMenuOpen.value
}
</script>

<style lang="scss" scoped>
.h5-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: #030014;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.h5-header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;

  .brand-logo {
    margin-right: 8px;
  }

  .brand-title {
    color: #FFF;
    font-size: 20px;
    font-weight: 700;
    line-height: 24px;
    margin: 0;
  }
}

.menu-button {
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.menu-icon {
  display: block;
  width: 24px;
  height: 2px;
  background-color: #fff;
  position: relative;

  &::before,
  &::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background-color: #fff;
    left: 0;
  }

  &::before {
    top: -8px;
  }

  &::after {
    top: 8px;
  }
}

.mobile-nav {
  background: #030014;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px;
}

.nav-item {
  padding: 12px 0;
  color: #FFF;
  font-size: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);

  &:last-of-type {
    border-bottom: none;
  }
}

.nav-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.nav-action-item {
  flex: 1;
  padding: 12px;
  text-align: center;
  color: #FFF;
  font-size: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);

  &.register {
    background: linear-gradient(91deg, #A39DFF 1.24%, #7D46FF 122.93%);
  }
}
</style>
