/* Staff tools in the page shell (staff-nav.js, RNAB-21): the notification bell and its
   panel, the toasts, and the states of the «أدوات الفريق» menu that only signed-in staff
   see. Also the sprite icon base (`.icon`), which the bell and the menu chevron use.
   Every page loads this file after site.css. */

/* ---------- Sprite icons (assets/img/icons.svg) ---------- */

.icon {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--fill {
  fill: currentColor;
  stroke: none;
}

/* ---------- «أدوات الفريق» menu ---------- */

.nav-staff__toggle .icon {
  transition: transform 0.2s ease;
}

.nav-staff__toggle[aria-expanded='true'] .icon {
  transform: rotate(180deg);
}

.nav-staff__menu {
  z-index: 30;
}

.nav-staff__toggle[aria-expanded='true'] + .nav-staff__menu {
  display: grid;
  gap: 2px;
}

/* On a staff page the menu item reads as the current section. */
.nav-staff:has([aria-current='page']) > .nav-staff__toggle {
  background: var(--bg-pressed);
}

.nav-staff:has([aria-current='page']) > .nav-staff__toggle::after {
  content: '';
  position: absolute;
  inset-inline: 8px;
  top: 66px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--green-600);
}

/* One staff page: a plain menu item instead of a menu. */
.nav-staff.is-single .nav-staff__toggle,
.nav-staff.is-single small {
  display: none;
}

.nav-staff.is-single .nav-staff__menu {
  position: static;
  display: block;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  transform: none !important;
}

.nav-staff.is-single .nav-staff__menu .site-nav__link {
  flex-direction: row;
  align-items: center;
  height: 72px;
  padding: 8px 16px;
}

.nav-staff.is-single .nav-staff__menu .site-nav__link[aria-current='page']::after {
  display: block;
}

/* ---------- Bell ---------- */

.staff-nav {
  position: relative;
  flex: none;
}

/* After the menu, at the far end of the bar. */
.site-header__inner .staff-nav {
  order: 1;
}

.staff-nav__toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-white);
  color: var(--text-default);
  font-size: 20px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.staff-nav__toggle:hover {
  background: var(--bg-neutral);
}

.staff-nav__toggle[aria-expanded='true'] {
  background: var(--bg-pressed);
}

.staff-nav__badge {
  /* Above the bell glyph, never over it; «99+» reads left to right. */
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 20px;
  padding: 0 5px;
  border: 2px solid var(--bg-white);
  border-radius: var(--radius-full);
  background: #d92d20;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
}

.staff-panel {
  position: absolute;
  top: calc(100% + 12px);
  inset-inline-end: 0;
  z-index: 40;
  width: min(380px, calc(100vw / var(--site-zoom, 1) - 32px));
  max-height: calc(100vh / var(--site-zoom, 1) - 120px);
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-white);
  box-shadow: 0 12px 24px rgba(16, 24, 40, 0.12);
  color: var(--text-default);
  font-size: 14px;
  line-height: 20px;
  text-align: start;
}

.staff-panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.staff-panel__heading {
  font-size: 18px;
  font-weight: 700;
  line-height: 28px;
}

.staff-panel__user {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staff-panel__section + .staff-panel__section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.staff-panel__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--green-700);
  font-size: 14px;
  font-weight: 600;
}

.staff-panel__new {
  padding: 0 8px;
  border-radius: var(--radius-full);
  background: #fef3f2;
  color: #b42318;
  font-size: 12px;
  font-weight: 500;
}

.staff-panel__list {
  display: grid;
  gap: 4px;
  margin: 0 0 8px;
}

.staff-panel__item {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 8px 12px;
  padding-inline-start: 24px;
  border-radius: var(--radius-sm);
  color: var(--text-default);
  text-decoration: none;
}

.staff-panel__item.is-new {
  background: var(--green-50);
}

.staff-panel__item:hover,
.staff-panel__item:focus-visible {
  background: var(--bg-neutral);
}

.staff-panel__item.is-new::before {
  content: '';
  position: absolute;
  inset-inline-start: 9px;
  top: 15px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d92d20;
}

.staff-panel__name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staff-panel__meta {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 18px;
}

.staff-panel__empty,
.staff-panel__error {
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.staff-panel__error {
  color: #b42318;
}

.staff-panel__page {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--green-600);
  color: #fff;
  font-weight: 500;
  text-decoration: none;
}

.staff-panel__page:hover {
  background: var(--green-700);
}

.staff-panel__count {
  min-width: 28px;
  padding: 0 8px;
  border-radius: var(--radius-full);
  background: rgba(16, 70, 49, 0.55);
  text-align: center;
}

.staff-toasts {
  position: fixed;
  bottom: 16px;
  inset-inline-start: 16px;
  z-index: 60;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw / var(--site-zoom, 1) - 32px));
}

.staff-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--green-900);
  box-shadow: 0 12px 24px rgba(16, 24, 40, 0.24);
  color: #fff;
  font-size: 14px;
  line-height: 20px;
}

.staff-toast .icon {
  font-size: 18px;
}

.staff-toast a {
  flex: 1;
  min-width: 0;
  color: #fff;
}

.staff-toast__close {
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.staff-toast :focus-visible {
  outline-color: #fff;
}

/* ---------- Bar too narrow for the eight items plus the staff ones ----------
   Between the burger breakpoint and 1280px the items sit closer together. */
:where(html.is-medium:not(.is-narrow)) .site-nav__list:has(> .nav-staff:not([hidden])) .site-nav__link {
  padding-inline: 5px;
}

/* ---------- Burger layout: the bell sits beside the burger, and the menu lists
   the staff pages under a rule, without the toggle. ---------- */
:where(html.is-narrow) .site-header__inner .staff-nav {
  order: 0;
  margin-inline-start: auto;
}

:where(html.is-narrow) .site-header__inner .staff-nav + .burger {
  margin-inline-start: 0;
}

:where(html.is-narrow) .site-nav__list > .nav-staff:not([hidden]) {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

:where(html.is-narrow) .nav-staff .nav-staff__toggle,
:where(html.is-narrow) .nav-staff small {
  display: none;
}

:where(html.is-narrow) .nav-staff .nav-staff__menu,
:where(html.is-narrow) .nav-staff.is-single .nav-staff__menu {
  position: static;
  display: block;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  transform: none !important;
}

:where(html.is-narrow) .nav-staff .nav-staff__menu .site-nav__link,
:where(html.is-narrow) .nav-staff.is-single .nav-staff__menu .site-nav__link {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  height: 48px;
  padding: 8px 16px;
}

:where(html.is-narrow) .nav-staff .nav-staff__menu .site-nav__link[aria-current='page']::after {
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .nav-staff__toggle .icon,
  .staff-nav__toggle {
    transition: none;
  }
}
