/*
 * Mega menu: <nav> > toggle + <ul class="zx-mega-menu__list"> of .zx-mega-menu-item (widgets/mega-menu-item).
 * The hamburger bars reuse .zx-nav-menu__bars (widgets/nav-menu/style.css, bundled together).
 * States as in nav-menu: root .is-collapsed / .is-open, item .is-open / .is-dismissed.
 */
.zx-mega-menu {
  --zx-mega-panel-bg: #fff;
  --zx-mega-width: 640px;
  --zx-mega-offset: 0px;
  --zx-nav-panel-bg: #fff;
  --zx-nav-toggle-size: 24px;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  box-sizing: border-box;
}
.zx-mega-menu__list {
  display: flex;
  flex-wrap: wrap;
  flex: 1 1 auto;
  align-items: stretch;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.zx-mega-menu__toggle,
.zx-mega-menu__toggle:is(:hover, :active) {
  color: inherit;
  background-color: transparent;
  border-color: transparent;
}
.zx-mega-menu__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 8px;
  border: 0;
  border-radius: 6px;
  line-height: 1;
  cursor: pointer;
}
.zx-mega-menu__toggle:focus-visible {
  outline: 2px solid var(--zx-color-primary, #2563eb);
  outline-offset: -2px;
}
.zx-mega-menu.is-open .zx-nav-menu__bars > span:nth-child(1) {
  top: calc(50% - 1px);
  transform: rotate(45deg);
}
.zx-mega-menu.is-open .zx-nav-menu__bars > span:nth-child(2) {
  opacity: 0;
}
.zx-mega-menu.is-open .zx-nav-menu__bars > span:nth-child(3) {
  top: calc(50% - 1px);
  transform: rotate(-45deg);
}
/* Editor-only "+" (canvas). */
.zx-mega-menu__add {
  align-self: center;
  width: 24px;
  height: 24px;
  margin-inline-start: 6px;
  padding: 0;
  border: 1px dashed rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

/* ---- collapsed (hamburger + accordion) ---- */
.zx-mega-menu.is-collapsed > .zx-mega-menu__toggle {
  display: inline-flex;
}
.zx-mega-menu.is-collapsed > .zx-mega-menu__list {
  display: none;
  position: absolute;
  top: 100%;
  inset-inline: 0;
  z-index: 100;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0;
  padding: 6px 0;
  background: var(--zx-nav-panel-bg);
  color: #1f2937;
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
}
.zx-mega-menu.is-collapsed.is-open > .zx-mega-menu__list {
  display: flex;
}
