<template>
  <header class="navbar">
    <div class="container">
      <RouterLink
        to="/"
        class="logo"
      >
        <img
          src="/spbr-uncolored-nostars-noring.png"
          alt="Logo"
        >
      </RouterLink>

      <nav class="links">
        <a href="#">{{ t.nav?.supportedGames }}</a>
        <a href="#">{{ t.nav?.errorCodes }}</a>
        <a href="#">{{ t.nav?.discordServer }}</a>
        <a href="/docs/connect">{{ t.nav?.installSpbr }}</a>
      </nav>

      <div class="search-box">
        <input
          v-model="query"
          type="text"
          :placeholder="t.nav?.searchPlaceholder"
        >
        <button class="search-btn">
          <Icon
            name="octicon:search-24"
            class="icon"
            alt="Search"
          />
        </button>
      </div>
    </div>
  </header>
</template>

<script setup>
import { ref } from 'vue'

const query = ref('')

const { t } = useLocale()
</script>

<style scoped>
.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: opacity 0.2s;
}

.logo:hover {
  opacity: 0.8;
}

.navbar {
  background-color: #383838;
  border-bottom: 2px solid #333;
  padding: 10px 20px;
  font-family: 'Arial', sans-serif;
}

.container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  gap: 15px;
  flex-wrap: wrap;
}

.logo img {
  height: 30px;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.links {
  display: flex;
  gap: 25px;
  flex-wrap: wrap;
}

.links a {
  text-decoration: none;
  color: #aaa;
  font-weight: bold;
  font-size: 14px;
  transition: color 0.2s;
}

.links a:hover {
  color: #fff;
}

.search-box {
  display: flex;
  align-items: center;
  background: #2d2d2d;
  border: 1px solid #444;
  border-radius: 20px;
  padding: 4px 12px;
  flex-grow: 1;
  max-width: 300px;
}

.search-box input {
  border: none;
  outline: none;
  padding: 5px;
  font-size: 14px;
  color: #eee;
  background: transparent;
  width: 100%;
}

.search-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0;
  margin-left: 5px;
}

:deep(.icon) {
  width: 18px;
  height: 18px;
  color: #aaa;
  fill: currentColor;
  transition: color 0.2s, transform 0.1s;
  opacity: 0.8;
}

.search-btn:hover :deep(.icon) {
  color: #fff;
  transform: scale(1.1);
}

@media (max-width: 768px) {
  .container {
    justify-content: space-between;
  }

  .links {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
  }

  .search-box {
    max-width: 180px;
  }
}

@media (max-width: 480px) {
  .links {
    display: none;
  }

  .search-box {
    max-width: 60%;
  }
}
</style>
