.navbar {
  grid-area: header;
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(135deg, #f8f9fa 0%, #f3fdff 100%);
  border-bottom: 1px solid var(--color-grey-dark);
  --navbar-avatar-size: 50px;
}

.navbar-brand-logo {
  width: var(--navbar-avatar-size) !important;
  height: var(--navbar-avatar-size) !important;
  min-width: var(--navbar-avatar-size);
  min-height: var(--navbar-avatar-size);
  max-width: var(--navbar-avatar-size);
  max-height: var(--navbar-avatar-size);
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.navbar-brand-name {
  margin-bottom: 0;
  font-family: 'Roboto', sans-serif !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 1.15rem !important;
  line-height: 1.1;
  font-weight: 500;
}

.offcanvas-header .navbar-brand {
  display: inline-flex;
  align-items: center;
}

.profile-and-actions #avatar-image {
  border: 0;
  background: transparent;
  width: var(--navbar-avatar-size);
  height: var(--navbar-avatar-size);
  border-radius: 50px;
  object-fit: cover;
}

.navbar-avatar-button {
  border: 0;
  background: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.navbar-avatar-button .avatar-nav-wrapper {
  display: inline-block;
  border-radius: 50%;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.navbar-avatar-button:hover .avatar-nav-wrapper {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.navbar-avatar-button:focus-visible {
  outline: 2px solid var(--color-green);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

.navbar-avatar-chevron {
  font-size: 0.6rem;
  color: var(--color-text-secondary);
  transition: transform 0.2s ease, color 0.2s ease;
}

.navbar-avatar-button:hover .navbar-avatar-chevron {
  color: var(--color-dark);
}

.navbar-avatar-button.show .navbar-avatar-chevron {
  transform: rotate(180deg);
}

.profile-and-actions .navbar-notification-button {
  width: var(--navbar-avatar-size);
  height: var(--navbar-avatar-size);
  border-radius: 50%;
  background-color: var(--color-white);
  border: 1px solid var(--color-grey-dark);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  text-decoration: none;
  flex-shrink: 0;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.profile-and-actions .navbar-notification-button:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.profile-and-actions .navbar-notification-button i {
  color: var(--color-dark);
  font-size: 1.5rem;
}

.profile-and-actions .navbar-notification-button .new-dot {
  position: absolute;
  top: 10px;
  right: 10px;
}

/* Wrapper span that enables badge positioning on the navbar avatar */
.avatar-nav-wrapper {
  position: relative;
  display: inline-block;
}

/* Tier badge — navbar (50px avatar) */
.avatar-nav-wrapper .tier-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 22px;
  height: 22px;
  font-size: 9px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Border matches the navbar gradient end-colour so the ring blends with the background */
  border: 2px solid #f3fdff;
  box-shadow: var(--shadow-md);
  pointer-events: none;
}

.avatar-nav-wrapper .tier-badge--essential {
  background: linear-gradient(145deg, var(--color-tier-essential-light), var(--color-tier-essential));
  color: #3A2600;
}

.avatar-nav-wrapper .tier-badge--expert {
  background: radial-gradient(circle at 35% 30%, var(--color-tier-expert-bg-light), var(--color-tier-expert-bg));
  color: var(--color-tier-expert-accent);
  border-color: var(--color-tier-expert-accent);
}

.navbar-nav {
  border: 1px solid var(--color-grey-dark);
  box-shadow: var(--shadow-sm);
}

.nav-item {
  position: relative;
  min-width: 160px;
}

.nav-link {
  color: var(--color-dark) !important;
  text-decoration: none;
  font-family: 'Poppins', sans-serif;
  padding: 10px 16px;
  text-align: center;
  border-radius: var(--radius-pill);
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--color-navy) !important;
  background-color: rgba(29, 51, 84, 0.08);
}

.nav-link:focus-visible {
  outline: 2px solid var(--color-green);
  outline-offset: 2px;
}

.nav-link.active {
  color: var(--color-white) !important;
  background-color: var(--color-navy);
}


@media (max-width: 1023px) {
  .profile-and-actions {
    order: 3;
  }

  .nav-container {
    display: none;
    position: fixed;
    top: 100px;
    left: 0;
    right: 0;
    background-color: var(--color-white);
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    margin: 0;
  }

  .nav-container.mobile-active {
    display: block;
  }

  .nav-list {
    flex-direction: column;
    gap: 0;
  }

  .nav-item {
    width: 100%;
  }

  .nav-link {
    display: flex;
    align-items: center;
    padding: 15px;
    width: 100%;
    border-radius: 0;
  }

  .nav-link i {
    width: 24px;
    margin-right: 10px;
  }
}
