/* The admin console shell: topbar across the top, sidebar left, content right.
   Figma 600:33154. Colour values are tokens only — a hex outside
   eventkrowd_theme.css is a bug this project has a test for. */

.admin-shell {
  display: grid;
  grid-template-columns: 235px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "topbar topbar"
    "sidebar main";
  min-height: 100dvh;
}

/* Visually hidden until focused. The existing .visually-hidden helper has no
   focus escape, so a skip link using it can never be reached by keyboard. */
.admin__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);
}

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

.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem;
  min-height: 50px;
  background: var(--wa-color-brand-50);
  color: var(--wa-color-brand-on-loud);
}


.topbar__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;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar__icon-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;
}

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

/* Unread-count pill on the notifications bell. */
.topbar__bell {
  position: relative;
  display: inline-flex;
}

.topbar__count {
  position: absolute;
  inset-block-start: -0.35rem;
  inset-inline-end: -0.45rem;
  min-width: 1rem;
  padding: 0 0.2rem;
  border-radius: 999px;
  background: var(--wa-color-danger-fill-loud);
  color: var(--wa-color-danger-on-loud);
  font-size: 0.625rem;
  line-height: 1rem;
  text-align: center;
}

/* The hamburger only earns its place on narrow screens. */
.topbar__menu {
  display: none;
}

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

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

.admin-shell__main {
  grid-area: main;
  display: flex;
  flex-direction: column;
  /* The 1fr track resolves to minmax(auto, 1fr): without min-width: 0 the
     column grows to the content's min width — a wide table pushed the whole
     document into horizontal scroll between the 1167px breakpoint and the
     width where it fit (HMS-271). With this, the track stays 1fr and each
     page's own table-wrap scrolls instead. */
  min-width: 0;
  padding: 1.5rem;
  background: var(--wa-color-surface-lowered);
}

.admin-shell__main:focus {
  outline: none;
}

.admin-flash {
  margin-block-end: 1rem;
}

/* HMS-1087 — the spacer grows to push the footer to the bottom of short pages
   while keeping at least 1.5rem between the page content and the footer. */
.admin-footer-spacer {
  flex: 1 0 1.5rem;
}

/* Bleeds through .admin-shell__main's padding so the white strip spans the
   full column and sits flush with its bottom edge (Figma 600:36413). */
.admin-footer {
  margin: 0 -1.5rem -1.5rem;
  padding: 0.75rem 1.5rem;
  display: grid;
  grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
  align-items: center;
  gap: 1rem;
  background: var(--wa-color-surface-default);
  border-block-start: 1px solid var(--wa-color-surface-border);
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
}

.admin-footer__logo {
  justify-self: start;
  height: 1.25rem;
  width: auto;
}

.admin-footer__center {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
}

.admin-footer__links {
  justify-self: end;
  display: flex;
  gap: 1.25rem;
  white-space: nowrap;
}

.admin-footer__links a {
  color: var(--wa-color-text-link);
  font-weight: 600;
  text-decoration: none;
}

.admin-footer__links a:hover,
.admin-footer__links a:focus-visible {
  text-decoration: underline;
}

.admin-footer__meta {
  grid-column: 1 / -1;
  margin: 0;
  text-align: center;
  font-size: 0.75rem;
}

@media (max-width: 1167px) {
  .admin-shell {
    grid-template-columns: 200px 1fr;
  }

  .admin-shell__main {
    padding: 1rem;
    min-width: 0;
    overflow-x: auto;
  }

  .admin-footer {
    margin: 0 -1rem -1rem;
    padding: 0.75rem 1rem;
  }
}

@media (max-width: 1023px) {
  .admin-shell {
    grid-template-columns: 1fr;
    /* Three areas need three row tracks: inheriting "auto 1fr" from the
       desktop rule puts 1fr on the (hidden) sidebar row, leaving a blank
       band above main on any page shorter than the viewport (HMS-337). */
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "topbar"
      "sidebar"
      "main";
  }

  /* Collapsed by default under 1024px, the hamburger reveals the sidebar. */
  .admin-shell__sidebar {
    display: none;
  }

  .admin-shell--sidebar-open .admin-shell__sidebar {
    display: block;
  }

  .topbar__menu {
    display: flex;
  }
}

@media (max-width: 767px) {
  .admin-footer {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .admin-footer__logo,
  .admin-footer__links {
    justify-self: center;
  }

  .admin-footer__links {
    justify-content: center;
  }
}

.notifications-drawer__tabs {
  display: flex;
  gap: var(--wa-space-xs, 0.5rem);
  margin-bottom: var(--wa-space-m, 1rem);
}

.notifications-drawer__tab {
  border: 1px solid var(--wa-color-surface-border);
  background: transparent;
  border-radius: 999px;
  padding: 0.25rem 0.875rem;
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
  cursor: pointer;
}

.notifications-drawer__tab--active {
  background: var(--wa-color-brand-fill-loud);
  border-color: var(--wa-color-brand-fill-loud);
  color: var(--wa-color-brand-on-loud);
}

.notifications-drawer__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--wa-space-s, 0.75rem);
}

.notifications-drawer__item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.125rem 0.625rem;
  align-items: start;
  padding: 0.625rem;
  border: 1px solid var(--wa-color-surface-border);
  border-radius: var(--wa-border-radius-m, 0.375rem);
  text-decoration: none;
  color: var(--wa-color-text-normal);
}

.notifications-drawer__item:hover {
  border-color: var(--wa-color-brand-fill-loud);
}

/* HMS-1324 — unread items carry the brand tint, a blue dot, and the bold
 * title so "needs attention" is visible at a glance; read items stay the
 * neutral card. Dismissal re-renders the drawer with the item in the read
 * list, so the indicators clear automatically once it is marked read. */
.notifications-drawer__item--unread {
  background: var(--wa-color-brand-fill-quiet);
}

.notifications-drawer__item--unread .notifications-drawer__item-title::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.375rem;
  border-radius: 50%;
  background: var(--wa-color-brand-fill-loud);
}

.notifications-drawer__item--read .notifications-drawer__item-title {
  font-weight: 500;
}

.notifications-drawer__item wa-tag { grid-row: span 3; }

.notifications-drawer__item-title { font-weight: 600; font-size: 0.875rem; }
.notifications-drawer__item-sub { font-size: 0.8125rem; }
.notifications-drawer__item-time { font-size: 0.75rem; }

.notifications-drawer__empty {
  color: var(--wa-color-text-quiet);
  padding: var(--wa-space-m, 1rem) 0;
}

.notifications-drawer__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--wa-space-s, 0.75rem);
  margin-top: var(--wa-space-m, 1rem);
  padding-top: var(--wa-space-m, 1rem);
  border-top: 1px solid var(--wa-color-surface-border);
}

.notifications-drawer__mark-all {
  background: transparent;
  border: 1px solid var(--wa-color-surface-border);
  border-radius: var(--wa-border-radius-m, 0.375rem);
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  cursor: pointer;
  color: var(--wa-color-text-normal);
}

.notifications-drawer__all {
  font-size: 0.8125rem;
  color: var(--wa-color-text-link);
}

.notifications-drawer__list[hidden] { display: none; }
