<template>
  <header class="topbar">
    <div class="profile" @click="goAbout">
      <div class="avatar">
        <img src="@/assets/profile-avatar.jpg" alt="Brad Stein" />
      </div>
      <div>
        <div class="name">Brad Stein</div>
        <div class="role">Software Development Engineer</div>
      </div>
    </div>
    <nav class="links">
      <RouterLink to="/" class="nav-link">Home</RouterLink>
      <RouterLink to="/about" class="nav-link">About</RouterLink>
      <a href="https://cloud.bstein.dev" class="nav-link strong" target="_blank" rel="noreferrer">Cloud</a>
      <a href="https://sso.bstein.dev" class="nav-link" target="_blank" rel="noreferrer">Login</a>
      <a href="https://sso.bstein.dev/realms/master/protocol/openid-connect/registrations" class="nav-link" target="_blank" rel="noreferrer">Sign Up</a>
      <a href="https://sso.bstein.dev/realms/master/login-actions/reset-credentials" class="nav-link" target="_blank" rel="noreferrer">Reset</a>
    </nav>
  </header>
</template>

<script setup>
import { useRouter, RouterLink } from "vue-router";

const router = useRouter();
const goAbout = () => router.push("/about");
</script>

<style scoped>
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(5, 9, 20, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.profile {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(0, 229, 197, 0.5), rgba(127, 124, 255, 0.45));
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.name {
  color: var(--text-strong);
  font-weight: 700;
}

.role {
  color: var(--text-muted);
  font-size: 13px;
}

.links {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.nav-link.strong {
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--accent-cyan);
}

.nav-link:hover {
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--accent-cyan);
}
</style>
