/* ============================================================================
   WayLab · единая верхняя панель (T-1384)
   ----------------------------------------------------------------------------
   Один компонент для лендинга (.top) и приложения (.app-header):
     логотип · макро-разделы · профиль/вход · CTA.
   Правила:
     • панель — морское стекло navy, лайм только акцент/действие;
     • никаких «белых» состояний: hover логотипа не заливает плашку;
     • пилюля пользователя — та же, что на главной (прозрачное стекло + кромка);
     • ниже 900px навигация уходит в меню-лист под панелью.
   Подключается последним: после style.css/marina.css и после theme.css.
   ========================================================================== */

.wlbar {
  --wl-navy: #0a1628;
  --wl-lime: #d8fa4b;
  --wl-lime-2: #c9ee35;
  --wl-ink: #0a1628;
  --wl-text: rgba(255, 255, 255, .66);
  --wl-line: rgba(255, 255, 255, .12);
  --wl-h: 68px;
  position: relative;
  z-index: 60;
  color: #fff;
  background: rgba(10, 22, 40, .86);
  -webkit-backdrop-filter: saturate(1.3) blur(18px);
  backdrop-filter: saturate(1.3) blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, .10);
}

/* hidden-атрибут сильнее любого display из этого файла */
.wlbar [hidden],
.wlbar-right[hidden],
.wlbar-user[hidden],
.wlbar-login[hidden],
.wlbar-install[hidden],
.wlbar-admin[hidden],
.wlbar-avatar-img[hidden] { display: none !important; }

/* --- каркас -------------------------------------------------------------- */
.wlbar-in {
  position: relative;
  display: flex;
  align-items: center;
  gap: 26px;
  width: 100%;
  height: var(--wl-h);
  min-width: 0;
}

/* приложение: шапка была flex-контейнером — теперь это фон, внутри .wlbar-in */
.app-header.wlbar {
  display: block;
  height: auto;
  padding: 0;
  gap: 0;
  background: rgba(10, 22, 40, .86);
  border-bottom: 1px solid rgba(255, 255, 255, .10);
  box-shadow: 0 12px 28px -22px rgba(0, 0, 0, .85);
  flex-shrink: 0;
}
.app-header.wlbar .wlbar-in { padding: 0 28px; }

/* лендинг: панель уже fixed, выравниваем высоту */
.top.wlbar { background: rgba(10, 22, 40, .84); }
.top.wlbar.is-stuck {
  background: rgba(8, 19, 34, .95);
  border-bottom-color: rgba(255, 255, 255, .13);
  box-shadow: 0 12px 28px -22px rgba(0, 0, 0, .85);
}
.top.wlbar .wlbar-in { height: var(--wl-h); }

/* --- логотип ------------------------------------------------------------- */
.wlbar-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding: 3px 2px;
  border-radius: 12px;
  color: #fff;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.wlbar-logo:hover,
.wlbar-logo:focus,
.wlbar-logo:active { color: #fff; background: none; }
.wlbar-mark {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 10px;
  background: var(--wl-lime);
  color: var(--wl-ink);
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 6px 16px -10px rgba(0, 0, 0, .8);
  transition: transform .18s cubic-bezier(.22, .61, .36, 1), box-shadow .18s cubic-bezier(.22, .61, .36, 1);
}
.wlbar-mark svg { width: 19px; height: 19px; display: block; }
.wlbar-logo:hover .wlbar-mark {
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 10px 20px -12px rgba(216, 250, 75, .55);
}
.wlbar-logo:active .wlbar-mark { transform: translateY(0); }
.wlbar-word {
  font-size: 19px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.03em;
  white-space: nowrap;
}
.wlbar-beta {
  align-self: flex-start;
  margin-top: 1px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--wl-lime);
  opacity: .9;
}

/* --- макро-разделы ------------------------------------------------------- */
.wlbar-nav {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
.wlbar-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--wl-text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color .18s ease, background .18s ease, box-shadow .18s ease;
}
.wlbar-link::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 50%;
  background: var(--wl-lime);
  opacity: 0;
  transform: scale(.5);
  transition: opacity .18s ease, transform .18s ease;
}
.wlbar-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, .06);
}
.wlbar-link:hover::before { opacity: .45; transform: scale(1); }
.wlbar-link.is-active {
  color: #fff;
  background: rgba(255, 255, 255, .09);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.wlbar-link.is-active::before { opacity: 1; transform: scale(1); }
.wlbar-link:focus-visible {
  outline: 2px solid var(--wl-lime);
  outline-offset: 2px;
}

/* --- правая группа ------------------------------------------------------- */
.wlbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
}
.wlbar-login,
.wlbar-user,
.wlbar-install,
.wlbar-admin {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.wlbar-login {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background .18s ease, border-color .18s ease;
}
.wlbar-login:hover {
  background: rgba(255, 255, 255, .07);
  border-color: rgba(255, 255, 255, .42);
  color: #fff;
}
.wlbar-login.is-user {
  max-width: 250px;
  padding: 4px 14px 4px 4px;
  gap: 9px;
  background: rgba(255, 255, 255, .05);
  border-color: rgba(255, 255, 255, .18);
  font-size: 13px;
  font-weight: 700;
}
.wlbar-login.is-user:hover {
  background: rgba(255, 255, 255, .10);
  border-color: rgba(255, 255, 255, .28);
}
/* пилюля пользователя — как на главной: стекло + кромка, без белой заливки */
.wlbar-user {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 250px;
  height: 40px;
  padding: 4px 12px 4px 4px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease;
}
.wlbar-user:hover {
  background: rgba(255, 255, 255, .10);
  border-color: rgba(255, 255, 255, .28);
  color: #fff;
}
.wlbar-user[aria-current="page"] {
  background: rgba(255, 255, 255, .10);
  border-color: rgba(255, 255, 255, .26);
}
.wlbar-avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: rgba(216, 250, 75, .16);
  color: var(--wl-lime);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
}
.wlbar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.wlbar-user-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  text-align: left;
  line-height: 1.05;
}
.wlbar-user-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.wlbar-user-role {
  color: rgba(255, 255, 255, .45);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .02em;
}
.wlbar-chev {
  width: 14px;
  height: 14px;
  flex: none;
  color: rgba(255, 255, 255, .45);
}

/* установка PWA и суперадминка — тихие иконки */
.wlbar-install {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, .78);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.wlbar-install svg { width: 16px; height: 16px; flex: none; }
.wlbar-install:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, .38);
  background: rgba(255, 255, 255, .06);
}
.wlbar-admin {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, .62);
  cursor: pointer;
  transition: color .18s ease, background .18s ease, border-color .18s ease;
}
.wlbar-admin svg { width: 17px; height: 17px; }
.wlbar-admin:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.wlbar-admin[aria-current="page"] {
  color: var(--wl-lime);
  background: rgba(216, 250, 75, .10);
  border-color: rgba(216, 250, 75, .25);
}
.wlbar-admin:focus-visible,
.wlbar-user:focus-visible,
.wlbar-login:focus-visible,
.wlbar-install:focus-visible {
  outline: 2px solid var(--wl-lime);
  outline-offset: 2px;
}

/* --- мобильное меню ------------------------------------------------------ */
.wlbar-burger {
  display: none;
  width: 40px;
  height: 40px;
  flex: none;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .20);
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}
.wlbar-burger span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 3px auto;
  border-radius: 2px;
  background: #fff;
  transition: transform .2s ease, opacity .2s ease;
}
.wlbar-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.wlbar-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.wlbar-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

.wlbar-menu {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  top: var(--wl-h, 68px);
  top: 68px;
  z-index: 59;
  padding: 6px 20px 16px;
  background: rgba(8, 19, 34, .98);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 24px 40px -28px rgba(0, 0, 0, .9);
}
.wlbar-menu.is-open { display: block; }
body.nav-open .wlbar-menu { display: block; }
body.nav-open { overflow: hidden; }
.wlbar-menu .wlbar-login {
  justify-content: center;
  height: 44px;
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, .22);
}
.wlbar-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 6px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .82);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
}
.wlbar-menu a:last-child { border-bottom: 0; }
.wlbar-menu a:hover,
.wlbar-menu a.is-active { color: #fff; }
.wlbar-menu a.is-active::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wl-lime);
}
body.wl-menu-open { overflow: hidden; }

/* --- адаптив ------------------------------------------------------------- */
@media (max-width: 1180px) {
  .wlbar-in { gap: 18px; }
  .wlbar-install { display: none; }
  .wlbar-link { padding: 0 10px; font-size: 13.5px; }
  .wlbar-user-role { display: none; }
  .wlbar-user-name { max-width: 118px; }
}
@media (max-width: 940px) {
  .wlbar-nav { display: none; }
  .wlbar-burger { display: block; }
  .wlbar-beta { display: none; }
  .app-header.wlbar .wlbar-in { padding: 0 18px; }
}
@media (max-width: 600px) {
  .wlbar { --wl-h: 62px; }
  .wlbar-menu { top: 62px; }
  .wlbar-in { gap: 10px; }
  .wlbar-word { font-size: 17px; }
  .wlbar-mark { width: 30px; height: 30px; border-radius: 9px; }
  .wlbar-user { width: 40px; padding: 4px; justify-content: center; }
  .wlbar-login.is-user { width: 40px; padding: 4px; justify-content: center; }
  .wlbar-login.is-user .wlbar-user-name { display: none; }
  .wlbar-user-text,
  .wlbar-user .wlbar-chev { display: none; }
  .wlbar-install { display: none; }
  .wlbar-login { padding: 0 14px; }
  .app-header.wlbar .wlbar-in { padding: 0 14px; }
  .top.wlbar .wlbar-in { padding: 0 16px; }
}
