/* ═══════════════════════════════════════════════════════════════════════════
   APP BAR — Authenticated workspace navigation
   Compact horizontal bar below site header, shown when ev_session exists.
   ═══════════════════════════════════════════════════════════════════════════ */

.app-bar {
  position: sticky;

  /* fallback matches mobile --site-header-height (0.8rem outer pad + 5rem inner).
     The :root variable is set by site-header.css at each breakpoint. */
  top: var(--site-header-height, 5.8rem);
  z-index: var(--z-app-bar, 2900);
  background: color-mix(in oklch, var(--color-ink, #0f1419) 85%, transparent);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid rgb(255 255 255 / 8%);
  animation: app-bar-enter 0.25s ease-out;
}

@keyframes app-bar-enter {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-bar {
    animation: none;
  }
}

.app-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;

  /* site-container gives max-width + 1rem margin-inline; this adds inner breathing
     room so content doesn't touch the container wall, matching site-header__inner */
  padding-inline: 1.25rem;
  gap: 1rem;
}

@media (width >= 1280px) {
  .app-bar__inner {
    padding-inline: 1.5rem;
  }
}

/* ── Breadcrumb current page label ──────────────────── */

.app-breadcrumb__current {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgb(255 255 255 / 80%);
}

/* ── Logo / Brand mark ───────────────────────────────── */

.app-bar__logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
  margin-right: 0.25rem;
}

.app-bar__logo-mark {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.app-bar__logo-text {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--color-sapphire, #58a6ff), var(--color-emerald, #3fb950));
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  white-space: nowrap;
}

/* ── Navigation links ───────────────────────────────── */

.app-bar__nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;

  /* Flex-grow so the nav fills available space between logo and meta;
     overflow-x: auto lets tabs scroll rather than collide with the avatar. */
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.app-bar__nav::-webkit-scrollbar {
  display: none;
}

.app-bar__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgb(255 255 255 / 65%);
  text-decoration: none;
  transition:
    color 0.15s,
    background 0.15s;
  white-space: nowrap;
}

.app-bar__link:hover {
  color: rgb(255 255 255 / 92%);
  background: rgb(255 255 255 / 6%);
}

.app-bar__link[aria-current="page"] {
  color: #fff;
  background: rgb(255 255 255 / 10%);
  box-shadow: inset 0 -2px 0 currentcolor;
}

.app-bar__icon {
  flex-shrink: 0;
  opacity: 0.7;
}

.app-bar__link:hover .app-bar__icon,
.app-bar__link[aria-current="page"] .app-bar__icon {
  opacity: 1;
}

/* ── Meta section (tier badge + avatar) ────────────── */

.app-bar__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;

  /* Never shrink — avatar and notifications must stay fully visible
     even when the nav tab list is wide. */
  flex-shrink: 0;
}

.app-bar__tier {
  padding: 0.18rem 0.6rem;
  border-radius: var(--radius-full, 999px);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  background: #8b949e;
  white-space: nowrap;
}

.app-bar__tier-trial {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full, 999px);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fef3c7;
  background: rgb(217 119 6 / 22%);
  border: 1px solid rgb(245 158 11 / 45%);
  white-space: nowrap;
}

/* ── Avatar + dropdown ─────────────────────────────── */

.app-bar__user {
  position: relative;
}

.app-bar__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid rgb(255 255 255 / 18%);
  background: rgb(255 255 255 / 6%);
  color: rgb(255 255 255 / 72%);
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.app-bar__avatar:hover,
.app-bar__avatar[aria-expanded="true"] {
  border-color: rgb(255 255 255 / 36%);
  background: rgb(255 255 255 / 12%);
  color: #fff;
}

.app-bar__dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  padding: 0.35rem 0;
  background: var(--color-ink, #0f1419);
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 40%);
  z-index: 3100;
}

.app-bar__dropdown-link {
  display: block;
  width: 100%;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  color: rgb(255 255 255 / 72%);
  text-decoration: none;
  text-align: start;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition:
    color 0.12s,
    background 0.12s;
}

.app-bar__dropdown-link:hover {
  color: #fff;
  background: rgb(255 255 255 / 6%);
}

.app-bar__dropdown-link--danger {
  color: #f85149;
}

.app-bar__dropdown-link--danger:hover {
  color: #fff;
  background: rgb(248 81 73 / 14%);
}

.app-bar__dropdown-divider {
  margin: 0.3rem 0;
  border: none;
  border-top: 1px solid rgb(255 255 255 / 8%);
}

/* ── Upgrade CTA (demo / starter tiers) ────────────── */

.app-bar__upgrade {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-full, 999px);
  border: 1.5px solid var(--gem-gold-native-flat, #c88c00);
  background: rgb(200 140 0 / 10%);
  color: var(--gem-gold-native-flat, #c88c00);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background 0.15s,
    color 0.15s;
}

.app-bar__upgrade:hover {
  background: rgb(200 140 0 / 20%);
  color: #ffd05a;
}

/* ── Mobile: icons only ────────────────────────────── */

@media (width < 640px) {
  .app-bar__logo-text {
    display: none;
  }

  .app-bar__label {
    display: none;
  }

  .app-bar__link {
    padding: 0.4rem;
  }

  .app-bar__tier {
    font-size: 0.6rem;
    padding: 0.14rem 0.4rem;
  }

  .app-bar__tier-trial {
    font-size: 0.56rem;
    padding: 0.12rem 0.35rem;
  }

  .app-bar__upgrade {
    font-size: 0.6rem;
    padding: 0.18rem 0.45rem;
  }
}
