/* 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;
}

.admin-footer {
  margin-block-start: auto;
  padding-block-start: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-block-start: 1px solid var(--wa-color-surface-border);
}

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

.admin-footer__text {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.admin-footer__hello {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
}

.admin-footer__copy {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
}

.admin-footer__meta {
  margin: 0;
  margin-inline-start: auto;
  font-size: 0.75rem;
  color: var(--wa-color-text-quiet);
}

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

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

@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;
  }
}

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

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