/*
 * The one bar of the application (organiser and administrator): the logo, the rubrics, then the event, the notifications and the menu
 * of the account (profile, my events, the guided tour, the guide, sign out). On a phone the bar keeps the logo mark, the event and the
 * account, and the rubrics move to a bar fixed at the bottom of the screen.
 */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 60;
  box-sizing: border-box;
  margin: 0;
  padding: 0 24px;
  /* The white strip runs the whole width of the screen... */
  background: #fff;
  border-bottom: 1px solid #e6ebf0;
  box-shadow: 0 1px 8px rgb(20 40 60 / 4%);
}
/* ...but what is in it (logo, rubrics, event, account) has the width of the content of the page: the same maximum width and sides
   as <main>. */
.app-bar-in {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 20px;
  max-width: 1320px;
  min-height: 64px;
  margin: 0 auto;
  box-sizing: border-box;
  padding: 8px 0;
}
.app-bar .logo {
  flex: none;
  margin: 0;
}
.bar-nav {
  display: flex;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.bar-nav::-webkit-scrollbar {
  display: none;
}
.bar-nav button {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #4a5a68;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.bar-nav button .icon {
  width: 20px;
  height: 20px;
}
.bar-nav button:hover {
  background: #f1f5f8;
  color: #243746;
}
.bar-nav button.active {
  background: #e8f1f7;
  color: var(--accent, #39799f);
}
.bar-nav button:focus-visible,
.bar-event select:focus-visible,
.app-bar .notification:focus-visible,
.app-bar .user-menu summary:focus-visible {
  outline: 2px solid var(--accent, #39799f);
  outline-offset: 2px;
}
.bar-nav .badge-count {
  padding: 1px 7px;
  border-radius: 999px;
  background: #dcebf5;
  color: var(--accent, #39799f);
  font-size: 11px;
}
.bar-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
  min-width: 0;
}
.bar-event {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  max-width: 270px;
  box-sizing: border-box;
  padding: 0 8px 0 12px;
  border: 1px solid #d5dee6;
  border-radius: 999px;
  background: #f8fafc;
}
.bar-event:focus-within {
  border-color: var(--accent, #39799f);
  box-shadow: 0 0 0 3px rgb(57 121 159 / 18%);
}
.bar-event .icon {
  flex: none;
  width: 18px;
  height: 18px;
  color: #5b6b78;
}
.bar-event select {
  min-width: 0;
  max-width: 200px;
  padding: 0 4px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #243746;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  cursor: pointer;
}
.bar-admin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 36px;
  border-radius: 999px;
  background: #eef3f7;
  color: #4a5a68;
  font-size: 13px;
  font-weight: 600;
}
.bar-admin .icon {
  width: 16px;
  height: 16px;
}
.app-bar .notification {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid #d5dee6;
  border-radius: 50%;
  background: #fff;
  color: #4a5a68;
  cursor: pointer;
}
.app-bar .notification:hover {
  background: #f1f5f8;
}
.app-bar .notification .icon {
  width: 20px;
  height: 20px;
}
.app-bar .notification::after {
  right: 10px;
  top: 8px;
}
.app-bar .user-menu {
  position: relative;
}
.app-bar .user-menu summary {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 3px;
  border-radius: 999px;
  cursor: pointer;
  list-style: none;
}
.app-bar .user-menu summary:hover {
  background: #f1f5f8;
}
.app-bar .user-menu summary .avatar {
  width: 36px;
  height: 36px;
  background: #e1edf5;
  color: var(--accent, #39799f);
  font-size: 13px;
}
.app-bar .user-menu summary .icon {
  width: 16px;
  height: 16px;
  color: #6c7b88;
}
.app-bar .user-menu-panel {
  top: calc(100% + 10px);
  right: 0;
  z-index: 80;
  width: 270px;
  padding: 8px;
  border: 1px solid #e1e8ee;
  border-radius: 12px;
  box-shadow: 0 14px 40px rgb(20 40 60 / 16%);
}
.app-bar .user-menu-id {
  display: grid;
  gap: 2px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid #eef2f5;
  margin-bottom: 6px;
}
.app-bar .user-menu-id b {
  font-size: 14px;
  color: #243746;
}
.app-bar .user-menu-id small {
  padding: 0;
  color: #6c7b88;
  font-size: 12px;
}
.app-bar .user-menu-panel button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #243746;
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.app-bar .user-menu-panel button:hover {
  background: #f1f5f8;
}
.app-bar .user-menu-panel button .icon {
  flex: none;
  width: 18px;
  height: 18px;
  color: #5b6b78;
}
.app-bar .user-menu-panel .user-menu-count {
  margin-left: auto;
}
.app-bar .user-menu-tour {
  display: contents;
}
.app-bar .user-menu-panel .user-menu-out {
  margin-top: 6px;
  border-top: 1px solid #eef2f5;
  border-radius: 0 0 8px 8px;
  color: #8b3a3a;
}
.app-bar .user-menu-panel .user-menu-out .icon {
  color: #8b3a3a;
}

/* Narrow bar: the labels give way to the icons of the rubrics (their name stays in the tooltip). The administrator has six rubrics, so sooner. */
@media (max-width: 1360px) {
  .app-bar.is-admin .bar-nav button .bar-label {
    display: none;
  }
  .app-bar.is-admin .bar-nav button.active .bar-label {
    display: inline;
  }
}
@media (max-width: 860px) {
  .bar-nav button .bar-label {
    display: none;
  }
  .bar-nav button.active .bar-label {
    display: inline;
  }
}

/* A phone: logo mark, event and account on top; the rubrics in a bar fixed at the bottom, like an app */
@media (max-width: 700px) {
  .app-bar {
    padding: 0 12px;
  }
  .app-bar-in {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px 10px;
    padding: 8px 0;
  }
  .app-bar .logo {
    font-size: 0;
  }
  .app-bar .logo .logo-mark {
    font-size: 17px;
  }
  .bar-tools {
    gap: 6px;
  }
  .bar-event {
    flex: 1 1 auto;
    max-width: none;
    height: 40px;
  }
  .bar-event select {
    max-width: none;
    width: 100%;
  }
  .bar-admin {
    display: none;
  }
  .app-bar .notification {
    width: 40px;
    height: 40px;
  }
  .bar-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 65;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    overflow: hidden;
    background: #fff;
    border-top: 1px solid #e6ebf0;
    box-shadow: 0 -4px 16px rgb(20 40 60 / 8%);
  }
  .bar-nav button {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    height: 52px;
    padding: 0 2px;
    border-radius: 12px;
    font-size: 10.5px;
  }
  .bar-nav button .bar-label,
  .bar-nav button.active .bar-label {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .bar-nav button .badge-count {
    display: none;
  }
  body:has(.app-bar) {
    padding-bottom: 76px;
  }
}
