/* Global card menu dropdown — components/dropdown-menu/menu.html.
   Usage: a host element with x-data="{ menuItems: [...] }" + x-component="dropdown-menu/menu".
   Items: { id, label, icon (registry key or raw <svg>), variant: 'primary' | 'default' | 'danger', disabled, run() }.
   The panel is never narrower than 240px (188px with menuCompact: true); every item is a fully rounded pill; the primary
   item is a blue pill, the rest are white with a gray hover, danger items are red. Item labels are always a single line
   (never wrapped). */
.gf-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.gf-menu__trigger {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #475467;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background 160ms cubic-bezier(0.2, 0, 0, 1),
    color 160ms cubic-bezier(0.2, 0, 0, 1);
}

.gf-menu__trigger:hover,
.gf-menu__trigger.is-open {
  background: #f2f4f7;
  color: #101828;
}

.gf-menu__panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 120;
  min-width: 240px;
  max-width: calc(100vw - 32px);
  max-height: min(70vh, 560px);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: #ffffff;
  border-radius: 24px;
  padding: 10px;
  box-shadow:
    0 24px 48px -12px rgba(16, 24, 40, 0.18),
    0 0 0 1px #f2f4f7;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--gf-font);
  box-sizing: border-box;
}

.gf-menu__panel::-webkit-scrollbar,
.gf-menu__view::-webkit-scrollbar {
  display: none;
}

.gf-menu--flyout.gf-menu--open,
.gf-menu--flyout.gf-menu--open .gf-menu__panel {
  z-index: 10000;
}

.gf-menu--flyout .gf-menu__panel {
  overflow: visible;
}

.gf-menu--flyout .gf-menu__panel > .gf-menu__view:first-child {
  max-height: inherit;
  overflow-y: auto;
}

.gf-menu--flyout .gf-menu__item.is-submenu-open {
  background: #f2f4f7;
}

/* Compact variant — narrow hosts (e.g. verifier rows in the deck preview rail). */
.gf-menu--compact .gf-menu__panel {
  min-width: 188px;
  border-radius: 20px;
}

.gf-menu__item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  /* Design ceiling: an item never grows past 50px (~7% shorter than before). */
  max-height: 50px;
  padding: 11px 18px;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 999px;
  font-family: var(--gf-font);
  font-size: var(--gf-text-body);
  line-height: var(--gf-leading-body);
  font-weight: var(--gf-weight-medium);
  color: #101828;
  text-align: left;
  transition:
    background 160ms cubic-bezier(0.2, 0, 0, 1),
    color 160ms cubic-bezier(0.2, 0, 0, 1);
}

.gf-menu__item:hover {
  background: #f2f4f7;
}

.gf-menu__icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #667085;
  flex: 0 0 auto;
}

.gf-menu__icon svg {
  width: 20px;
  height: 20px;
}

.gf-menu__label {
  flex: 1 1 auto;
  /* Labels are always a single line — never wrapped. */
  white-space: nowrap;
}

.gf-menu__item.is-primary {
  position: relative;
  justify-content: center;
  padding-inline: 48px;
  background: var(--gf-blue, #2966f4);
  color: #ffffff;
  font-weight: var(--gf-weight-semibold);
}

/* The label owns the centre of the selected row; the check and any chevron sit in the
   reserved edge slots so the text is not pushed right by the icon. */
.gf-menu__item.is-primary > .gf-menu__icon {
  position: absolute;
  left: 18px;
}

.gf-menu__item.is-primary > .gf-menu__chevron {
  position: absolute;
  right: 18px;
}

.gf-menu__item.is-primary .gf-menu__label {
  flex: 1 1 auto;
  text-align: center;
}

.gf-menu__item.is-primary:hover {
  background: #2054cc;
}

.gf-menu__item.is-danger {
  color: #d92d20;
}

.gf-menu__item.is-danger .gf-menu__icon {
  color: #d92d20;
}

.gf-menu__item.is-danger:hover {
  background: #fef3f2;
}

.gf-menu__item.is-disabled {
  opacity: 0.5;
  cursor: default;
}

.gf-menu__item.is-disabled:hover {
  background: transparent;
}

@media (max-width: 420px) {
  .gf-menu__panel {
    min-width: min(240px, calc(100vw - 24px));
  }
}

/* ── Submenu view ──
   An item with `children` opens a second view in the same panel (e.g. "Add to list" on the
   shared person card). The back row doubles as the submenu title. */
.gf-menu__view {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gf-menu__item-group {
  display: contents;
}

.gf-menu__item.is-submenu-open {
  background: #f2f4f7;
}

.gf-menu__chevron--inline-open svg {
  transform: rotate(180deg);
}

.gf-menu__chevron svg {
  transition: transform 160ms cubic-bezier(0.2, 0, 0, 1);
}

.gf-menu__meta.gf-menu__meta--ongoing {
  padding: 6px 11px;
  border-radius: 999px;
  background: #eaf0ff;
  color: #155eef;
}

.gf-menu__meta.gf-menu__meta--achieved {
  padding: 6px 11px;
  border-radius: 999px;
  background: #d1fadf;
  color: #027a48;
}

.gf-menu__meta.gf-menu__meta--pending {
  padding: 6px 11px;
  border-radius: 999px;
  background: #fff1cc;
  color: #b54708;
}

.gf-menu__meta.gf-menu__meta--canceled,
.gf-menu__meta.gf-menu__meta--rejected {
  padding: 6px 11px;
  border-radius: 999px;
  background: #fee4e2;
  color: #b42318;
}

.gf-menu__meta.gf-menu__meta--expired {
  padding: 6px 11px;
  border-radius: 999px;
  background: #f2f4f7;
  color: #667085;
}

.gf-menu__inline-submenu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 1px 0 2px;
  padding: 5px 8px;
  border-radius: 25px;
  background: #f2f4f7;
}

.gf-menu__inline-subhead {
  padding: 4px 10px 8px;
}

.gf-menu__inline-subhead .gf-menu__subtitle {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.gf-menu__inline-empty {
  padding: 8px 10px;
}

.gf-menu__inline-option {
  min-height: 48px;
  max-height: none;
  padding: 10px 15px;
}

.gf-menu__inline-option.is-selected .gf-menu__icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2966f4;
  color: #fff;
}

.gf-menu__inline-option.is-selected .gf-menu__icon svg {
  width: 16px;
  height: 16px;
}

.gf-menu--flyout .gf-menu__item[data-gf-menu-item] {
  position: relative;
}

.gf-menu--flyout .gf-menu__submenu {
  position: fixed;
  z-index: 10001;
  min-width: 240px;
  max-width: calc(100vw - 24px);
  overflow-y: auto;
  padding: 10px;
  border-radius: 24px;
  background: #ffffff;
  box-shadow:
    0 24px 48px -12px rgba(16, 24, 40, 0.22),
    0 0 0 1px #f2f4f7;
}

.gf-menu--flyout .gf-menu__submenu[data-side="right"]::before,
.gf-menu--flyout .gf-menu__submenu[data-side="left"]::before {
  content: "";
  position: absolute;
  inset-block: 0;
  width: 8px;
}

.gf-menu--flyout .gf-menu__submenu[data-side="right"]::before {
  left: -8px;
}

.gf-menu--flyout .gf-menu__submenu[data-side="left"]::before {
  right: -8px;
}

.gf-menu__chevron {
  margin-left: auto;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #98a2b3;
  flex: 0 0 auto;
}

.gf-menu__chevron svg {
  width: 18px;
  height: 18px;
}

.gf-menu__back {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  margin-bottom: 2px;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 999px;
  font-family: var(--gf-font);
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-semibold);
  color: #101828;
  text-align: left;
}

.gf-menu__back:hover {
  background: #f2f4f7;
}

.gf-menu__back-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  color: #667085;
  flex: 0 0 auto;
}

.gf-menu__back-icon svg {
  width: 18px;
  height: 18px;
}

.gf-menu__subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px 8px;
}

.gf-menu__subtitle {
  font-family: var(--gf-font);
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-semibold);
  color: #101828;
  white-space: nowrap;
}

.gf-menu__create {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 999px;
  font-family: var(--gf-font);
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-semibold);
  color: var(--gf-blue, #2966f4);
  white-space: nowrap;
}

.gf-menu__create:hover {
  background: #eff4ff;
}

.gf-menu__create-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  flex: 0 0 auto;
}

.gf-menu__create-icon svg {
  width: 16px;
  height: 16px;
}

.gf-menu__item > .gf-menu__meta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.gf-menu__meta {
  margin-left: auto;
  font-family: var(--gf-font);
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-medium);
  color: #667085;
  flex: 0 0 auto;
}

.gf-menu__empty {
  margin: 0;
  padding: 10px 14px;
  font-family: var(--gf-font);
  font-size: var(--gf-text-body);
  color: #667085;
}

/* Status dot used by menu items that flag unseen work (e.g. new event registers). */
.gf-menu__meta.gf-menu__meta--attention {
  padding: 0;
  background: transparent;
  color: #f04438;
  font-size: var(--gf-text-body);
  line-height: 1;
}

/*
 * A portaled panel is appended to <body>, outside the dialog that opened it, so it needs to
 * outrank the dialog's backdrop (the campaign detail modal sits at 999999). Without this the
 * menu opens underneath the modal and looks like it never opened at all.
 */
body > .gf-menu__panel[data-gf-menu-portaled='true'] {
  z-index: 1000000;
}
