/* Topbar, same look as Bouwplan. The brand area is as wide as the menu below it. */
x-topbar {
  flex: none;
  height: var(--top-h);
  display: flex;
  align-items: center;
  background: var(--nav-bg);
  color: var(--nav-fg);
  position: relative;
  z-index: 70;

  .brand {
    flex: none;
    width: var(--rail);
    height: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 20px;
    overflow: hidden;
    white-space: nowrap;
    transition: width var(--dur) var(--ease);
  }

  .logo { width: 32px; height: 32px; flex: none; object-fit: contain; }
  .name { color: var(--nav-strong); font-weight: 700; font-size: 16px; opacity: 0; transition: opacity var(--dur) var(--ease); }
  .middle { flex: 1; min-width: 0; }

  .right {
    flex: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-right: 16px;
  }

  .user { display: flex; align-items: center; gap: 10px; white-space: nowrap; }

  .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--nav-active);
    color: var(--nav-accent);
    font-size: 12.5px;
    font-weight: 600;
  }

  .user-name { display: block; color: var(--nav-strong); font-weight: 600; font-size: 13.5px; line-height: 1.2; }
  .user-email { display: block; color: var(--nav-dim); font-size: 12px; }
  .separator { width: 1px; height: 28px; background: var(--nav-line); margin: 0 8px; }

  .button-icon {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--nav-fg);
    display: grid;
    place-items: center;
    transition: background 0.25s var(--ease), color 0.25s var(--ease);

    &:hover { background: var(--nav-hover); color: var(--nav-strong); }
    & .ic { width: 20px; height: 20px; }
  }

  /* Language choice: a button with the code (NL) that opens a small list */
  .language { position: relative; }

  .language-button {
    height: 40px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--nav-fg);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.25s var(--ease), color 0.25s var(--ease);

    &:hover { background: var(--nav-hover); color: var(--nav-strong); }
    & .chev { width: 14px; height: 14px; color: var(--nav-dim); transition: transform var(--dur) var(--ease); }
  }

  .language.open .language-button { background: var(--nav-hover); color: var(--nav-strong); }
  .language.open .chev { transform: rotate(180deg); }

  .language-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    padding: 6px;
    background: var(--panel);
    color: var(--fg);
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  }

  .language.open .language-menu { opacity: 1; transform: none; pointer-events: auto; }

  .language-option {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 6px;
    background: none;
    text-align: left;
    transition: background 0.2s var(--ease);

    &:hover { background: var(--zebra); }
    &.current { background: var(--accent-soft); font-weight: 600; }
  }

  .drawer { display: none; }
}

@media (min-width: 1100px) {
  body.navigation-pinned x-topbar .brand { width: var(--nav-w); }
  body.navigation-pinned x-topbar .name { opacity: 1; }
}

@media (max-width: 767px) {
  x-topbar {
    .brand { width: auto; padding-left: 6px; }
    .drawer { display: grid; }
    .logo, .name, .separator, .user .text { display: none; }
  }
}
