.MenuItem {
  --ripple-color: rgba(0, 0, 0, 0.08);

  cursor: var(--custom-cursor, pointer);

  position: relative;

  unicode-bidi: plaintext;
  overflow: hidden;
  display: flex;
  align-items: center;

  width: 100%;
  padding: 0.75rem 1rem;
  border: none !important;

  line-height: 1.5rem;
  color: var(--color-text);
  white-space: nowrap;

  background: none;
  outline: none !important;
  box-shadow: none !important;

  .right-badge {
    flex-shrink: 0;

    min-width: 1.5rem;
    height: 1.5rem;
    margin-left: auto;
    padding: 0 0.4375rem;
    border-radius: 0.75rem;

    font-size: 0.875rem;
    font-weight: var(--font-weight-medium);
    line-height: 1.5rem;
    color: white;
    text-align: center;

    background: var(--color-gray);
  }

  &.compact .right-badge {
    padding: 0;
    color: var(--color-text-secondary);
    background: none;
  }

  &[dir="rtl"] .right-badge {
    margin-right: auto;
    margin-left: 0;
  }

  .icon {
    margin-right: 2rem;
    font-size: 1.5rem;
    color: var(--color-icon-secondary);
  }

  .menu-item-name {
    margin-right: 2rem;

    &.capitalize {
      text-transform: capitalize;
    }
  }

  &.disabled {
    cursor: var(--custom-cursor, default) !important;
    opacity: 0.5 !important;

    &:hover,
    &:focus,
    &:active {
      transform: none !important;
      background-color: transparent !important;
    }
  }

  &.destructive {
    color: var(--color-error);

    .icon {
      color: inherit;
    }
  }

  &:not(.has-ripple):not(.disabled):not(.compact):active {
    background-color: var(--color-item-active);
    transition: none !important;
  }

  .Switcher, .Toggle, .menu-item-badge {
    margin-left: auto;
  }

  .menu-item-badge {
    margin-right: 0.25rem;

    font-size: 0.75rem;
    font-weight: normal;
    line-height: normal;
    color: var(--color-primary);
  }

  &[dir="rtl"] {
    .icon {
      margin-right: 0;
      margin-left: 2rem;
    }

    .menu-item-name {
      margin-right: 0;
      margin-left: 2rem;
    }

    > .Switcher, > .Toggle {
      margin-right: auto;
      margin-left: 0;
    }
  }

  .submenu-icon {
    margin-inline: auto 0 !important;
  }

  &.compact {
    will-change: transform;

    transform: scale(1);

    width: auto;
    margin: 0.125rem 0.25rem;
    padding: 0.25rem;
    padding-inline-end: 0.75rem; // Icon padding + padding for symmetry
    border-radius: 0.375rem;

    font-size: 0.875rem;
    font-weight: var(--font-weight-medium);

    transition: 0.15s ease-in-out transform;

    .icon {
      max-width: 1.25rem;
      margin-inline: 0.5rem 1.25rem;
      font-size: 1.25rem;

      &::before {
        max-width: 1.25rem;
      }
    }

    @media (hover: hover) {
      &:hover,
      &:focus,
      &:active {
        text-decoration: none;
        background: var(--color-background-compact-menu-hover);
      }

      &:active {
        transform: scale(0.98);
      }
    }
  }

  b {
    font-weight: var(--font-weight-semibold);
  }

  a:hover {
    text-decoration: none;
  }

  &.wrap {
    display: block;
    white-space: normal;
  }

  &.text-only {
    padding-inline: 0.5rem;
    line-height: 1.375;
  }

  &.menu-custom-emoji-sets {
    margin: 0 0.25rem;
    padding: 0.5rem 0.75rem;

    font-size: small;
    font-weight: var(--font-weight-normal);
    line-height: 1.125rem;
  }

  @media (hover: hover) {
    &:hover,
    &:focus {
      color: inherit;
      text-decoration: none;
      background-color: var(--color-chat-hover);
    }
  }

  @media (max-width: 600px) {
    &:focus,
    &:hover,
    &:active {
      color: inherit;
      text-decoration: none;
    }

    &:active {
      background-color: var(--color-chat-hover);
    }
  }
}
