.editor {
  flex: 1;
  padding-top: 1em;

  label {
    display: block;
  }

  input,
  button,
  select,
  textarea {
    font-family: inherit;
    font-size: inherit;
    -webkit-padding: 0.4em 0;
    padding: 0.4em;
    margin: 0 0 0.5em;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 2px;
  }

  input:disabled {
    color: #ccc;
  }

  button {
    color: #333;
    background-color: #f4f4f4;
    outline: none;
  }

  button:disabled {
    color: #999;
  }

  button:not(:disabled):active {
    background-color: #ddd;
  }

  button:focus {
    border-color: #666;
  }
}

.ProseMirror {
  color: var(--foreground);
  background-color: var(--background);
  position: relative;
  word-wrap: break-word;
  white-space: pre-wrap;
  font-variant-ligatures: none;
  outline: none;
  margin: 1em 1em 1em 2em;

  .dark & {
    color: var(--background);
    background-color: var(--foreground);
  }

  .draggable {
    position: relative;
    margin-left: -30px;
    padding-left: 30px;
  }

  .handle {
    position: absolute;
    left: 0;
    top: 0;
    height: calc(var(--font-fize) * 1.6px);
    opacity: 0;
    cursor: move;
    transition: opacity 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    > span {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 3px;
      padding: 6px;
      fill: var(--foreground);
      pointer-events: none;
      user-select: none;
    }

    &:hover > span {
      background: var(--foreground);
    }
  }

  h1 .handle {
    height: calc(var(--font-size) * 2.3px);
  }

  .draggable:hover .handle {
    opacity: 1;
  }

  blockquote {
    border-left: 2px solid;
    @include font-size(1.6rem);

    margin: 1.5em 0;
    padding-left: 1.6em;
  }
}

.ProseMirror-menuitem {
  display: flex;
  font-size: small;

  &:hover {
    > * {
      background: #eee;
    }

    .ProseMirror-menu-disabled {
      background: inherit;
    }
  }

  > * {
    cursor: pointer;
    align-items: center;
    display: flex;
    padding: 0.8rem 1em;
  }
}

.ProseMirror-textblock-dropdown {
  min-width: 3em;
}

.ProseMirror-menu {
  margin: 0 -4px;
  line-height: 1;
}

.ProseMirror-tooltip .ProseMirror-menu {
  width: fit-content;
  white-space: pre;
}

.ProseMirror-menuseparator {
  border-right: 1px solid #ddd;
}

.ProseMirror-menu-dropdown,
.ProseMirror-menu-dropdown-menu {
  padding: 4px;
  white-space: nowrap;
}

.ProseMirror-menu-dropdown {
  vertical-align: 1px;
  cursor: pointer;
  position: relative;
  padding-right: 15px;
}

.ProseMirror-menu-dropdown-wrap {
  padding: 1px 0 1px 4px;
  display: inline-block;
  position: relative;
}

.ProseMirror-menu-dropdown::after {
  content: '';
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentcolor;
  opacity: 0.6;
  position: absolute;
  right: 4px;
  top: calc(50% - 2px);
}

.ProseMirror-menu-dropdown-menu,
.ProseMirror-menu-submenu {
  position: absolute;
  background: white;
  color: #666;
  border: 1px solid #aaa;
  padding: 2px;
}

.ProseMirror-menu-dropdown-menu {
  z-index: 15;

  /* min-width: 6em; */
}

.ProseMirror-menu-dropdown-item {
  cursor: pointer;
  padding: 2px 8px 2px 4px;
}

.ProseMirror-menu-dropdown-item:hover {
  background: #f2f2f2;
}

.ProseMirror-menu-submenu-wrap {
  position: relative;
  margin-right: -4px;
}

.ProseMirror-menu-submenu-label::after {
  content: '';
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 4px solid currentcolor;
  opacity: 0.6;
  position: absolute;
  right: 4px;
  top: calc(50% - 4px);
}

.ProseMirror-menu-submenu {
  display: none;
  left: 100%;
  top: -3px;
}

.ProseMirror-menu-active {
  background: #eee;
}

.ProseMirror-menu-disabled {
  cursor: default;
  opacity: 0.3;
}

.ProseMirror-menu-submenu-wrap:hover .ProseMirror-menu-submenu,
.ProseMirror-menu-submenu-wrap-active .ProseMirror-menu-submenu {
  display: block;
}

.ProseMirror-menubar {
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
  display: flex;
  position: relative;
  min-height: 1em;
  color: #666;
  padding: 0 1.5em;
  top: 0;
  left: 0;
  right: 0;
  border-bottom: 1px solid silver;
  background: white;
  z-index: 10;
  box-sizing: border-box;
  overflow: visible;
}

.ProseMirror-icon {
  cursor: pointer;
  line-height: 0.8;
}

.ProseMirror-menu-disabled.ProseMirror-icon {
  cursor: default;
}

.ProseMirror-icon svg {
  fill: currentcolor;
  height: 1em;
}

.ProseMirror-icon span {
  vertical-align: text-top;
}

.ProseMirror pre {
  white-space: pre-wrap;
}

.ProseMirror li {
  position: relative;
}

.ProseMirror-hideselection *::selection {
  background: transparent;
}

.ProseMirror-hideselection {
  caret-color: transparent;
}

.ProseMirror-selectednode {
  outline: 2px solid #8cf;
}

/* Make sure li selections wrap around markers */
li.ProseMirror-selectednode {
  outline: none;
}

li.ProseMirror-selectednode::after {
  content: '';
  position: absolute;
  left: -32px;
  right: -2px;
  top: -2px;
  bottom: -2px;
  border: 2px solid #8cf;
  pointer-events: none;
}

.ProseMirror .empty-node::before {
  position: absolute;
  color: #aaa;
  cursor: text;
}

.ProseMirror .empty-node:hover::before {
  color: #777;
}

.ProseMirror.editor_empty::before {
  position: absolute;
  content: attr(data-placeholder);
  pointer-events: none;
  color: var(--ui-color-placeholder);
}

.ProseMirror-prompt {
  background: #fff;
  box-shadow: 0 4px 10px rgb(0 0 0 / 25%);
  font-size: 0.7em;
  position: absolute;
}

.ProseMirror-prompt input[type='text'] {
  border: none;
  font-size: 100%;
  margin-bottom: 0;
  padding: 0.5em 7.5em 0.5em 0.5em;
}

.ProseMirror-prompt-buttons {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 100%;
}

.ProseMirror-prompt-buttons button {
  border: none;
  cursor: pointer;
  display: inline-block;
  font-size: 90%;
  height: 100%;
  line-height: 10em;
  margin-bottom: 0;
  overflow: hidden;
  vertical-align: top;
  width: 2.5em;
}

.ProseMirror-prompt-submit {
  background: url("data:image/svg+xml,%3Csvg width='19' height='15' viewBox='0 0 19 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M19 2.73787L16.2621 0L6.78964 9.47248L2.73787 5.42071L0 8.15858L6.78964 14.9482L19 2.73787Z' fill='%23393840'/%3E%3C/svg%3E")
    center no-repeat;
}

.ProseMirror-prompt-cancel {
  background: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13.1512 0.423856L0.423263 13.1518L2.84763 15.5761L15.5756 2.84822L13.1512 0.423856Z M15.5755 13.1518L2.84763 0.423855L0.423263 2.84822L13.1512 15.5761L15.5755 13.1518Z' fill='%23393840'/%3E%3C/svg%3E%0A")
    center no-repeat;
}

.tooltip {
  background: var(--background);
  box-shadow: 0 4px 10px rgb(0 0 0 / 25%);
  color: #000;
  display: flex;
  position: absolute;
}
