/* The attendee portal's brand bar. Figma 516:5528. */

.portal-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 1.5rem;
  min-height: 3.25rem;
  background: var(--wa-color-brand-fill-loud);
  color: var(--wa-color-brand-on-loud);
}

.portal-header__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: inherit;
  text-decoration: none;
  font-family: var(--wa-font-family-heading);
  font-weight: var(--wa-font-weight-heading);
  font-size: 1.125rem;
}

.portal-header__nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.portal-header__nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: 0.375rem;
  color: inherit;
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  /* A two-line "My Bookings" reads as broken on the wrapped phone nav row. */
  white-space: nowrap;
}

/* brand-40, matching the admin topbar. NOT --wa-color-brand-fill-normal, which
   resolves to brand-90 (var(--wa-color-brand-90)) and put white text on a near-white pill at
   1.29:1 against a 4.5:1 requirement. The design-token test passes either way —
   it checks that a token RESOLVES, never that the result can be read. */
.portal-header__nav-link:hover,
.portal-header__nav-link:focus-visible {
  background: var(--wa-color-brand-40);
}

.portal-header__nav-link--current {
  background: var(--wa-color-brand-40);
}

/* The unread-count pill inside the brand-coloured header bar. It inverts the
   loud brand fill because the link's hover/current state is already brand-40 —
   matching that would hide the pill exactly when the Notifications tab is lit. */
.portal-header__nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: 1.125rem;
  block-size: 1.125rem;
  padding-inline: 0.25rem;
  border-radius: 999px;
  /* Inverted pill: the link's own hover/current state is already brand-40, so
     the badge needs the loud fill's on-colour to stay visible there. */
  background: var(--wa-color-brand-on-loud);
  color: var(--wa-color-brand-fill-loud);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

/* The boxed back arrow and the hamburger are mobile chrome — the desktop bar
   keeps its labelled nav row and the in-page back pill (Figma 516:5528). */
.portal-header__back,
.portal-header__menu {
  display: none;
}

/* Menu panel links are dark-on-white (the dropdown panel is a raised surface,
   not the navy bar). Current page gets the same visual weight as the desktop
   current pill so the menu answers "where am I". */
.portal-header__menu-panel {
  min-width: 12rem;
  padding: 0.25rem;
}

.portal-header__menu-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.375rem;
  color: var(--wa-color-text-normal);
  text-decoration: none;
  font-size: 0.9375rem;
  white-space: nowrap;
}

.portal-header__menu-link i {
  width: 1rem;
  color: var(--wa-color-text-quiet);
}

.portal-header__menu-link:hover {
  background: var(--wa-color-neutral-fill-quiet);
}

.portal-header__menu-link--current {
  font-weight: 600;
}

.portal-header__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-inline-start: auto;
}

.portal-header__avatar-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.portal-header__profile-menu {
  padding: 0.75rem;
  min-width: 14rem;
}

.portal-header__profile-name {
  margin: 0;
  font-weight: 600;
}

.portal-header__profile-email {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  color: var(--wa-color-text-quiet);
  overflow-wrap: anywhere;
}

.portal-header__locale {
  margin: 0;
}

.portal-header__locale-select {
  max-inline-size: 7.5rem;
  font-size: 0.875rem;
  color: inherit;
  background: transparent;
  border: 0;
}

.portal-header__locale-select option {
  color: var(--wa-color-text-normal);
}

/* The six signed-in nav links plus brand, locale select and avatar measure
   ~1039px — under ~1040px the avatar clips off the right edge of the bar, so
   the nav collapses into the hamburger at tablet width too, not just phones. */
@media (max-width: 66rem) {
  .portal-header__nav {
    display: none;
  }

  .portal-header__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--wa-color-brand-40);
    border-radius: 0.375rem;
    color: inherit;
    text-decoration: none;
    flex-shrink: 0;
  }

  .portal-header__back:hover {
    background: var(--wa-color-brand-40);
  }

  .portal-header__menu {
    display: block;
  }

  .portal-header__menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    min-height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: 0.375rem;
    background: transparent;
    color: inherit;
    cursor: pointer;
  }

  .portal-header__menu-button:hover,
  .portal-header__menu-button:focus-visible {
    background: var(--wa-color-brand-40);
  }
}

@media (max-width: 639.98px) {
  .portal-header {
    gap: 0.75rem;
    padding: 0 0.75rem;
  }

  /* The nav row collapses into the hamburger — the nav/menu swap lives in the
     66rem block above, so this phone block only shrinks the bar itself. */
  .portal-header__brand-name {
    display: none;
  }

  /* The avatar + selector must fit inside the bar — narrow phones overflowed
     by ~10px without a hard cap on the native select. */
  .portal-header__locale-select {
    max-inline-size: 3.5rem;
    padding-inline: 0;
  }

  .portal-header__actions {
    gap: 0.25rem;
  }
}

/* Off-screen until focused. The project's .visually-hidden helper has no focus
   escape, so a skip link built on it can never be reached — which is why this
   is spelled out rather than reusing it. */
.portal__skip-link {
  position: absolute;
  inset-inline-start: -9999px;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--wa-color-surface-default);
  color: var(--wa-color-text-link);
}

.portal__skip-link:focus {
  inset-inline-start: 0.5rem;
  top: 0.5rem;
}

/* HMS-400 — the event wordmark replaces the product mark when brand_logo_url
   is configured. Sized like the text mark it replaces; contain keeps wide
   wordmarks from stretching the 3.25rem bar. */
.portal-header__brand-logo {
  display: block;
  height: 1.75rem;
  width: auto;
  max-width: 12rem;
  object-fit: contain;
}

/* Figma 576:3733 — the mobile bottom tab bar replaces the collapsed header
   nav for the four primary destinations. Desktop never renders it. */
.portal-tabbar {
  display: none;
}

@media (max-width: 639.98px) {
  .portal-tabbar {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 950;
    display: flex;
    background: var(--wa-color-surface-raised);
    border-top: 1px solid var(--wa-color-neutral-border-quiet);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .portal-tabbar__tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.125rem;
    padding: 0.625rem 0.25rem 0.375rem;
    font-size: 0.6875rem;
    color: var(--wa-color-text-quiet);
    text-decoration: none;
  }

  .portal-tabbar__tab i {
    font-size: 1.125rem;
  }

  .portal-tabbar__tab--current {
    color: var(--wa-color-brand);
    font-weight: 600;
  }

  /* The tab bar occupies the bottom-right corner the chatbot FAB normally
     sits in — the FAB rises above the ~3.5rem bar. */
  .chatbot-widget {
    bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
  }
}
